[gtk+/wip/wayland-tablet-v2: 3/19] gdk: Add a getter for the hardware id of a GdkDeviceTool
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/wayland-tablet-v2: 3/19] gdk: Add a getter for the hardware id of a GdkDeviceTool
- Date: Thu, 4 Aug 2016 17:59:02 +0000 (UTC)
commit efdb7eccb72b97bb6f3fdfdff3885e1b22f1080d
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Aug 4 18:49:13 2016 +0200
gdk: Add a getter for the hardware id of a GdkDeviceTool
Although scarcely used, this information may be useful to retrieve
from the windowing systems that offer this information.
gdk/gdkdevicetool.c | 29 +++++++++++++++++++++++++++++
gdk/gdkdevicetool.h | 3 +++
2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkdevicetool.c b/gdk/gdkdevicetool.c
index 3f07811..3b94ce0 100644
--- a/gdk/gdkdevicetool.c
+++ b/gdk/gdkdevicetool.c
@@ -31,6 +31,7 @@ enum {
TOOL_PROP_SERIAL,
TOOL_PROP_TOOL_TYPE,
TOOL_PROP_AXES,
+ TOOL_PROP_HARDWARE_ID,
N_TOOL_PROPS
};
@@ -55,6 +56,9 @@ gdk_device_tool_set_property (GObject *object,
case TOOL_PROP_AXES:
tool->tool_axes = g_value_get_flags (value);
break;
+ case TOOL_PROP_HARDWARE_ID:
+ tool->hw_id = g_value_get_uint64 (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -80,6 +84,9 @@ gdk_device_tool_get_property (GObject *object,
case TOOL_PROP_AXES:
g_value_set_flags (value, tool->tool_axes);
break;
+ case TOOL_PROP_HARDWARE_ID:
+ g_value_set_uint64 (value, tool->hw_id);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -113,6 +120,12 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
GDK_TYPE_AXIS_FLAGS, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
+ tool_props[TOOL_PROP_HARDWARE_ID] = g_param_spec_uint64 ("hardware-id",
+ "Hardware ID",
+ "Hardware ID",
+ 0, G_MAXUINT64, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, N_TOOL_PROPS, tool_props);
}
@@ -154,6 +167,22 @@ gdk_device_tool_get_serial (GdkDeviceTool *tool)
}
/**
+ * gdk_device_tool_get_hardware_id:
+ * @tool: a #GdkDeviceTool
+ *
+ * Gets the hardware ID of this tool, or 0 if it's not known.
+ *
+ * Since: 3.22
+ **/
+guint64
+gdk_device_tool_get_hardware_id (GdkDeviceTool *tool)
+{
+ g_return_val_if_fail (tool != NULL, 0);
+
+ return tool->hw_id;
+}
+
+/**
* gdk_device_tool_get_tool_type:
* @tool: a #GdkDeviceTool
*
diff --git a/gdk/gdkdevicetool.h b/gdk/gdkdevicetool.h
index 5486e7e..34a3200 100644
--- a/gdk/gdkdevicetool.h
+++ b/gdk/gdkdevicetool.h
@@ -68,6 +68,9 @@ GDK_AVAILABLE_IN_3_22
guint64 gdk_device_tool_get_serial (GdkDeviceTool *tool);
GDK_AVAILABLE_IN_3_22
+guint64 gdk_device_tool_get_hardware_id (GdkDeviceTool *tool);
+
+GDK_AVAILABLE_IN_3_22
GdkDeviceToolType gdk_device_tool_get_tool_type (GdkDeviceTool *tool);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]