[gtk/wip/carlosg/range-autoscroll] gtkrange: group gestures the right way around



commit e1a0171094e5d27241e81014c5c7808aa72a40c3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 9 20:44:42 2020 +0200

    gtkrange: group gestures the right way around
    
    The gtk_gesture_group() call is not a commutative operation, it
    takes two gestures, maybe detaches the first one from its current
    group, and adds it to the same group than the second gesture.
    
    With the flipped argument order here, GtkRange was actually detaching
    the same gesture in order to group it with a second one two times, so
    the desired effect to group all 3 gestures was not achieved.
    
    Fixes autoscroll as the drag gesture is now actually grouped with the
    click one, so drag offsets can be accessed from the autoscroll
    timeout.

 gtk/gtkrange.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 91f16b5133..e76ca4e688 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -567,14 +567,14 @@ gtk_range_init (GtkRange *range)
   g_signal_connect (gesture, "released",
                     G_CALLBACK (gtk_range_click_gesture_released), range);
   gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (gesture));
-  gtk_gesture_group (priv->drag_gesture, gesture);
+  gtk_gesture_group (gesture, priv->drag_gesture);
 
   gesture = gtk_gesture_long_press_new ();
   gtk_gesture_long_press_set_delay_factor (GTK_GESTURE_LONG_PRESS (gesture), 2.0);
   g_signal_connect (gesture, "pressed",
                     G_CALLBACK (gtk_range_long_press_gesture_pressed), range);
   gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (gesture));
-  gtk_gesture_group (priv->drag_gesture, gesture);
+  gtk_gesture_group (gesture, priv->drag_gesture);
 
   controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES);
   g_signal_connect (controller, "scroll",


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