[gtk/wip/carlosg/start-spinbutton-start] gtkspinbutton: Group up/down button gestures with self
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/carlosg/start-spinbutton-start] gtkspinbutton: Group up/down button gestures with self
- Date: Mon, 24 Aug 2020 12:56:56 +0000 (UTC)
commit e61f516a7c5de04a325c04d0566b11a1ec88cec5
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Aug 24 14:45:42 2020 +0200
gtkspinbutton: Group up/down button gestures with self
We are adding click gestures on the up/down buttons, but can't let
the GtkButton built-in ones prevent ours to run.
As the saying goes, if you can't beat them, join them. Group the
spinbutton and GtkButton gestures together, so it's irrelevant which
gets called first and ends up winning.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3085
gtk/gtkspinbutton.c | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 0927efba90..5177e69d25 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -32,6 +32,7 @@
#include "gtkadjustment.h"
#include "gtkbox.h"
#include "gtkbutton.h"
+#include "gtkbuttonprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkeditable.h"
#include "gtkcelleditable.h"
@@ -966,6 +967,8 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button);
g_signal_connect (gesture, "cancel", G_CALLBACK (button_cancel_cb), spin_button);
gtk_widget_add_controller (GTK_WIDGET (spin_button->down_button), GTK_EVENT_CONTROLLER (gesture));
+ gtk_gesture_group (gtk_button_get_gesture (GTK_BUTTON (spin_button->down_button)),
+ gesture);
spin_button->up_button = gtk_button_new_from_icon_name ("value-increase-symbolic");
gtk_widget_add_css_class (spin_button->up_button, "up");
@@ -981,6 +984,8 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button);
g_signal_connect (gesture, "cancel", G_CALLBACK (button_cancel_cb), spin_button);
gtk_widget_add_controller (GTK_WIDGET (spin_button->up_button), GTK_EVENT_CONTROLLER (gesture));
+ gtk_gesture_group (gtk_button_get_gesture (GTK_BUTTON (spin_button->up_button)),
+ gesture);
gtk_spin_button_set_adjustment (spin_button, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]