[nautilus/wip/ernestask/671] pathbar: Claim path bar button presses



commit fa29a901a9760b07b5a04300cc85340d83c7aeb1
Author: Ernestas Kulik <ernestask gnome org>
Date:   Thu Oct 4 15:14:30 2018 +0300

    pathbar: Claim path bar button presses
    
    Since these are forwarded to the title bar, in cases where the middle
    click does something special (e.g. minimize the window), unintended
    side-effects might be observed in conjunction to opening the location in
    a new tab. Claiming the sequence helps prevent that.
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/671

 src/nautilus-pathbar.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index b3188d8de..54698ef90 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -1199,16 +1199,6 @@ on_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
 
         case GDK_BUTTON_SECONDARY:
         {
-            GdkEventSequence *sequence;
-
-            /* Claim the event to prevent GtkWindow from popping up the window
-             * manager menu, since we are in the titlebar.
-             */
-            sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
-            gtk_gesture_set_sequence_state (GTK_GESTURE (gesture),
-                                            sequence,
-                                            GTK_EVENT_SEQUENCE_CLAIMED);
-
             if (g_file_equal (button_data->path, self->current_path))
             {
                 gtk_popover_popup (self->current_view_menu_popover);
@@ -1227,9 +1217,16 @@ on_multi_press_gesture_pressed (GtkGestureMultiPress *gesture,
             /* Ignore other buttons in this gesture. GtkButton will claim the
              * primary button presses and emit the "clicked" signal.
              */
+            return;
         }
         break;
     }
+
+    /* Both middle- and secondary-clicking the title bar can have interesting
+     * effects (minimizing the window, popping up a window manager menu, etc.),
+     * and this avoids all that.
+     */
+    gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
 }
 
 static GIcon *


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