[gtk+/overlay-heuristics: 1/8] GdkDevice: Add a last-used timestamp
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/overlay-heuristics: 1/8] GdkDevice: Add a last-used timestamp
- Date: Fri, 28 Nov 2014 19:29:47 +0000 (UTC)
commit e83b9342725a91c8f71b52795c5efe3422d1dc48
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Nov 28 12:26:05 2014 -0500
GdkDevice: Add a last-used timestamp
This will be used in determining whether to treat the system as
touch or not.
gdk/gdkdevice.c | 27 +++++++++++++++++++++++++++
gdk/gdkdevice.h | 3 +++
gdk/gdkdeviceprivate.h | 4 ++++
3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index ebef53b..51c9172 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1757,3 +1757,30 @@ gdk_device_get_last_event_window (GdkDevice *device)
return info->window_under_pointer;
}
+
+/**
+ * gdk_device_get_time:
+ * @device: a #GdkDevice
+ *
+ * Returns the timestamp of the last event involving this device that GDK has
+ * received.
+ *
+ * Returns: the timestamp of the last event for this device
+ *
+ * Since: 3.16
+ */
+guint32
+gdk_device_get_time (GdkDevice *device)
+{
+ g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
+
+ return device->time;
+}
+
+void
+_gdk_device_set_time (GdkDevice *device,
+ guint32 time)
+{
+ if (time > device->time)
+ device->time = time;
+}
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index 7e1094e..8e238ed 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -274,6 +274,9 @@ gboolean gdk_device_grab_info_libgtk_only (GdkDisplay *display,
GDK_AVAILABLE_IN_3_12
GdkWindow *gdk_device_get_last_event_window (GdkDevice *device);
+GDK_AVAILABLE_IN_3_16
+guint32 gdk_device_get_time (GdkDevice *device);
+
G_END_DECLS
#endif /* __GDK_DEVICE_H__ */
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index a8526b5..53a9cbb 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -56,6 +56,7 @@ struct _GdkDevice
GList *slaves;
GdkDeviceType type;
GArray *axes;
+ guint32 time;
};
struct _GdkDeviceClass
@@ -173,6 +174,9 @@ GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
GdkModifierType *mask,
gboolean get_toplevel);
+void _gdk_device_set_time (GdkDevice *device,
+ guint32 time);
+
G_END_DECLS
#endif /* __GDK_DEVICE_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]