[gtk+/touch-for-3.4-2: 6/44] gdk: Add internal API to set "pointer emulated" flag on events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/touch-for-3.4-2: 6/44] gdk: Add internal API to set "pointer emulated" flag on events
- Date: Thu, 1 Mar 2012 20:26:41 +0000 (UTC)
commit 5b01c7e691c261b29936a94125d3920a77f11fca
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Dec 28 01:37:01 2011 +0100
gdk: Add internal API to set "pointer emulated" flag on events
This flag will be used for non-pointer events that are emulated
from eg. touch events, or pointer events being emulated.
gdk/gdkevents.c | 26 +++++++++++++++++++++++++-
gdk/gdkinternals.h | 12 +++++++++++-
2 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 778ae3a..295a63e 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -485,7 +485,31 @@ gdk_event_is_allocated (const GdkEvent *event)
return FALSE;
}
-
+
+void
+_gdk_event_set_pointer_emulated (GdkEvent *event,
+ gboolean emulated)
+{
+ if (gdk_event_is_allocated (event))
+ {
+ GdkEventPrivate *private = (GdkEventPrivate *) event;
+
+ if (emulated)
+ private->flags |= GDK_EVENT_POINTER_EMULATED;
+ else
+ private->flags &= ~(GDK_EVENT_POINTER_EMULATED);
+ }
+}
+
+gboolean
+_gdk_event_get_pointer_emulated (GdkEvent *event)
+{
+ if (gdk_event_is_allocated (event))
+ return (((GdkEventPrivate *) event)->flags & GDK_EVENT_POINTER_EMULATED) != 0;
+
+ return FALSE;
+}
+
/**
* gdk_event_copy:
* @event: a #GdkEvent
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 099a681..1a4466f 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -148,7 +148,13 @@ typedef enum
/* Following flag is set for events on the event queue during
* translation and cleared afterwards.
*/
- GDK_EVENT_PENDING = 1 << 0
+ GDK_EVENT_PENDING = 1 << 0,
+
+ /* The following flag is set for:
+ * 1) touch events emulating pointer events
+ * 2) pointer events being emulated by a touch sequence.
+ */
+ GDK_EVENT_POINTER_EMULATED = 1 << 1
} GdkEventFlags;
struct _GdkEventPrivate
@@ -273,6 +279,10 @@ GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
void _gdk_event_filter_unref (GdkWindow *window,
GdkEventFilter *filter);
+void _gdk_event_set_pointer_emulated (GdkEvent *event,
+ gboolean emulated);
+gboolean _gdk_event_get_pointer_emulated (GdkEvent *event);
+
void _gdk_event_emit (GdkEvent *event);
GList* _gdk_event_queue_find_first (GdkDisplay *display);
void _gdk_event_queue_remove_link (GdkDisplay *display,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]