X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fgrab.c;h=91f7915cbe7b5661575918fbdedf308336482197;hb=acc6124682c674e16b896bfe6b54c94f12f4cb87;hp=34fd2302811db7d8b3c0313dffe696622590890a;hpb=a43303bdcbb5460f8d50823c4d0cedc30de6bb57;p=chaz%2Fopenbox diff --git a/openbox/grab.c b/openbox/grab.c index 34fd2302..91f7915c 100644 --- a/openbox/grab.c +++ b/openbox/grab.c @@ -31,7 +31,7 @@ #define MASK_LIST_SIZE 8 /*! A list of all possible combinations of keyboard lock masks */ -static unsigned int mask_list[MASK_LIST_SIZE]; +static guint mask_list[MASK_LIST_SIZE]; static guint kgrabs = 0; static guint pgrabs = 0; @@ -50,11 +50,13 @@ gboolean grab_keyboard(gboolean grab) gboolean ret = FALSE; if (grab) { - if (kgrabs++ == 0) + if (kgrabs++ == 0) { ret = XGrabKeyboard(ob_display, RootWindow(ob_display, ob_screen), FALSE, GrabModeAsync, GrabModeAsync, event_lasttime) == Success; - else + if (!ret) + --kgrabs; + } else ret = TRUE; } else if (kgrabs > 0) { if (--kgrabs == 0) @@ -70,12 +72,14 @@ gboolean grab_pointer(gboolean grab, ObCursor cur) gboolean ret = FALSE; if (grab) { - if (pgrabs++ == 0) + if (pgrabs++ == 0) { ret = XGrabPointer(ob_display, screen_support_win, False, GRAB_PTR_MASK, GrabModeAsync, GrabModeAsync, FALSE, ob_cursor(cur), event_lasttime) == Success; - else + if (!ret) + --pgrabs; + } else ret = TRUE; } else if (pgrabs > 0) { if (--pgrabs == 0) { @@ -91,12 +95,14 @@ gboolean grab_pointer_window(gboolean grab, ObCursor cur, Window win) gboolean ret = FALSE; if (grab) { - if (pgrabs++ == 0) + if (pgrabs++ == 0) { ret = XGrabPointer(ob_display, win, False, GRAB_PTR_MASK, GrabModeAsync, GrabModeAsync, TRUE, ob_cursor(cur), event_lasttime) == Success; - else + if (!ret) + --pgrabs; + } else ret = TRUE; } else if (pgrabs > 0) { if (--pgrabs == 0) { @@ -152,7 +158,7 @@ void grab_shutdown(gboolean reconfig) } void grab_button_full(guint button, guint state, Window win, guint mask, - int pointer_mode, ObCursor cur) + gint pointer_mode, ObCursor cur) { guint i; @@ -179,7 +185,7 @@ void ungrab_button(guint button, guint state, Window win) XUngrabButton(ob_display, button, state | mask_list[i], win); } -void grab_key(guint keycode, guint state, Window win, int keyboard_mode) +void grab_key(guint keycode, guint state, Window win, gint keyboard_mode) { guint i;