[gtk+/gestures: 191/202] paned: Handle pointer events from touchscreen devices
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gestures: 191/202] paned: Handle pointer events from touchscreen devices
- Date: Fri, 23 May 2014 18:12:25 +0000 (UTC)
commit 5fdf07547feb0215b555ff114f1d58322c3e93b6
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 19 23:02:49 2014 +0200
paned: Handle pointer events from touchscreen devices
GtkPaned may just capture pointer events because the child widget
doesn't happen to have GDK_TOUCH_MASK set, resort to checking the
device in that case.
gtk/gtkpaned.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index fe28801..c41c171 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -697,15 +697,20 @@ pan_gesture_drag_begin_cb (GtkGestureDrag *gesture,
GdkEventSequence *sequence;
GtkAllocation allocation;
const GdkEvent *event;
+ GdkDevice *device;
+ gboolean is_touch;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
+ device = gdk_event_get_source_device (event);
gtk_widget_get_allocation (GTK_WIDGET (paned), &allocation);
paned->priv->panning = FALSE;
+ is_touch = (event->type == GDK_TOUCH_BEGIN ||
+ gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN);
+
if (event->any.window == priv->handle ||
- (event->type == GDK_TOUCH_BEGIN &&
- initiates_touch_drag (paned, start_x, start_y)))
+ (is_touch && initiates_touch_drag (paned, start_x, start_y)))
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
priv->drag_pos = start_x - (priv->handle_pos.x - allocation.x);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]