summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2008-02-12 07:50:45 +0100
committerDanny Baumann <dannybaumann@web.de>2008-02-12 07:50:45 +0100
commit2782fdc25283e35eb0c46a0924709f973c330fc4 (patch)
tree65f7a063436f5a28cc92c9e308dd1976b4e842ea
parent8d46ffca44feadc50cd2108a180229bd250df99d (diff)
downloadshelf-2782fdc25283e35eb0c46a0924709f973c330fc4.tar.gz
shelf-2782fdc25283e35eb0c46a0924709f973c330fc4.tar.bz2
Save shelfed windows in a linked list.
-rw-r--r--shelf.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/shelf.c b/shelf.c
index edae117..862b9f8 100644
--- a/shelf.c
+++ b/shelf.c
@@ -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);