]> Dogcows Code - chaz/openbox/blobdiff - src/bindings.cc
fix \'s
[chaz/openbox] / src / bindings.cc
index 2994f5640376686b08060a922fb7d4325b97662e..7c13ca64f9eba8e3290817a14eb9b7f51e8a7726 100644 (file)
@@ -482,23 +482,26 @@ void OBBindings::grabButton(bool grab, const Binding &b, MouseContext context,
 {
   Window win;
   int mode = GrabModeAsync;
+  unsigned int mask;
   switch(context) {
   case MC_Frame:
     win = client->frame->window();
+    mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
     break;
   case MC_Window:
     win = client->frame->plate();
     mode = GrabModeSync; // this is handled in fireButton
+    mask = ButtonPressMask; // can't catch more than this with Sync mode
+                            // the release event is manufactured by the
+                            // master buttonPressHandler
     break;
   default:
     // any other elements already get button events, don't grab on them
     return;
   }
   if (grab)
-    otk::OBDisplay::grabButton(b.key, b.modifiers, win, false,
-                               ButtonPressMask | ButtonMotionMask |
-                               ButtonReleaseMask, mode, GrabModeAsync,
-                               None, None, false);
+    otk::OBDisplay::grabButton(b.key, b.modifiers, win, false, mask, mode,
+                               GrabModeAsync, None, None, false);
   else
     otk::OBDisplay::ungrabButton(b.key, b.modifiers, win);
 }
@@ -512,11 +515,10 @@ void OBBindings::grabButtons(bool grab, OBClient *client)
   }
 }
 
-void OBBindings::fireButton(ButtonData *data)
+void OBBindings::fireButton(MouseData *data)
 {
   if (data->context == MC_Window) {
-    // these are grabbed in Sync mode to allow the press to be normal to the
-    // client
+    // Replay the event, so it goes to the client, and ungrab the device.
     XAllowEvents(otk::OBDisplay::display, ReplayPointer, data->time);
   }
   
@@ -527,7 +529,7 @@ void OBBindings::fireButton(ButtonData *data)
       CallbackList::iterator c_it,c_end = (*it)->callbacks[data->action].end();
       for (c_it = (*it)->callbacks[data->action].begin();
            c_it != c_end; ++c_it)
-        python_callback(*c_it, (PyObject*)data);
+        python_callback(*c_it, data);
     }
 }
 
This page took 0.020647 seconds and 4 git commands to generate.