]> Dogcows Code - chaz/openbox/blobdiff - openbox/mouse.c
when focusing or raising a window which is modal child for a direct parent, raise...
[chaz/openbox] / openbox / mouse.c
index dbd48695277042f6caead446271b2c51434cd6ae..711317ec77514946964c456a0b36e6dfad655891 100644 (file)
@@ -142,7 +142,7 @@ static void grab_all_clients(gboolean grab)
         mouse_grab_for_client(it->data, grab);
 }
 
-void mouse_unbind_all()
+void mouse_unbind_all(void)
 {
     gint i;
     GSList *it;
@@ -225,6 +225,17 @@ void mouse_event(ObClient *client, XEvent *e)
         button = e->xbutton.button;
         state = e->xbutton.state;
 
+        /* if the binding was in a client context, then we need to call
+           XAllowEvents with ReplayPointer at some point, to send the event
+           through to the client.  when this happens though depends.  if
+           windows are going to be moved on screen, then the click will end
+           up going somewhere wrong, so have the action system perform the
+           ReplayPointer for us if that is the case. */
+        if (CLIENT_CONTEXT(context, client))
+            actions_set_need_pointer_replay_before_move(TRUE);
+        else
+            actions_set_need_pointer_replay_before_move(FALSE);
+
         fire_binding(OB_MOUSE_ACTION_PRESS, context,
                      client, e->xbutton.state,
                      e->xbutton.button,
@@ -235,11 +246,14 @@ void mouse_event(ObClient *client, XEvent *e)
         if (grab_on_pointer())
             button = 0;
 
-        if (CLIENT_CONTEXT(context, client)) {
-            /* Replay the event, so it goes to the client*/
+        /* replay the pointer event if it hasn't been replayed yet (i.e. no
+           windows were moved) */
+        if (actions_get_need_pointer_replay_before_move())
             XAllowEvents(ob_display, ReplayPointer, event_curtime);
-            /* Fall through to the release case! */
-        } else
+
+        /* in the client context, we won't get a button release because of the
+           way it is grabbed, so just fake one */
+        if (!CLIENT_CONTEXT(context, client))
             break;
 
     case ButtonRelease:
This page took 0.023101 seconds and 4 git commands to generate.