X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fmouse.c;h=93d00784fb7232638f616795d8f7c1ce4c876dfc;hb=6375df675f01dd1a9bc625e95d799b9cb40bcda3;hp=216124847919a23807efacc722185b1b068f3084;hpb=8b67ce7030aa22595d77527cdc5b74b84d185a8b;p=chaz%2Fopenbox diff --git a/openbox/mouse.c b/openbox/mouse.c index 21612484..93d00784 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -17,6 +17,10 @@ typedef struct { GSList *actions[OB_MOUSE_NUM_ACTIONS]; /* lists of Action pointers */ } ObMouseBinding; +#define CLIENT_CONTEXT(co, cl) (co == OB_FRAME_CONTEXT_CLIENT || \ + (co == OB_FRAME_CONTEXT_ROOT && \ + cl->type == OB_CLIENT_TYPE_DESKTOP)) + /* Array of GSList*s of PointerBinding*s. */ static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS]; @@ -37,7 +41,7 @@ void mouse_grab_for_client(ObClient *client, gboolean grab) win = client->frame->window; mode = GrabModeAsync; mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; - } else if (i == OB_FRAME_CONTEXT_CLIENT) { + } else if (CLIENT_CONTEXT(i, client)) { win = client->frame->plate; mode = GrabModeSync; /* this is handled in event */ mask = ButtonPressMask; /* can't catch more than this with Sync @@ -83,9 +87,9 @@ static void clearall() } } -static void fire_button(ObMouseAction a, ObFrameContext context, - ObClient *c, guint state, - guint button, int x, int y) +static gboolean fire_button(ObMouseAction a, ObFrameContext context, + ObClient *c, guint state, + guint button, int x, int y) { GSList *it; ObMouseBinding *b; @@ -96,7 +100,7 @@ static void fire_button(ObMouseAction a, ObFrameContext context, break; } /* if not bound, then nothing to do! */ - if (it == NULL) return; + if (it == NULL) return FALSE; for (it = b->actions[a]; it; it = it->next) { ObAction *act = it->data; @@ -131,11 +135,12 @@ static void fire_button(ObMouseAction a, ObFrameContext context, act->func(&act->data); } } + return TRUE; } -static void fire_motion(ObMouseAction a, ObFrameContext context, ObClient *c, - guint state, guint button, int x_root, int y_root, - guint32 corner) +static gboolean fire_motion(ObMouseAction a, ObFrameContext context, + ObClient *c, guint state, guint button, + int x_root, int y_root, guint32 corner) { GSList *it; ObMouseBinding *b; @@ -146,7 +151,7 @@ static void fire_motion(ObMouseAction a, ObFrameContext context, ObClient *c, break; } /* if not bound, then nothing to do! */ - if (it == NULL) return; + if (it == NULL) return FALSE; for (it = b->actions[a]; it; it = it->next) { ObAction *act = it->data; @@ -170,6 +175,7 @@ static void fire_motion(ObMouseAction a, ObFrameContext context, ObClient *c, act->func(&act->data); } } + return TRUE; } static guint32 pick_corner(int x, int y, int cx, int cy, int cw, int ch) @@ -209,7 +215,7 @@ void mouse_event(ObClient *client, ObFrameContext context, XEvent *e) e->xbutton.button, e->xbutton.x_root, e->xbutton.y_root); - if (context == OB_FRAME_CONTEXT_CLIENT) { + if (CLIENT_CONTEXT(context, client)) { /* Replay the event, so it goes to the client*/ XAllowEvents(ob_display, ReplayPointer, event_lasttime); /* Fall through to the release case! */