clutter: Add clutter_input_device_get_device_node()

This function is meant to return the device node path (eg. /dev/input/...),
which will be useful to wire up a few things.
This commit is contained in:
Carlos Garnacho 2016-05-13 13:17:00 +02:00
parent 59be5bf3b1
commit 95181bdbaa
3 changed files with 28 additions and 0 deletions

View File

@ -131,6 +131,7 @@ struct _ClutterInputDevice
gchar *vendor_id; gchar *vendor_id;
gchar *product_id; gchar *product_id;
gchar *node_path;
GPtrArray *tools; GPtrArray *tools;

View File

@ -73,6 +73,7 @@ enum
PROP_N_STRIPS, PROP_N_STRIPS,
PROP_N_RINGS, PROP_N_RINGS,
PROP_N_MODE_GROUPS, PROP_N_MODE_GROUPS,
PROP_DEVICE_NODE,
PROP_LAST PROP_LAST
}; };
@ -211,6 +212,10 @@ clutter_input_device_set_property (GObject *gobject,
self->n_mode_groups = g_value_get_int (value); self->n_mode_groups = g_value_get_int (value);
break; break;
case PROP_DEVICE_NODE:
self->node_path = g_value_dup_string (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break; break;
@ -283,6 +288,10 @@ clutter_input_device_get_property (GObject *gobject,
g_value_set_int (value, self->n_mode_groups); g_value_set_int (value, self->n_mode_groups);
break; break;
case PROP_DEVICE_NODE:
g_value_set_string (value, self->node_path);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break; break;
@ -481,6 +490,13 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
0, G_MAXINT, 0, 0, G_MAXINT, 0,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
obj_props[PROP_DEVICE_NODE] =
g_param_spec_string ("device-node",
P_("Device node path"),
P_("Device node path"),
NULL,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
gobject_class->dispose = clutter_input_device_dispose; gobject_class->dispose = clutter_input_device_dispose;
gobject_class->set_property = clutter_input_device_set_property; gobject_class->set_property = clutter_input_device_set_property;
gobject_class->get_property = clutter_input_device_get_property; gobject_class->get_property = clutter_input_device_get_property;
@ -2141,3 +2157,11 @@ clutter_input_device_get_n_mode_groups (ClutterInputDevice *device)
return device->n_mode_groups; return device->n_mode_groups;
} }
const gchar *
clutter_input_device_get_device_node (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
return device->node_path;
}

View File

@ -147,6 +147,9 @@ gint clutter_input_device_get_n_strips (ClutterInputDev
CLUTTER_AVAILABLE_IN_ALL CLUTTER_AVAILABLE_IN_ALL
gint clutter_input_device_get_n_mode_groups (ClutterInputDevice *device); gint clutter_input_device_get_n_mode_groups (ClutterInputDevice *device);
CLUTTER_AVAILABLE_IN_ALL
const gchar * clutter_input_device_get_device_node (ClutterInputDevice *device);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_H__ */ #endif /* __CLUTTER_INPUT_DEVICE_H__ */