From 1e451abcfacf4ec9b07c3101e60822b5f1f24a88 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 8 Jan 2010 18:22:18 +0100 Subject: [PATCH] "Fix" releasing the mouse button over a window. 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 | 6 ++++++ openbox/mouse.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/openbox/event.c b/openbox/event.c index 5774f67d..cc54c219 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -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 guint button; + #ifdef USE_SM static gboolean ice_handler(GIOChannel *source, GIOCondition cond, gpointer conn) @@ -723,6 +725,10 @@ static void event_process(const XEvent *ec, gpointer data) if (e->type == ButtonPress) pressed = e->xbutton.button; + /* We ignored the release event so make sure we don't think + the button is still pressed */ + else if (e->type == ButtonRelease) + button = 0; } } else if (e->type == KeyPress || e->type == KeyRelease || diff --git a/openbox/mouse.c b/openbox/mouse.c index 4da22f3c..5cc165c5 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -43,6 +43,9 @@ static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS]; to send it to other applications */ static gboolean replay_pointer_needed; +/* this is the static button from mouse_event, moved here so that event.c can clear it */ +guint button; + ObFrameContext mouse_button_frame_context(ObFrameContext context, guint button, guint state) @@ -209,7 +212,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, lx = -10, ly = -10; gboolean used = FALSE; -- 2.39.2