summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2008-01-01 00:42:09 +0100
committerKristian Lyngstol <kristian@windu.lyngstol.net>2008-01-01 00:42:09 +0100
commit9532105f74f382324353df70fa51b68e4b5cee95 (patch)
tree47ed27f11b343cbb7f65d6259328bf9327996017
parentab5c73e2518ab828eb7dc830e584b1322ad1edb8 (diff)
downloadshelf-9532105f74f382324353df70fa51b68e4b5cee95.tar.gz
shelf-9532105f74f382324353df70fa51b68e4b5cee95.tar.bz2
HandleEvent to pass off focus to the shelfed window.
More to come for movement and similar. Cleanup needed.
-rw-r--r--shelf.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/shelf.c b/shelf.c
index 2c153dc..95d12ba 100644
--- a/shelf.c
+++ b/shelf.c
@@ -48,6 +48,12 @@ typedef struct {
int windowPrivateIndex;
} shelfScreen;
+typedef struct {
+ HandleEventProc handleEvent;
+} shelfDisplay;
+
+static shelfDisplay sdtmp;
+static shelfDisplay *sd = &sdtmp;
static int displayPrivateIndex;
static int screenPrivateIndex;
@@ -235,6 +241,28 @@ shelfDec (CompDisplay *d,
shelfScaleWindow (w, sw->targetScale * shelfGetInterval (d));
return TRUE;
}
+static void
+shelfHandleEvent (CompDisplay *d, XEvent *event)
+{
+ SHELF_SCREEN (d->screens);
+ CompWindow *w;
+ switch (event->type)
+ {
+ case ButtonPress:
+ for (w = d->screens->windows; w; w = w->next)
+ {
+ SHELF_WINDOW (w);
+ if (event->xbutton.window == sw->ipw)
+ {
+ moveInputFocusToWindow (w);
+ }
+ }
+ break;
+ }
+ UNWRAP (sd, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP (sd, d, handleEvent, shelfHandleEvent);
+}
/* The window was damaged, adjust the damage to fit the actual area we
* care about.
@@ -354,6 +382,7 @@ shelfFiniDisplay (CompPlugin *p,
{
if (screenPrivateIndex >= 0)
freeScreenPrivateIndex (d, screenPrivateIndex);
+ UNWRAP (sd, d, handleEvent);
}
static Bool
@@ -374,6 +403,7 @@ shelfInitDisplay (CompPlugin *p,
shelfSetTriggerKeyInitiate (d, shelfTrigger);
shelfSetIncButtonInitiate (d, shelfInc);
shelfSetDecButtonInitiate (d, shelfDec);
+ WRAP (sd, d, handleEvent, shelfHandleEvent);
return TRUE;
}