[gtk+] gdkdevice: Expose tool as property
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdkdevice: Expose tool as property
- Date: Mon, 11 Apr 2016 16:08:33 +0000 (UTC)
commit 6e47dad33d673e1360cdb55b50cb38b91e43b36d
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Apr 11 11:57:46 2016 -0400
gdkdevice: Expose tool as property
This may occasionally be useful.
gdk/gdkdevice.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 75c6cd2..29c8c8e 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -95,6 +95,7 @@ enum {
PROP_SEAT,
PROP_NUM_TOUCHES,
PROP_AXES,
+ PROP_TOOL,
LAST_PROP
};
@@ -322,6 +323,13 @@ gdk_device_class_init (GdkDeviceClass *klass)
GDK_TYPE_AXIS_FLAGS, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ device_props[PROP_TOOL] =
+ g_param_spec_object ("tool",
+ P_("Tool"),
+ P_("The tool that is currently used with this device"),
+ GDK_TYPE_DEVICE_TOOL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
g_object_class_install_properties (object_class, LAST_PROP, device_props);
/**
@@ -516,6 +524,9 @@ gdk_device_get_property (GObject *object,
case PROP_AXES:
g_value_set_flags (value, device->axis_flags);
break;
+ case PROP_TOOL:
+ g_value_set_object (value, device->last_tool);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2034,5 +2045,8 @@ gdk_device_update_tool (GdkDevice *device,
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER);
if (g_set_object (&device->last_tool, tool))
- g_signal_emit (device, signals[TOOL_CHANGED], 0, tool);
+ {
+ g_object_notify (G_OBJECT (device), "tool");
+ g_signal_emit (device, signals[TOOL_CHANGED], 0, tool);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]