[gtk/wip/carlosg/spin-button-swipe-gesture-4-2: 1/2] spinbutton: Connect swipe gesture to the text entry




commit a00d3b107e0f0f771731f1c14575c1d85dad966e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jun 8 15:06:29 2021 +0200

    spinbutton: Connect swipe gesture to the text entry
    
    In the GTK3 days, the spin button was an entry, with buttons on
    top, and the swipe gesture affected the input on the entry bits.
    Now the spin button is a container, so this gesture in the capture
    phase applies to all contained children (incl. buttons).
    
    Attach this gesture to the entry itself, so the buttons are left
    outside this business. The gesture is still in the capture phase
    in order to prevent text selection/edition/etc to happen.
    
    Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4008

 gtk/gtkspinbutton.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 344f8870e6..ba7a3d5fa9 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -1078,7 +1078,8 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
                     G_CALLBACK (swipe_gesture_begin), spin_button);
   g_signal_connect (gesture, "update",
                     G_CALLBACK (swipe_gesture_update), spin_button);
-  gtk_widget_add_controller (GTK_WIDGET (spin_button), GTK_EVENT_CONTROLLER (gesture));
+  gtk_widget_add_controller (GTK_WIDGET (spin_button->entry),
+                             GTK_EVENT_CONTROLLER (gesture));
 
   controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
                                                GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);


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