summaryrefslogtreecommitdiff
path: root/gdk/gdkevents.h
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2011-02-28 20:53:42 +0100
committerMatthias Clasen <mclasen@redhat.com>2012-03-01 16:25:20 -0500
commit7f35708ceeef47cef6807a8a5edc86f4229e1a80 (patch)
tree7b0436a75cf48f9db153b45a9da7088689ab84f3 /gdk/gdkevents.h
parenta490d2ebda584fe5145f5031ea7c1f0d2e1ec83b (diff)
downloadgtk+-7f35708ceeef47cef6807a8a5edc86f4229e1a80.tar.gz
gdk: Add touch event types and mask
This commit introduces GDK_TOUCH_BEGIN/UPDATE/END/CANCEL and a separate GdkEventTouch struct that they use. This is closer to the touch event API of other platforms and matches the xi2 events closely, too.
Diffstat (limited to 'gdk/gdkevents.h')
-rw-r--r--gdk/gdkevents.h67
1 files changed, 66 insertions, 1 deletions
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 29eda15715..e0341526bf 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -129,6 +129,7 @@ typedef struct _GdkEventExpose GdkEventExpose;
typedef struct _GdkEventVisibility GdkEventVisibility;
typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventButton GdkEventButton;
+typedef struct _GdkEventTouch GdkEventTouch;
typedef struct _GdkEventScroll GdkEventScroll;
typedef struct _GdkEventKey GdkEventKey;
typedef struct _GdkEventFocus GdkEventFocus;
@@ -264,6 +265,14 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
* was added in 2.8.
* @GDK_DAMAGE: the content of the window has been changed. This event type
* was added in 2.14.
+ * @GDK_TOUCH_BEGIN: A new touch event sequence has just started. This event
+ * type was added in 3.4.
+ * @GDK_TOUCH_UPDATE: A touch event sequence has been updated. This event type
+ * was added in 3.4.
+ * @GDK_TOUCH_END: A touch event sequence has finished. This event type
+ * was added in 3.4.
+ * @GDK_TOUCH_CANCEL: A touch event sequence has been canceled. This event type
+ * was added in 3.4.
* @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
*
* Specifies the type of the event.
@@ -311,6 +320,10 @@ typedef enum
GDK_OWNER_CHANGE = 34,
GDK_GRAB_BROKEN = 35,
GDK_DAMAGE = 36,
+ GDK_TOUCH_BEGIN = 37,
+ GDK_TOUCH_UPDATE = 38,
+ GDK_TOUCH_END = 39,
+ GDK_TOUCH_CANCEL = 40,
GDK_EVENT_LAST /* helper variable for decls */
} GdkEventType;
@@ -598,7 +611,7 @@ struct _GdkEventMotion
*
* Used for button press and button release events. The
* @type field will be one of %GDK_BUTTON_PRESS,
- * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, and %GDK_BUTTON_RELEASE.
+ * %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE,
*
* Double and triple-clicks result in a sequence of events being received.
* For double-clicks the order of events will be:
@@ -647,6 +660,57 @@ struct _GdkEventButton
};
/**
+ * GdkEventTouch:
+ * @type: the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
+ * %GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
+ * @window: the window which received the event
+ * @send_event: %TRUE if the event was sent explicitly (e.g. using
+ * <function>XSendEvent</function>)
+ * @time: the time of the event in milliseconds.
+ * @x: the x coordinate of the pointer relative to the window
+ * @y: the y coordinate of the pointer relative to the window
+ * @axes: @x, @y translated to the axes of @device, or %NULL if @device is
+ * the mouse
+ * @state: (type GdkModifierType): a bit-mask representing the state of
+ * the modifier keys (e.g. Control, Shift and Alt) and the pointer
+ * buttons. See #GdkModifierType
+ * @sequence: the event sequence that the event belongs to
+ * @emulating_pointer: whether the event should be used for emulating
+ * pointer event
+ * @device: the device where the event originated
+ * @x_root: the x coordinate of the pointer relative to the root of the
+ * screen
+ * @y_root: the y coordinate of the pointer relative to the root of the
+ * screen
+ *
+ * Used for touch events.
+ * @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
+ * %GDK_TOUCH_END or %GDK_TOUCH_CANCEL.
+ *
+ * Touch events are grouped into sequences by means of the @sequence
+ * field, which can also be obtained with gdk_event_get_event_sequence().
+ * Each sequence begins with a %GDK_TOUCH_BEGIN event, followed by
+ * any number of %GDK_TOUCH_UPDATE events, and ends with a %GDK_TOUCH_END
+ * (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
+ * several active sequences at the same time.
+ */
+struct _GdkEventTouch
+{
+ GdkEventType type;
+ GdkWindow *window;
+ gint8 send_event;
+ guint32 time;
+ gdouble x;
+ gdouble y;
+ gdouble *axes;
+ guint state;
+ GdkEventSequence *sequence;
+ gboolean emulating_pointer;
+ GdkDevice *device;
+ gdouble x_root, y_root;
+};
+
+/**
* GdkEventScroll:
* @type: the type of the event (%GDK_SCROLL).
* @window: the window which received the event.
@@ -1074,6 +1138,7 @@ union _GdkEvent
GdkEventVisibility visibility;
GdkEventMotion motion;
GdkEventButton button;
+ GdkEventTouch touch;
GdkEventScroll scroll;
GdkEventKey key;
GdkEventCrossing crossing;