[nautilus/wip/antoniof/new-view-event-bugfixes: 2/3] list-base: Ignore double-click while holding Shift or Ctrl




commit 8daf810a7e1fbe2a80e6a09aae640633226cc4d8
Author: António Fernandes <antoniof gnome org>
Date:   Wed Jun 22 10:51:56 2022 +0100

    list-base: Ignore double-click while holding Shift or Ctrl
    
    Double clicking an item while holding down Shift can result in opening
    a bunch of files in a go, because it selects an interval right before
    triggering activation.
    
    This is obviously undersirable, especially if people expect the that
    holding down the modifier would actually modify the double click action
    to open in a new window or tab (the old canvas view used to do just
    that, but that behaviro was inconsistent with the list view anyway).
    
    The safe thing to do here is nothing. Just ignoring the double-click
    if Shift or Ctrl are pressed.

 src/nautilus-list-base.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-list-base.c b/src/nautilus-list-base.c
index 8fe2ad431..f1885eec4 100644
--- a/src/nautilus-list-base.c
+++ b/src/nautilus-list-base.c
@@ -313,7 +313,13 @@ on_item_click_pressed (GtkGestureClick *gesture,
      * they don't interfere with touch scrolling. */
     if (button == GDK_BUTTON_PRIMARY && n_press == 2 && !priv->single_click_mode)
     {
-        activate_selection_on_click (self, modifiers & GDK_SHIFT_MASK);
+        /* If Ctrl + Shift are held, we don't want to activate selection. But
+         * we still need to claim the event, otherwise GtkListBase's default
+         * gesture is going to trigger activation. */
+        if (!selection_mode)
+        {
+            activate_selection_on_click (self, FALSE);
+        }
         gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
     }
     else if (button == GDK_BUTTON_MIDDLE && n_press == 1)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]