]> Dogcows Code - chaz/openbox/blobdiff - openbox/grab.c
add a comparitor to timers. use this in event.c to let you remove timers from the...
[chaz/openbox] / openbox / grab.c
index 991956da622b291e9ab4a05f5a02a10f086a9de5..9b19906a340b7289a20f7a0256a38dbb8dec02e7 100644 (file)
@@ -26,7 +26,8 @@
 #include <glib.h>
 #include <X11/Xlib.h>
 
-#define GRAB_PTR_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
+#define GRAB_PTR_MASK (ButtonPressMask | ButtonReleaseMask | \
+                       PointerMotionMask | EnterWindowMask | LeaveWindowMask)
 #define GRAB_KEY_MASK (KeyPressMask | KeyReleaseMask)
 
 #define MASK_LIST_SIZE 8
@@ -41,8 +42,16 @@ static Time  grab_time = CurrentTime;
 static Time ungrab_time()
 {
     Time t = event_curtime;
-    if (!(t == 0 || event_time_after(t, grab_time)))
-        t = grab_time;
+    if (!(t == CurrentTime || event_time_after(t, grab_time)))
+        /* When the time moves backward on the server, then we can't use
+           the grab time because that will be in the future. So instead we
+           have to use CurrentTime.
+
+           "XUngrabPointer does not release the pointer if the specified time
+           is earlier than the last-pointer-grab time or is later than the
+           current X server time."
+        */
+        t = CurrentTime; /*grab_time;*/
     return t;
 }
 
@@ -63,7 +72,7 @@ gboolean grab_keyboard(gboolean grab)
     if (grab) {
         if (kgrabs++ == 0) {
             ret = XGrabKeyboard(ob_display, RootWindow(ob_display, ob_screen),
-                                FALSE, GrabModeAsync, GrabModeAsync,
+                                False, GrabModeAsync, GrabModeAsync,
                                 event_curtime) == Success;
             if (!ret)
                 --kgrabs;
@@ -88,7 +97,7 @@ gboolean grab_pointer(gboolean grab, ObCursor cur)
     if (grab) {
         if (pgrabs++ == 0) {
             ret = XGrabPointer(ob_display, screen_support_win,
-                               False, GRAB_PTR_MASK, GrabModeAsync,
+                               True, GRAB_PTR_MASK, GrabModeAsync,
                                GrabModeAsync, None,
                                ob_cursor(cur), event_curtime) == Success;
             if (!ret)
@@ -112,7 +121,7 @@ gboolean grab_pointer_window(gboolean grab, ObCursor cur, Window win)
 
     if (grab) {
         if (pgrabs++ == 0) {
-            ret = XGrabPointer(ob_display, win, False, GRAB_PTR_MASK,
+            ret = XGrabPointer(ob_display, win, True, GRAB_PTR_MASK,
                                GrabModeAsync, GrabModeAsync, None,
                                ob_cursor(cur),
                                event_curtime) == Success;
This page took 0.02394 seconds and 4 git commands to generate.