[gtk+/touch-for-3.4: 38/65] Add gdk_event_get_touch_id()
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/touch-for-3.4: 38/65] Add gdk_event_get_touch_id()
- Date: Fri, 24 Feb 2012 15:28:02 +0000 (UTC)
commit 48c70d1a1df3a261e879eca950d655a9bb227ead
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Mar 1 08:36:54 2011 +0100
Add gdk_event_get_touch_id()
Just a helper function to get the touch ID from touch events, it
returns FALSE in any other case.
docs/reference/gdk/gdk3-sections.txt | 1 +
gdk/gdk.symbols | 1 +
gdk/gdkevents.c | 41 ++++++++++++++++++++++++++++++++++
gdk/gdkevents.h | 3 ++
4 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 9756518..d3be0e5 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -782,6 +782,7 @@ gdk_event_get_root_coords
gdk_event_get_scroll_direction
gdk_event_get_state
gdk_event_get_time
+gdk_event_get_touch_id
gdk_event_request_motions
gdk_events_get_angle
gdk_events_get_center
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index 219153d..db9f420 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -168,6 +168,7 @@ gdk_event_get_scroll_direction
gdk_event_get_source_device
gdk_event_get_state
gdk_event_get_time
+gdk_event_get_touch_id
gdk_event_get_type
gdk_event_handler_set
gdk_event_mask_get_type
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 6aeedfd..74cc4fa 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -1723,6 +1723,47 @@ gdk_event_get_screen (const GdkEvent *event)
}
/**
+ * gdk_event_get_touch_id:
+ * @event: a #GdkEvent
+ * @touch_id: return location of the touch ID of a touch event
+ *
+ * If @event if of type %GDK_TOUCH_MOTION, %GDK_TOUCH_PRESS or
+ * %GDK_TOUCH_RELEASE, fills in @touch_id and returns %TRUE,
+ * else it returns %FALSE.
+ *
+ * Returns: %TRUE if the touch ID can be extracted from @event.
+ *
+ * Since: 3.4
+ */
+gboolean
+gdk_event_get_touch_id (const GdkEvent *event,
+ guint *touch_id)
+{
+ if (!event)
+ return FALSE;
+
+ if (event->type == GDK_TOUCH_MOTION)
+ {
+ if (touch_id)
+ *touch_id = event->motion.touch_id;
+ return TRUE;
+ }
+ else if (event->type == GDK_TOUCH_PRESS ||
+ event->type == GDK_TOUCH_RELEASE)
+ {
+ if (touch_id)
+ *touch_id = event->button.touch_id;
+ return TRUE;
+ }
+ else
+ {
+ if (touch_id)
+ *touch_id = 0;
+ return FALSE;
+ }
+}
+
+/**
* gdk_set_show_events:
* @show_events: %TRUE to output event debugging information.
*
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index da5d282..496ba0f 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -1185,6 +1185,9 @@ void gdk_event_set_screen (GdkEvent *event,
GdkScreen *screen);
GdkScreen *gdk_event_get_screen (const GdkEvent *event);
+gboolean gdk_event_get_touch_id (const GdkEvent *event,
+ guint *touch_id);
+
void gdk_set_show_events (gboolean show_events);
gboolean gdk_get_show_events (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]