[gtk+/gestures] spinbutton: Attach "swipe to spin" controllers to the bubble phase
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gestures] spinbutton: Attach "swipe to spin" controllers to the bubble phase
- Date: Wed, 14 May 2014 14:33:01 +0000 (UTC)
commit 322eb22c22cc4025463596995bcf3b4b602c331c
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed May 14 13:05:41 2014 +0200
spinbutton: Attach "swipe to spin" controllers to the bubble phase
It is unnecessary to have those process events manually, just attach
those to the bubble phase.
gtk/gtkspinbutton.c | 35 +++--------------------------------
1 files changed, 3 insertions(+), 32 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index c0d61e5..ed8ceaf 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -286,9 +286,6 @@ static gint gtk_spin_button_default_input (GtkSpinButton *spin_button,
gdouble *new_val);
static void gtk_spin_button_default_output (GtkSpinButton *spin_button);
-static gboolean gtk_spin_button_touch_event (GtkWidget *widget,
- GdkEventTouch *event);
-
static guint spinbutton_signals[LAST_SIGNAL] = {0};
G_DEFINE_TYPE_WITH_CODE (GtkSpinButton, gtk_spin_button, GTK_TYPE_ENTRY,
@@ -335,7 +332,6 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
widget_class->grab_notify = gtk_spin_button_grab_notify;
widget_class->state_flags_changed = gtk_spin_button_state_flags_changed;
widget_class->style_updated = gtk_spin_button_style_updated;
- widget_class->touch_event = gtk_spin_button_touch_event;
entry_class->activate = gtk_spin_button_activate;
entry_class->get_text_area_size = gtk_spin_button_get_text_area_size;
@@ -719,14 +715,14 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
gtk_widget_add_events (GTK_WIDGET (spin_button), GDK_SCROLL_MASK);
priv->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (spin_button));
- gtk_gesture_attach (priv->long_press_gesture, GTK_PHASE_NONE);
+ gtk_gesture_attach (priv->long_press_gesture, GTK_PHASE_BUBBLE);
g_signal_connect (priv->long_press_gesture, "pressed",
G_CALLBACK (long_press_action), spin_button);
g_signal_connect (priv->long_press_gesture, "cancelled",
G_CALLBACK (long_press_cancel_action), spin_button);
priv->swipe_gesture = gtk_gesture_swipe_new (GTK_WIDGET (spin_button));
- gtk_gesture_attach (priv->swipe_gesture, GTK_PHASE_NONE);
+ gtk_gesture_attach (priv->swipe_gesture, GTK_PHASE_BUBBLE);
g_signal_connect (priv->swipe_gesture, "update",
G_CALLBACK (swipe_gesture_update), spin_button);
}
@@ -1525,29 +1521,6 @@ start_spinning (GtkSpinButton *spin,
gtk_widget_queue_draw (GTK_WIDGET (spin));
}
-static gboolean
-_gtk_spin_button_handle_drag (GtkWidget *widget,
- const GdkEvent *event)
-{
- GtkSpinButtonPrivate *priv;
-
- priv = GTK_SPIN_BUTTON (widget)->priv;
- gtk_event_controller_handle_event (GTK_EVENT_CONTROLLER (priv->long_press_gesture),
- (const GdkEvent*) event);
- gtk_event_controller_handle_event (GTK_EVENT_CONTROLLER (priv->swipe_gesture),
- (const GdkEvent*) event);
-
- return (gtk_gesture_is_recognized (priv->long_press_gesture) ||
- gtk_gesture_is_recognized (priv->swipe_gesture));
-}
-
-static gboolean
-gtk_spin_button_touch_event (GtkWidget *widget,
- GdkEventTouch *event)
-{
- return _gtk_spin_button_handle_drag (widget, (const GdkEvent*) event);
-}
-
static gint
gtk_spin_button_button_press (GtkWidget *widget,
GdkEventButton *event)
@@ -1580,7 +1553,6 @@ gtk_spin_button_button_press (GtkWidget *widget,
}
else
{
- _gtk_spin_button_handle_drag (widget, (const GdkEvent*) event);
return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->button_press_event (widget, event);
}
}
@@ -1625,7 +1597,6 @@ gtk_spin_button_button_release (GtkWidget *widget,
}
else
{
- _gtk_spin_button_handle_drag (widget, (const GdkEvent*) event);
return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->button_release_event (widget, event);
}
}
@@ -1651,7 +1622,7 @@ gtk_spin_button_motion_notify (GtkWidget *widget,
return FALSE;
}
- if (_gtk_spin_button_handle_drag (widget, (const GdkEvent*) event))
+ if (gtk_gesture_is_recognized (priv->swipe_gesture))
return TRUE;
return GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->motion_notify_event (widget, event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]