[gtk+] GtkWindow: Check for GtkWidget-window-dragging in multipress gesture



commit 92de947d5e9be41c3805d58b780132d779c7c3cf
Author: Timm Bäder <mail baedert org>
Date:   Tue Jun 28 20:54:25 2016 +0200

    GtkWindow: Check for GtkWidget-window-dragging in multipress gesture
    
    This partly reverts 9f5b9c0e075e2426d6627f867473e911fca0c7ae, which
    removed the check for GtkWidget-window-dragging in the multipress
    gesture. This check is still needed for widgets which have this style
    property set (e.g. menubars and toolbars) can maximize the window on
    double click -- but those widgets which have it set to FALSE shouldn't
    maximize the window.

 gtk/gtkwindow.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 263f8bc..857e450 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1429,12 +1429,13 @@ multipress_gesture_pressed_cb (GtkGestureMultiPress *gesture,
                                gdouble               y,
                                GtkWindow            *window)
 {
-  GtkWidget *widget;
+  GtkWidget *event_widget, *widget;
   GdkEventSequence *sequence;
   GtkWindowRegion region;
   GtkWindowPrivate *priv;
   const GdkEvent *event;
   guint button;
+  gboolean window_drag = FALSE;
 
   widget = GTK_WIDGET (window);
   priv = gtk_window_get_instance_private (window);
@@ -1477,12 +1478,25 @@ multipress_gesture_pressed_cb (GtkGestureMultiPress *gesture,
   else if (button != GDK_BUTTON_PRIMARY)
     return;
 
+  event_widget = gtk_get_event_widget ((GdkEvent *) event);
+
   if (region == GTK_WINDOW_REGION_TITLE)
     gdk_window_raise (_gtk_widget_get_window (widget));
 
   switch (region)
     {
     case GTK_WINDOW_REGION_CONTENT:
+      if (event_widget != widget)
+        gtk_widget_style_get (event_widget, "window-dragging", &window_drag, NULL);
+
+      if (!window_drag)
+        {
+          gtk_gesture_set_sequence_state (GTK_GESTURE (gesture),
+                                          sequence, GTK_EVENT_SEQUENCE_DENIED);
+          return;
+        }
+      /* fall through */
+
     case GTK_WINDOW_REGION_TITLE:
       if (n_press == 2)
         gtk_window_titlebar_action (window, event, button, n_press);


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