[epiphany/mcatanzaro/#919] action-bar-start: handle middle click on back/forward buttons



commit 1a78736ba5067910fecb145c67de4123af5867dc
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Nov 30 10:59:59 2019 -0600

    action-bar-start: handle middle click on back/forward buttons
    
    This is to prevent GTK from executing a middle-click titlebar action if
    configured in GNOME Tweaks.
    
    Note this prevents holding a middle-click to open the menu, but you can
    still do that using a left-click and then middle-click on the menu
    items, so that's fine.
    
    Really fixes #919

 src/ephy-action-bar-start.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/ephy-action-bar-start.c b/src/ephy-action-bar-start.c
index 55978ad00..328bbfec0 100644
--- a/src/ephy-action-bar-start.c
+++ b/src/ephy-action-bar-start.c
@@ -315,10 +315,19 @@ navigation_button_press_event_cb (GtkButton *button,
   direction = strstr (action_name, "back") ? EPHY_NAVIGATION_HISTORY_DIRECTION_BACK
                                            : EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD;
 
-  if (((GdkEventButton *)event)->button == GDK_BUTTON_SECONDARY) {
-    popup_history_menu (GTK_WIDGET (button), EPHY_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET 
(action_bar_start), EPHY_TYPE_WINDOW)),
-                        direction, (GdkEventButton *)event);
-    return GDK_EVENT_STOP;
+  switch (((GdkEventButton *)event)->button) {
+    case GDK_BUTTON_SECONDARY:
+      popup_history_menu (GTK_WIDGET (button), EPHY_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET 
(action_bar_start), EPHY_TYPE_WINDOW)),
+                          direction, (GdkEventButton *)event);
+      return GDK_EVENT_STOP;
+    case GDK_BUTTON_MIDDLE:
+      /* If a desktop-wide middle-click titlebar action is enabled, we want to
+       * prevent that action from occurring because we handle middle click in
+       * navigation_button_release_event_cb().
+       */
+      return GDK_EVENT_STOP;
+    default:
+      break;
   }
 
   data = g_new (PopupData, 1);


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