[gtk+] Add some more GdkEvent getters
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add some more GdkEvent getters
- Date: Tue, 19 Sep 2017 17:18:26 +0000 (UTC)
commit 7306f559121daaa393c2d5447d9b26c4a11ce03d
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Aug 28 18:47:35 2017 -0400
Add some more GdkEvent getters
gdk/gdkevents.c | 33 +++++++++++++++++++++++++++++++++
gdk/gdkevents.h | 6 ++++--
2 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 72c2cbb..ce5f7c6 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -3061,3 +3061,36 @@ gdk_event_set_selection (GdkEvent *event,
event->selection.selection = selection;
event->selection.time = time;
}
+
+gboolean
+gdk_event_get_axes (GdkEvent *event,
+ gdouble **axes,
+ guint *n_axes)
+{
+ GdkDevice *source_device;
+
+ if (!event)
+ return FALSE;
+
+ source_device = gdk_event_get_source_device (event);
+
+ if (!source_device)
+ return FALSE;
+
+ if (event->type == GDK_MOTION_NOTIFY)
+ {
+ *axes = event->motion.axes;
+ *n_axes = gdk_device_get_n_axes (source_device);
+ return TRUE;
+ }
+ else if (event->type == GDK_BUTTON_PRESS ||
+ event->type == GDK_BUTTON_RELEASE)
+ {
+ *axes = event->button.axes;
+ *n_axes = gdk_device_get_n_axes (source_device);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index fc158f7..320ede6 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -819,8 +819,10 @@ void gdk_event_set_selection (GdkEvent *event,
GdkWindow *window,
GdkAtom selection,
guint32 time);
-
-
+GDK_AVAILABLE_IN_3_92
+gboolean gdk_event_get_axes (GdkEvent *event,
+ gdouble **axes,
+ guint *n_axes);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]