[gtk+] window: Reset on unhandled gestures right away



commit e3bd895667a1dbecaae50a0e2911ed1319111f79
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Sep 17 23:22:39 2015 +0200

    window: Reset on unhandled gestures right away
    
    Traditionally a sequence is set to GTK_EVENT_SEQUENCE_DENIED state when
    it is to be ignored, which means it is dormant, but still managed by the
    gesture (accounting, "denied" sequences still make "slots" in multitouch
    gesture busy, etc...).
    
    This gesture will run for all button presses and releases in the window
    though when presses happen on the "window content" region, and we can't
    account for every children to be as educated as setting the proper mask
    on every window, or ensuring events will be propagated as they should.
    
    In order to cater for this, just reset the gestures, we can live without
    such accounting in these specific GtkGestureSingle gestures.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754098

 gtk/gtkwindow.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 7cb2497..bf6d510 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -61,6 +61,7 @@
 #include "a11y/gtkwindowaccessible.h"
 #include "a11y/gtkcontaineraccessibleprivate.h"
 #include "gtkapplicationprivate.h"
+#include "gtkgestureprivate.h"
 #include "inspector/init.h"
 #include "inspector/window.h"
 
@@ -1450,6 +1451,14 @@ multipress_gesture_pressed_cb (GtkGestureMultiPress *gesture,
         {
           gtk_gesture_set_sequence_state (GTK_GESTURE (gesture),
                                           sequence, GTK_EVENT_SEQUENCE_DENIED);
+
+          /* Reset immediately the gestures, here we don't get many guarantees
+           * about whether the target window event mask will be complete enough
+           * to keep gestures consistent, or whether any widget across the
+           * hierarchy will be inconsistent about event handler return values.
+           */
+          gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
+          gtk_event_controller_reset (GTK_EVENT_CONTROLLER (priv->drag_gesture));
           return;
         }
       /* fall thru */


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