]> git.mdlowis.com Git - proto/labwc.git/commitdiff
cursor: Don't allow a DRAG action to start from a double-click
authorJohn Lindgren <john@jlindgren.net>
Sat, 8 Jan 2022 07:01:14 +0000 (02:01 -0500)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 8 Jan 2022 09:31:53 +0000 (09:31 +0000)
By moving the cursor slightly after the second press (but before
the second release) it was possible to accidentally trigger both a
DOUBLECLICK and a DRAG action.  Doing this on the titlebar would
cause the window to maximize and then immediately unmaximize, which
feels very "glitchy".

As a simple fix, don't allow a press event that is triggering a
DOUBLECLICK to also trigger a DRAG (or CLICK) on the following
release event.

Note: Openbox avoids the issue by processing DOUBLECLICK on the
second release event.  If the cursor moves before that, the DRAG
wins out and the DOUBLECLICK isn't processed.

src/cursor.c

index d28b2db3b0f4ce407952c80e2063638becba5554..12d7298156cf45ca7d9e47e2796d21f4a1eb914a 100644 (file)
@@ -542,7 +542,13 @@ handle_press_mousebinding(struct view *view, struct server *server,
                        switch (mousebind->mouse_event) {
                        case MOUSE_ACTION_DRAG: /* FALLTHROUGH */
                        case MOUSE_ACTION_CLICK:
-                               mousebind->pressed_in_context = true;
+                               /*
+                                * DRAG and CLICK actions will be processed on
+                                * the release event, unless the press event is
+                                * counted as a DOUBLECLICK.
+                                */
+                               if (!double_click)
+                                       mousebind->pressed_in_context = true;
                                continue;
                        case MOUSE_ACTION_DOUBLECLICK:
                                if (!double_click)