]> Dogcows Code - chaz/openbox/blobdiff - openbox/grab.c
add (optional) support for showing a busy cursor via startup notification
[chaz/openbox] / openbox / grab.c
index b2426b9da51df569b854cfb3148fb94e03044b64..656f6eb401d43ea0be9e5075124e540ba959a382 100644 (file)
@@ -6,6 +6,7 @@
 #include <X11/Xlib.h>
 
 #define GRAB_PTR_MASK (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
+#define GRAB_KEY_MASK (KeyPressMask | KeyReleaseMask)
 
 #define MASK_LIST_SIZE 8
 
@@ -17,8 +18,8 @@ int grab_keyboard(gboolean grab)
     static guint kgrabs = 0;
     if (grab) {
         if (kgrabs++ == 0)
-            XGrabKeyboard(ob_display, ob_root, 0, GrabModeAsync, GrabModeSync,
-                          event_lasttime);
+            XGrabKeyboard(ob_display, ob_root, FALSE, GrabModeAsync,
+                          GrabModeAsync, event_lasttime);
     } else if (kgrabs > 0) {
         if (--kgrabs == 0)
             XUngrabKeyboard(ob_display, event_lasttime);
@@ -95,14 +96,19 @@ void grab_shutdown()
     while (grab_server(FALSE));
 }
 
-void grab_button(guint button, guint state, Window win, guint mask,
-                 int pointer_mode)
+void grab_button_full(guint button, guint state, Window win, guint mask,
+                      int pointer_mode, Cursor cursor)
 {
     guint i;
 
     for (i = 0; i < MASK_LIST_SIZE; ++i)
         XGrabButton(ob_display, button, state | mask_list[i], win, FALSE, mask,
-                    pointer_mode, GrabModeSync, None, None);
+                    pointer_mode, GrabModeSync, None, cursor);
+}
+
+void grab_button(guint button, guint state, Window win, guint mask)
+{
+    grab_button_full(button, state, win, mask, GrabModeAsync, None);
 }
 
 void ungrab_button(guint button, guint state, Window win)
This page took 0.020867 seconds and 4 git commands to generate.