[gtk/fix-cursor-hiding: 5/7] Add private api for synthetic events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-cursor-hiding: 5/7] Add private api for synthetic events
- Date: Thu, 25 Mar 2021 19:27:11 +0000 (UTC)
commit e1fde3e2cd98f96e69f4c288d721078151d5797b
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Mar 25 15:24:18 2021 -0400
Add private api for synthetic events
Add a function to create motion events and mark them
as synthetic.
gdk/gdkevents.c | 25 +++++++++++++++++++++++++
gdk/gdkeventsprivate.h | 16 +++++++++++++++-
2 files changed, 40 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index f7abfe75b5..8bace3909c 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -2894,6 +2894,31 @@ gdk_motion_event_new (GdkSurface *surface,
return (GdkEvent *) self;
}
+GdkEvent *
+gdk_synthetic_motion_event_new (GdkSurface *surface,
+ GdkDevice *device,
+ GdkDeviceTool *tool,
+ guint32 time,
+ GdkModifierType state,
+ double x,
+ double y,
+ double *axes)
+{
+ GdkEvent *event;
+
+ event = gdk_motion_event_new (surface, device, tool, time, state, x, y, axes);
+
+ event->flags |= GDK_EVENT_SYNTHETIC;
+
+ return event;
+}
+
+gboolean
+gdk_motion_event_is_synthetic (GdkEvent *event)
+{
+ return (event->flags & GDK_EVENT_SYNTHETIC) != 0;
+}
+
/**
* gdk_event_get_history:
* @event: a motion or scroll event
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index aca69d551f..0002caf0e9 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -446,6 +446,15 @@ GdkEvent * gdk_motion_event_new (GdkSurface *surface,
double y,
double *axes);
+GdkEvent * gdk_synthetic_motion_event_new (GdkSurface *surface,
+ GdkDevice *device,
+ GdkDeviceTool *tool,
+ guint32 time,
+ GdkModifierType state,
+ double x,
+ double y,
+ double *axes);
+
GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
@@ -576,6 +585,8 @@ GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkTranslatedKey * gdk_key_event_get_translated_key (GdkEvent *event,
gboolean no_lock);
+gboolean gdk_motion_event_is_synthetic (GdkEvent *event);
+
typedef enum
{
/* Following flag is set for events on the event queue during
@@ -587,7 +598,10 @@ typedef enum
* mark all events in the queue with this flag, and deliver
* only those events until we finish the frame.
*/
- GDK_EVENT_FLUSHED = 1 << 2
+ GDK_EVENT_FLUSHED = 1 << 1,
+
+ /* Used for synthetic motion events. */
+ GDK_EVENT_SYNTHETIC = 1 << 2,
} GdkEventFlags;
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]