"Fix" releasing the mouse button over a window.
authorMikael Magnusson <mikachu@gmail.com>
Fri, 8 Jan 2010 17:22:18 +0000 (18:22 +0100)
committerMikael Magnusson <mikachu@gmail.com>
Sun, 19 Sep 2010 16:06:21 +0000 (18:06 +0200)
Previously if you click-drag-released the left button on the root window to a client window,
Openbox would ignore the release because we don't own the client window. Now check if we
are in a button press or not before ignoring it. The bug was we would initiate a move when
the cursor was moved over a titlebar even when the button was unpressed because the variable
didn't get cleared properly.

This fix is very ugly.

openbox/event.c
openbox/mouse.c

index 9e122411221732e8875bfa64fb9312af3708e71c..e0b0fd7750595251d149a786571619546693a407 100644 (file)
@@ -117,6 +117,8 @@ static ObClient *focus_delay_timeout_client = NULL;
 static guint unfocus_delay_timeout_id = 0;
 static ObClient *unfocus_delay_timeout_client = NULL;
 
+extern int button;
+
 #ifdef USE_SM
 static gboolean ice_handler(GIOChannel *source, GIOCondition cond,
                             gpointer conn)
@@ -721,6 +723,10 @@ static void event_process(const XEvent *ec, gpointer data)
                 pressed = e->xbutton.button;
                 pressed_win = e->xbutton.subwindow;
             }
+            /* If we have grabbed the mouse actively, I think this is how
+               to check it? */
+            else if (button)
+                event_handle_user_input(NULL, e);
         }
     }
     else if (e->type == KeyPress || e->type == KeyRelease ||
index ddf6851d2424d57bc0a40ee166a4b4b4d3555af2..34f5245404befc5dfa5ea251b54cbba7a49c219d 100644 (file)
@@ -43,6 +43,8 @@ static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS];
    to send it to other applications */
 static gboolean replay_pointer_needed;
 
+guint button;
+
 ObFrameContext mouse_button_frame_context(ObFrameContext context,
                                           guint button,
                                           guint state)
@@ -209,7 +211,7 @@ void mouse_replay_pointer(void)
 gboolean mouse_event(ObClient *client, XEvent *e)
 {
     static Time ltime;
-    static guint button = 0, state = 0, lbutton = 0;
+    static guint state = 0, lbutton = 0;
     static Window lwindow = None;
     static gint px, py, pwx = -1, pwy = -1;
     gboolean used = FALSE;