- struct foreach_grab_temp bt;
- bt.client = client;
- bt.grab = grab;
- g_datalist_foreach(&bound_contexts, foreach_grab, &bt);
+ int i;
+ GSList *it;
+
+ for (i = 0; i < NUM_CONTEXTS; ++i)
+ for (it = bound_contexts[i]; it != NULL; it = it->next) {
+ /* grab/ungrab the button */
+ MouseBinding *b = it->data;
+ Window win;
+ int mode;
+ unsigned int mask;
+
+ if (i == Context_Frame) {
+ win = client->frame->window;
+ mode = GrabModeAsync;
+ mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
+ } else if (i == Context_Client) {
+ win = client->frame->plate;
+ mode = GrabModeSync; /* this is handled in event */
+ mask = ButtonPressMask; /* can't catch more than this with Sync
+ mode the release event is
+ manufactured in event() */
+ } else continue;
+
+ if (grab)
+ grab_button(b->button, b->state, win, mask, mode);
+ else
+ ungrab_button(b->button, b->state, win);
+ }