[mutter/wip/tablet-protocol-v2: 105/149] clutter: Add ClutterInputDeviceTool:id property
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/tablet-protocol-v2: 105/149] clutter: Add ClutterInputDeviceTool:id property
- Date: Wed, 20 Jul 2016 17:42:19 +0000 (UTC)
commit be9997c7179ec70ceeb9bffda7807e053e82e13d
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu May 12 17:53:36 2016 +0200
clutter: Add ClutterInputDeviceTool:id property
clutter/clutter/clutter-input-device-tool.c | 37 ++++++++++++++++++++++++++-
clutter/clutter/clutter-input-device-tool.h | 5 +++-
2 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/clutter-input-device-tool.c b/clutter/clutter/clutter-input-device-tool.c
index 11c72ad..0835ddf 100644
--- a/clutter/clutter/clutter-input-device-tool.c
+++ b/clutter/clutter/clutter-input-device-tool.c
@@ -34,12 +34,14 @@ struct _ClutterInputDeviceToolPrivate
{
ClutterInputDeviceToolType type;
guint64 serial;
+ guint64 id;
};
enum {
PROP_0,
PROP_TYPE,
PROP_SERIAL,
+ PROP_ID,
PROP_LAST
};
@@ -66,6 +68,9 @@ clutter_input_device_tool_set_property (GObject *object,
case PROP_SERIAL:
priv->serial = g_value_get_uint64 (value);
break;
+ case PROP_ID:
+ priv->id = g_value_get_uint64 (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -90,6 +95,9 @@ clutter_input_device_tool_get_property (GObject *object,
case PROP_SERIAL:
g_value_set_uint64 (value, priv->serial);
break;
+ case PROP_ID:
+ g_value_set_uint64 (value, priv->id);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -116,6 +124,12 @@ clutter_input_device_tool_class_init (ClutterInputDeviceToolClass *klass)
P_("Tool serial"),
0, G_MAXUINT64, 0,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+ props[PROP_ID] =
+ g_param_spec_uint64 ("id",
+ P_("Tool ID"),
+ P_("Tool ID"),
+ 0, G_MAXUINT64, 0,
+ CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (gobject_class, PROP_LAST, props);
}
@@ -136,7 +150,7 @@ clutter_input_device_tool_init (ClutterInputDeviceTool *tool)
*
* Since: 1.28
**/
-guint
+guint64
clutter_input_device_tool_get_serial (ClutterInputDeviceTool *tool)
{
ClutterInputDeviceToolPrivate *priv;
@@ -170,3 +184,24 @@ clutter_input_device_tool_get_tool_type (ClutterInputDeviceTool *tool)
return priv->type;
}
+
+/**
+ * clutter_input_device_tool_get_id:
+ * @tool: a #ClutterInputDeviceTool
+ *
+ * Gets the ID of this tool, this value can be used to identify a
+ * physical tool (eg. a tablet pen) across program executions.
+ *
+ * Returns: The tool ID for this tool
+ **/
+guint64
+clutter_input_device_tool_get_id (ClutterInputDeviceTool *tool)
+{
+ ClutterInputDeviceToolPrivate *priv;
+
+ g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL (tool), 0);
+
+ priv = clutter_input_device_tool_get_instance_private (tool);
+
+ return priv->id;
+}
diff --git a/clutter/clutter/clutter-input-device-tool.h b/clutter/clutter/clutter-input-device-tool.h
index 8795d05..0b7beef 100644
--- a/clutter/clutter/clutter-input-device-tool.h
+++ b/clutter/clutter/clutter-input-device-tool.h
@@ -56,11 +56,14 @@ CLUTTER_AVAILABLE_IN_ALL
GType clutter_input_device_tool_get_type (void) G_GNUC_CONST;
CLUTTER_AVAILABLE_IN_ALL
-guint clutter_input_device_tool_get_serial (ClutterInputDeviceTool *tool);
+guint64 clutter_input_device_tool_get_serial (ClutterInputDeviceTool *tool);
CLUTTER_AVAILABLE_IN_ALL
ClutterInputDeviceToolType clutter_input_device_tool_get_tool_type (ClutterInputDeviceTool *tool);
+CLUTTER_AVAILABLE_IN_ALL
+guint64 clutter_input_device_tool_get_id (ClutterInputDeviceTool *tool);
+
G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_TOOL_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]