[mutter] clutter: Add ClutterInputDeviceTool:id property
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter: Add ClutterInputDeviceTool:id property
- Date: Fri, 22 Jul 2016 11:59:52 +0000 (UTC)
commit 2e6bfa8bae7f3beeab8d170d7ade4887a6f48621
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 | 35 +++++++++++++++++++++++++++
clutter/clutter/clutter-input-device-tool.h | 3 ++
2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter/clutter-input-device-tool.c b/clutter/clutter/clutter-input-device-tool.c
index 5169555..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);
}
@@ -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 097dec8..0b7beef 100644
--- a/clutter/clutter/clutter-input-device-tool.h
+++ b/clutter/clutter/clutter-input-device-tool.h
@@ -61,6 +61,9 @@ guint64 clutter_input_device_tool_get_serial (ClutterInput
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]