grab root mouse bindings on desktop windows also, since they are conceptually the desktop.

This commit is contained in:
Dana Jansens 2003-08-20 06:17:43 +00:00
parent 0844866bbd
commit 6375df675f
2 changed files with 21 additions and 4 deletions

View file

@ -640,11 +640,24 @@ ObFrameContext frame_context(ObClient *client, Window win)
if (win == RootWindow(ob_display, ob_screen)) return OB_FRAME_CONTEXT_ROOT; if (win == RootWindow(ob_display, ob_screen)) return OB_FRAME_CONTEXT_ROOT;
if (client == NULL) return OB_FRAME_CONTEXT_NONE; if (client == NULL) return OB_FRAME_CONTEXT_NONE;
if (win == client->window) return OB_FRAME_CONTEXT_CLIENT; if (win == client->window) {
/* conceptually, this is the root window, as far as users are
concerned */
if (client->type == OB_CLIENT_TYPE_DESKTOP)
return OB_FRAME_CONTEXT_ROOT;
return OB_FRAME_CONTEXT_CLIENT;
}
self = client->frame; self = client->frame;
if (win == self->plate) {
/* conceptually, this is the root window, as far as users are
concerned */
if (client->type == OB_CLIENT_TYPE_DESKTOP)
return OB_FRAME_CONTEXT_ROOT;
return OB_FRAME_CONTEXT_CLIENT;
}
if (win == self->window) return OB_FRAME_CONTEXT_FRAME; if (win == self->window) return OB_FRAME_CONTEXT_FRAME;
if (win == self->plate) return OB_FRAME_CONTEXT_CLIENT;
if (win == self->title) return OB_FRAME_CONTEXT_TITLEBAR; if (win == self->title) return OB_FRAME_CONTEXT_TITLEBAR;
if (win == self->label) return OB_FRAME_CONTEXT_TITLEBAR; if (win == self->label) return OB_FRAME_CONTEXT_TITLEBAR;
if (win == self->handle) return OB_FRAME_CONTEXT_HANDLE; if (win == self->handle) return OB_FRAME_CONTEXT_HANDLE;

View file

@ -17,6 +17,10 @@ typedef struct {
GSList *actions[OB_MOUSE_NUM_ACTIONS]; /* lists of Action pointers */ GSList *actions[OB_MOUSE_NUM_ACTIONS]; /* lists of Action pointers */
} ObMouseBinding; } 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. */ /* Array of GSList*s of PointerBinding*s. */
static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS]; 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; win = client->frame->window;
mode = GrabModeAsync; mode = GrabModeAsync;
mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
} else if (i == OB_FRAME_CONTEXT_CLIENT) { } else if (CLIENT_CONTEXT(i, client)) {
win = client->frame->plate; win = client->frame->plate;
mode = GrabModeSync; /* this is handled in event */ mode = GrabModeSync; /* this is handled in event */
mask = ButtonPressMask; /* can't catch more than this with Sync mask = ButtonPressMask; /* can't catch more than this with Sync
@ -211,7 +215,7 @@ void mouse_event(ObClient *client, ObFrameContext context, XEvent *e)
e->xbutton.button, e->xbutton.button,
e->xbutton.x_root, e->xbutton.y_root); 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*/ /* Replay the event, so it goes to the client*/
XAllowEvents(ob_display, ReplayPointer, event_lasttime); XAllowEvents(ob_display, ReplayPointer, event_lasttime);
/* Fall through to the release case! */ /* Fall through to the release case! */