X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fgrab.c;h=e2784a2d3d578a46e235b07121fad6df33a3ebf3;hb=b8ba1cff1fdd5447984e83708865f8ba6c7f223a;hp=34fd2302811db7d8b3c0313dffe696622590890a;hpb=ff04a81e62cc9337f89fc913feb29f5295c84217;p=chaz%2Fopenbox diff --git a/openbox/grab.c b/openbox/grab.c index 34fd2302..e2784a2d 100644 --- a/openbox/grab.c +++ b/openbox/grab.c @@ -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) {