summaryrefslogtreecommitdiff
path: root/gdk/gdkevents.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-07-09 18:39:58 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-08-12 23:20:24 +0200
commita3b402a9498787d2704f6ab228d3814683c946eb (patch)
tree8f70f4a5bba9ebd4cac430845e450391236f717d /gdk/gdkevents.c
parent7281803169561f3932d23e9fe0c56826ccdd3b7e (diff)
downloadgtk+-a3b402a9498787d2704f6ab228d3814683c946eb.tar.gz
gdk: Add touchpad gesture events and event types.
Each gesture type has its separate GdkEvent struct, and begin/update/ end/cancel event types. There is support for multi-finger swipe (3-4 fingers), and 2-finger rotate/pinch gestures.
Diffstat (limited to 'gdk/gdkevents.c')
-rw-r--r--gdk/gdkevents.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 86557785e9..2b2c6f8eec 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -570,6 +570,24 @@ gdk_event_new (GdkEventType type)
new_event->crossing.x_root = 0.;
new_event->crossing.y_root = 0.;
break;
+ case GDK_TOUCHPAD_SWIPE:
+ new_event->touchpad_swipe.x = 0;
+ new_event->touchpad_swipe.y = 0;
+ new_event->touchpad_swipe.dx = 0;
+ new_event->touchpad_swipe.dy = 0;
+ new_event->touchpad_swipe.x_root = 0;
+ new_event->touchpad_swipe.y_root = 0;
+ break;
+ case GDK_TOUCHPAD_PINCH:
+ new_event->touchpad_pinch.x = 0;
+ new_event->touchpad_pinch.y = 0;
+ new_event->touchpad_pinch.dx = 0;
+ new_event->touchpad_pinch.dy = 0;
+ new_event->touchpad_pinch.angle_delta = 0;
+ new_event->touchpad_pinch.scale = 0;
+ new_event->touchpad_pinch.x_root = 0;
+ new_event->touchpad_pinch.y_root = 0;
+ break;
default:
break;
}
@@ -863,6 +881,10 @@ gdk_event_get_time (const GdkEvent *event)
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
return event->touch.time;
+ case GDK_TOUCHPAD_SWIPE:
+ return event->touchpad_swipe.time;
+ case GDK_TOUCHPAD_PINCH:
+ return event->touchpad_pinch.time;
case GDK_SCROLL:
return event->scroll.time;
case GDK_KEY_PRESS:
@@ -946,6 +968,12 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_TOUCH_CANCEL:
*state = event->touch.state;
return TRUE;
+ case GDK_TOUCHPAD_SWIPE:
+ *state = event->touchpad_swipe.state;
+ return TRUE;
+ case GDK_TOUCHPAD_PINCH:
+ *state = event->touchpad_pinch.state;
+ return TRUE;
case GDK_SCROLL:
*state = event->scroll.state;
return TRUE;
@@ -1046,6 +1074,14 @@ gdk_event_get_coords (const GdkEvent *event,
x = event->motion.x;
y = event->motion.y;
break;
+ case GDK_TOUCHPAD_SWIPE:
+ x = event->touchpad_swipe.x;
+ y = event->touchpad_swipe.y;
+ break;
+ case GDK_TOUCHPAD_PINCH:
+ x = event->touchpad_pinch.x;
+ y = event->touchpad_pinch.y;
+ break;
default:
fetched = FALSE;
break;
@@ -1117,6 +1153,14 @@ gdk_event_get_root_coords (const GdkEvent *event,
x = event->dnd.x_root;
y = event->dnd.y_root;
break;
+ case GDK_TOUCHPAD_SWIPE:
+ x = event->touchpad_swipe.x_root;
+ y = event->touchpad_swipe.y_root;
+ break;
+ case GDK_TOUCHPAD_PINCH:
+ x = event->touchpad_pinch.x_root;
+ y = event->touchpad_pinch.y_root;
+ break;
default:
fetched = FALSE;
break;