diff options
author | Danny Baumann <dannybaumann@web.de> | 2008-02-12 07:50:45 +0100 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2008-02-12 07:50:45 +0100 |
commit | 2782fdc25283e35eb0c46a0924709f973c330fc4 (patch) | |
tree | 65f7a063436f5a28cc92c9e308dd1976b4e842ea /shelf.c | |
parent | 8d46ffca44feadc50cd2108a180229bd250df99d (diff) | |
download | shelf-2782fdc25283e35eb0c46a0924709f973c330fc4.tar.gz shelf-2782fdc25283e35eb0c46a0924709f973c330fc4.tar.bz2 |
Save shelfed windows in a linked list.
Diffstat (limited to 'shelf.c')
-rw-r--r-- | shelf.c | 53 |
1 files changed, 52 insertions, 1 deletions
@@ -36,7 +36,10 @@ #include <math.h> #include "shelf_options.h" -typedef struct { +typedef struct _ShelfedWindowInfo { + CompWindow *w; + struct _ShelfedWindowInfo *next; + Window ipw; XRectangle *inputRects; @@ -68,6 +71,8 @@ typedef struct { int lastPointerX; int lastPointerY; + ShelfedWindowInfo *shelfedWindows; + PaintWindowProc paintWindow; DamageWindowRectProc damageWindowRect; PreparePaintScreenProc preparePaintScreen; @@ -242,6 +247,47 @@ shelfPreparePaintScreen (CompScreen *s, WRAP (ss, s, preparePaintScreen, shelfPreparePaintScreen); } +static void +shelfAddWindowToList (ShelfedWindowInfo *info) +{ + CompScreen *s = info->w->screen; + ShelfedWindowInfo *run; + + SHELF_SCREEN (s); + + run = ss->shelfedWindows; + if (!run) + ss->shelfedWindows = info; + else + { + for (; run->next; run = run->next); + run->next = info; + } +} + +static void +shelfRemoveWindowFromList (ShelfedWindowInfo *info) +{ + CompScreen *s = info->w->screen; + ShelfedWindowInfo *run; + + SHELF_SCREEN (s); + + if (!ss->shelfedWindows) + return; + + if (ss->shelfedWindows == info) + ss->shelfedWindows = info->next; + else + { + for (run = ss->shelfedWindows; run->next; run = run->next) + { + if (run->next == info) + run->next = info->next; + } + } +} + /* Adjust size and location of the input prevention window */ static void @@ -312,6 +358,7 @@ shelfHandleShelfInfo (CompWindow *w) XDestroyWindow (w->screen->display->display, sw->info->ipw); shelfUnshapeInput (w); + shelfRemoveWindowFromList (sw->info); free (sw->info); sw->info = NULL; @@ -324,8 +371,10 @@ shelfHandleShelfInfo (CompWindow *w) if (!sw->info) return FALSE; + sw->info->w = w; shelfShapeInput (w); shelfCreateIPW (w); + shelfAddWindowToList (sw->info); } return TRUE; @@ -725,6 +774,8 @@ shelfInitScreen (CompPlugin *p, ss->lastPointerY = 0; ss->noLastPointer = TRUE; + ss->shelfedWindows = NULL; + WRAP (ss, s, preparePaintScreen, shelfPreparePaintScreen); WRAP (ss, s, paintWindow, shelfPaintWindow); WRAP (ss, s, damageWindowRect, shelfDamageWindowRect); |