mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
clutter/x11: Set device node information in XI2 devices
This commit is contained in:
parent
1496a7ead3
commit
af8b938f92
@ -321,6 +321,42 @@ get_device_ids (ClutterBackendX11 *backend_x11,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
get_device_node_path (ClutterBackendX11 *backend_x11,
|
||||||
|
XIDeviceInfo *info)
|
||||||
|
{
|
||||||
|
gulong nitems, bytes_after;
|
||||||
|
guchar *data;
|
||||||
|
int rc, format;
|
||||||
|
Atom prop, type;
|
||||||
|
gchar *node_path;
|
||||||
|
|
||||||
|
prop = XInternAtom (backend_x11->xdpy, "Device Node", False);
|
||||||
|
if (prop == None)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
clutter_x11_trap_x_errors ();
|
||||||
|
|
||||||
|
rc = XIGetProperty (backend_x11->xdpy,
|
||||||
|
info->deviceid, prop, 0, 1024, False,
|
||||||
|
XA_STRING, &type, &format, &nitems, &bytes_after,
|
||||||
|
(guchar **) &data);
|
||||||
|
|
||||||
|
if (clutter_x11_untrap_x_errors ())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (rc != Success || type != XA_STRING || format != 8)
|
||||||
|
{
|
||||||
|
XFree (data);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
node_path = g_strdup ((char *) data);
|
||||||
|
XFree (data);
|
||||||
|
|
||||||
|
return node_path;
|
||||||
|
}
|
||||||
|
|
||||||
static ClutterInputDevice *
|
static ClutterInputDevice *
|
||||||
create_device (ClutterDeviceManagerXI2 *manager_xi2,
|
create_device (ClutterDeviceManagerXI2 *manager_xi2,
|
||||||
ClutterBackendX11 *backend_x11,
|
ClutterBackendX11 *backend_x11,
|
||||||
@ -331,7 +367,7 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
|
|||||||
ClutterInputMode mode;
|
ClutterInputMode mode;
|
||||||
gboolean is_enabled;
|
gboolean is_enabled;
|
||||||
guint num_touches = 0;
|
guint num_touches = 0;
|
||||||
gchar *vendor_id = NULL, *product_id = NULL;
|
gchar *vendor_id = NULL, *product_id = NULL, *node_path = NULL;
|
||||||
|
|
||||||
if (info->use == XIMasterKeyboard || info->use == XISlaveKeyboard)
|
if (info->use == XIMasterKeyboard || info->use == XISlaveKeyboard)
|
||||||
{
|
{
|
||||||
@ -391,7 +427,10 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
|
|||||||
|
|
||||||
if (info->use != XIMasterKeyboard &&
|
if (info->use != XIMasterKeyboard &&
|
||||||
info->use != XIMasterPointer)
|
info->use != XIMasterPointer)
|
||||||
|
{
|
||||||
get_device_ids (backend_x11, info, &vendor_id, &product_id);
|
get_device_ids (backend_x11, info, &vendor_id, &product_id);
|
||||||
|
node_path = get_device_node_path (backend_x11, info);
|
||||||
|
}
|
||||||
|
|
||||||
retval = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_XI2,
|
retval = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_XI2,
|
||||||
"name", info->name,
|
"name", info->name,
|
||||||
@ -404,6 +443,7 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
|
|||||||
"enabled", is_enabled,
|
"enabled", is_enabled,
|
||||||
"vendor-id", vendor_id,
|
"vendor-id", vendor_id,
|
||||||
"product-id", product_id,
|
"product-id", product_id,
|
||||||
|
"device-node", node_path,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
translate_device_classes (backend_x11->xdpy, retval,
|
translate_device_classes (backend_x11->xdpy, retval,
|
||||||
|
Loading…
Reference in New Issue
Block a user