[gtk+/xi21: 6/12] Add gdk_event_get_touch_id()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/xi21: 6/12] Add gdk_event_get_touch_id()
- Date: Sat, 12 Mar 2011 14:35:01 +0000 (UTC)
commit 93162f080d21208c978681698d233842612632cc
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 | 2 +
gdk/gdk.symbols | 1 +
gdk/gdkevents.c | 39 ++++++++++++++++++++++++++++++++++
gdk/gdkevents.h | 3 ++
4 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 2b41204..a2b5fc0 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -766,10 +766,12 @@ gdk_event_get_state
gdk_event_get_axis
gdk_event_get_coords
gdk_event_get_root_coords
+gdk_event_get_touch_id
gdk_event_request_motions
gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
+gdk_event_get_touch_id
<SUBSECTION>
gdk_event_handler_set
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index b159b1c..b4478e0 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -163,6 +163,7 @@ gdk_event_get_screen
gdk_event_get_source_device
gdk_event_get_state
gdk_event_get_time
+gdk_event_get_touch_id
gdk_event_get_type G_GNUC_CONST
gdk_event_handler_set
gdk_event_mask_get_type G_GNUC_CONST
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 9067e25..53c83a5 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -1483,6 +1483,45 @@ 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.
+ **/
+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 15a1322..d03e4f0 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -1098,6 +1098,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]