[gtk+/gestures] widget: Hook GTK_PHASE_TARGET controllers to the default event handlers
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gestures] widget: Hook GTK_PHASE_TARGET controllers to the default event handlers
- Date: Sat, 10 May 2014 19:23:46 +0000 (UTC)
commit 76273a2eb9e9bb9a1ea07ea81b132170deae6264
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat May 10 20:52:17 2014 +0200
widget: Hook GTK_PHASE_TARGET controllers to the default event handlers
Just call the controllers on that phase if the default widget handlers
are run.
For compatibility reasons, in the touch event handler, let the pointer
emulating touch be transformed to a pointer event as usual, in order to
have widget handlers a chance to run at all. If they have to be managed
by a controller in that phase, it'll have to be through the default pointer
event handlers.
gtk/gtkwidget.c | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3a99b06..e8620c6 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -687,10 +687,17 @@ static gboolean gtk_widget_real_query_tooltip (GtkWidget *widget,
static void gtk_widget_real_style_updated (GtkWidget *widget);
static gboolean gtk_widget_real_show_help (GtkWidget *widget,
GtkWidgetHelpType help_type);
+static gboolean _gtk_widget_run_controllers (GtkWidget *widget,
+ const GdkEvent *event,
+ GtkPropagationPhase phase);
static void gtk_widget_dispatch_child_properties_changed (GtkWidget *object,
guint n_pspecs,
GParamSpec **pspecs);
+static gboolean gtk_widget_real_button_event (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean gtk_widget_real_motion_event (GtkWidget *widget,
+ GdkEventMotion *event);
static gboolean gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event);
static gboolean gtk_widget_real_key_release_event (GtkWidget *widget,
@@ -701,6 +708,8 @@ static gboolean gtk_widget_real_focus_out_event (GtkWidget
*widget,
GdkEventFocus *event);
static gboolean gtk_widget_real_touch_event (GtkWidget *widget,
GdkEventTouch *event);
+static gboolean gtk_widget_real_grab_broken_event (GtkWidget *widget,
+ GdkEventGrabBroken *event);
static gboolean gtk_widget_real_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_widget_real_move_focus (GtkWidget *widget,
@@ -1091,9 +1100,9 @@ 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->button_press_event = NULL;
- klass->button_release_event = NULL;
- klass->motion_notify_event = NULL;
+ 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;
klass->touch_event = gtk_widget_real_touch_event;
klass->delete_event = NULL;
klass->destroy_event = NULL;
@@ -1123,7 +1132,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->drag_data_received = NULL;
klass->screen_changed = NULL;
klass->can_activate_accel = gtk_widget_real_can_activate_accel;
- klass->grab_broken_event = NULL;
+ klass->grab_broken_event = gtk_widget_real_grab_broken_event;
klass->query_tooltip = gtk_widget_real_query_tooltip;
klass->style_updated = gtk_widget_real_style_updated;
@@ -7064,6 +7073,22 @@ gtk_widget_draw (GtkWidget *widget,
}
static gboolean
+gtk_widget_real_button_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ return _gtk_widget_run_controllers (widget, (GdkEvent *) event,
+ GTK_PHASE_TARGET);
+}
+
+static gboolean
+gtk_widget_real_motion_event (GtkWidget *widget,
+ GdkEventMotion *event)
+{
+ return _gtk_widget_run_controllers (widget, (GdkEvent *) event,
+ GTK_PHASE_TARGET);
+}
+
+static gboolean
gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
@@ -7104,7 +7129,8 @@ gtk_widget_real_touch_event (GtkWidget *widget,
gint signum;
if (!event->emulating_pointer)
- return FALSE;
+ return _gtk_widget_run_controllers (widget, (GdkEvent*) event,
+ GTK_PHASE_TARGET);
if (event->type == GDK_TOUCH_BEGIN ||
event->type == GDK_TOUCH_END)
@@ -7164,6 +7190,13 @@ gtk_widget_real_touch_event (GtkWidget *widget,
return return_val;
}
+static gboolean
+gtk_widget_real_grab_broken_event (GtkWidget *widget,
+ GdkEventGrabBroken *event)
+{
+ return _gtk_widget_run_controllers (widget, (GdkEvent*) event,
+ GTK_PHASE_TARGET);
+}
#define WIDGET_REALIZED_FOR_EVENT(widget, event) \
(event->type == GDK_FOCUS_CHANGE || gtk_widget_get_realized(widget))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]