[gtk/wip/carlosg/scroll-controller-fixes: 2/2] gtkwidget: Forward unhandled scroll events through controllers
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/carlosg/scroll-controller-fixes: 2/2] gtkwidget: Forward unhandled scroll events through controllers
- Date: Mon, 21 Oct 2019 15:14:36 +0000 (UTC)
commit c9a1adf2ccf7df5211b3c768f1361de1942e1a7b
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Oct 21 17:10:30 2019 +0200
gtkwidget: Forward unhandled scroll events through controllers
Do just like button/motion/touch do, let the scroll events go first
through the event handler, and fallback on the current event controllers
afterwards.
Fixes handling of bubbled scroll events in the scroll controller.
gtk/gtkwidget.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2848d757b5..65b168eb47 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -673,6 +673,8 @@ static gboolean _gtk_widget_run_controllers (GtkWidget *widget,
static void gtk_widget_dispatch_child_properties_changed (GtkWidget *object,
guint n_pspecs,
GParamSpec **pspecs);
+static gboolean gtk_widget_real_scroll_event (GtkWidget *widget,
+ GdkEventScroll *event);
static gboolean gtk_widget_real_button_event (GtkWidget *widget,
GdkEventButton *event);
static gboolean gtk_widget_real_motion_event (GtkWidget *widget,
@@ -1061,6 +1063,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->move_focus = gtk_widget_real_move_focus;
klass->keynav_failed = gtk_widget_real_keynav_failed;
klass->event = NULL;
+ klass->scroll_event = gtk_widget_real_scroll_event;
klass->button_press_event = gtk_widget_real_button_event;
klass->button_release_event = gtk_widget_real_button_event;
klass->motion_notify_event = gtk_widget_real_motion_event;
@@ -7186,6 +7189,14 @@ gtk_widget_draw (GtkWidget *widget,
cairo_restore (cr);
}
+static gboolean
+gtk_widget_real_scroll_event (GtkWidget *widget,
+ GdkEventScroll *event)
+{
+ return _gtk_widget_run_controllers (widget, (GdkEvent *) event,
+ GTK_PHASE_BUBBLE);
+}
+
static gboolean
gtk_widget_real_button_event (GtkWidget *widget,
GdkEventButton *event)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]