[gtk+/wip/garnacho/touchpad-gestures: 128/141] gdk: Add touchpad gesture events and event types.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/garnacho/touchpad-gestures: 128/141] gdk: Add touchpad gesture events and event types.
- Date: Mon, 20 Jul 2015 20:16:39 +0000 (UTC)
commit 106623e691e18896f5ec13ae60e3e8afaeeb8aa9
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jul 9 18:39:58 2015 +0200
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.
gdk/gdkevents.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
gdk/gdkevents.h | 41 ++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 3d8d7bc..a8dc932 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -570,6 +570,30 @@ gdk_event_new (GdkEventType type)
new_event->crossing.x_root = 0.;
new_event->crossing.y_root = 0.;
break;
+ case GDK_TOUCHPAD_SWIPE_BEGIN:
+ case GDK_TOUCHPAD_SWIPE_UPDATE:
+ case GDK_TOUCHPAD_SWIPE_END:
+ case GDK_TOUCHPAD_SWIPE_CANCEL:
+ 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_BEGIN:
+ case GDK_TOUCHPAD_PINCH_UPDATE:
+ case GDK_TOUCHPAD_PINCH_END:
+ case GDK_TOUCHPAD_PINCH_CANCEL:
+ 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 +887,16 @@ gdk_event_get_time (const GdkEvent *event)
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
return event->touch.time;
+ case GDK_TOUCHPAD_SWIPE_BEGIN:
+ case GDK_TOUCHPAD_SWIPE_UPDATE:
+ case GDK_TOUCHPAD_SWIPE_END:
+ case GDK_TOUCHPAD_SWIPE_CANCEL:
+ return event->touchpad_swipe.time;
+ case GDK_TOUCHPAD_PINCH_BEGIN:
+ case GDK_TOUCHPAD_PINCH_UPDATE:
+ case GDK_TOUCHPAD_PINCH_END:
+ case GDK_TOUCHPAD_PINCH_CANCEL:
+ return event->touchpad_pinch.time;
case GDK_SCROLL:
return event->scroll.time;
case GDK_KEY_PRESS:
@@ -946,6 +980,18 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_TOUCH_CANCEL:
*state = event->touch.state;
return TRUE;
+ case GDK_TOUCHPAD_SWIPE_BEGIN:
+ case GDK_TOUCHPAD_SWIPE_UPDATE:
+ case GDK_TOUCHPAD_SWIPE_END:
+ case GDK_TOUCHPAD_SWIPE_CANCEL:
+ *state = event->touchpad_swipe.state;
+ return TRUE;
+ case GDK_TOUCHPAD_PINCH_BEGIN:
+ case GDK_TOUCHPAD_PINCH_UPDATE:
+ case GDK_TOUCHPAD_PINCH_END:
+ case GDK_TOUCHPAD_PINCH_CANCEL:
+ *state = event->touchpad_pinch.state;
+ return TRUE;
case GDK_SCROLL:
*state = event->scroll.state;
return TRUE;
@@ -1046,6 +1092,20 @@ gdk_event_get_coords (const GdkEvent *event,
x = event->motion.x;
y = event->motion.y;
break;
+ case GDK_TOUCHPAD_SWIPE_BEGIN:
+ case GDK_TOUCHPAD_SWIPE_UPDATE:
+ case GDK_TOUCHPAD_SWIPE_END:
+ case GDK_TOUCHPAD_SWIPE_CANCEL:
+ x = event->touchpad_swipe.x;
+ y = event->touchpad_swipe.y;
+ break;
+ case GDK_TOUCHPAD_PINCH_BEGIN:
+ case GDK_TOUCHPAD_PINCH_UPDATE:
+ case GDK_TOUCHPAD_PINCH_END:
+ case GDK_TOUCHPAD_PINCH_CANCEL:
+ x = event->touchpad_pinch.x;
+ y = event->touchpad_pinch.y;
+ break;
default:
fetched = FALSE;
break;
@@ -1117,6 +1177,20 @@ gdk_event_get_root_coords (const GdkEvent *event,
x = event->dnd.x_root;
y = event->dnd.y_root;
break;
+ case GDK_TOUCHPAD_SWIPE_BEGIN:
+ case GDK_TOUCHPAD_SWIPE_UPDATE:
+ case GDK_TOUCHPAD_SWIPE_END:
+ case GDK_TOUCHPAD_SWIPE_CANCEL:
+ x = event->touchpad_swipe.x_root;
+ y = event->touchpad_swipe.y_root;
+ break;
+ case GDK_TOUCHPAD_PINCH_BEGIN:
+ case GDK_TOUCHPAD_PINCH_UPDATE:
+ case GDK_TOUCHPAD_PINCH_END:
+ case GDK_TOUCHPAD_PINCH_CANCEL:
+ x = event->touchpad_pinch.x_root;
+ y = event->touchpad_pinch.y_root;
+ break;
default:
fetched = FALSE;
break;
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index d681de7..1141047 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -139,6 +139,8 @@ typedef struct _GdkEventDND GdkEventDND;
typedef struct _GdkEventWindowState GdkEventWindowState;
typedef struct _GdkEventSetting GdkEventSetting;
typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
+typedef struct _GdkEventTouchpadSwipe GdkEventTouchpadSwipe;
+typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch;
typedef struct _GdkEventSequence GdkEventSequence;
@@ -331,6 +333,14 @@ typedef enum
GDK_TOUCH_UPDATE = 38,
GDK_TOUCH_END = 39,
GDK_TOUCH_CANCEL = 40,
+ GDK_TOUCHPAD_SWIPE_BEGIN = 41,
+ GDK_TOUCHPAD_SWIPE_UPDATE = 42,
+ GDK_TOUCHPAD_SWIPE_END = 43,
+ GDK_TOUCHPAD_SWIPE_CANCEL = 44,
+ GDK_TOUCHPAD_PINCH_BEGIN = 45,
+ GDK_TOUCHPAD_PINCH_UPDATE = 46,
+ GDK_TOUCHPAD_PINCH_END = 47,
+ GDK_TOUCHPAD_PINCH_CANCEL = 48,
GDK_EVENT_LAST /* helper variable for decls */
} GdkEventType;
@@ -1113,6 +1123,35 @@ struct _GdkEventDND {
gshort x_root, y_root;
};
+struct _GdkEventTouchpadSwipe {
+ GdkEventType type;
+ GdkWindow *window;
+ gint8 send_event;
+ guint32 time;
+ gdouble x;
+ gdouble y;
+ gdouble dx;
+ gdouble dy;
+ gdouble x_root, y_root;
+ guint state;
+ guint16 n_fingers;
+};
+
+struct _GdkEventTouchpadPinch {
+ GdkEventType type;
+ GdkWindow *window;
+ gint8 send_event;
+ guint32 time;
+ gdouble x;
+ gdouble y;
+ gdouble dx;
+ gdouble dy;
+ gdouble angle_delta;
+ gdouble scale;
+ gdouble x_root, y_root;
+ guint state;
+};
+
/**
* GdkEvent:
* @type: the #GdkEventType
@@ -1189,6 +1228,8 @@ union _GdkEvent
GdkEventWindowState window_state;
GdkEventSetting setting;
GdkEventGrabBroken grab_broken;
+ GdkEventTouchpadSwipe touchpad_swipe;
+ GdkEventTouchpadPinch touchpad_pinch;
};
GDK_AVAILABLE_IN_ALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]