x11: Fill out the :name property of the InputDevices

For the core pointer and keyboard we assign the names ourselves; for
devices coming from XI we can use the XDeviceInfo.name member.
This commit is contained in:
Emmanuele Bassi 2010-01-15 11:38:58 +00:00
parent cf4e05930a
commit 66740e8000
2 changed files with 10 additions and 4 deletions

View File

@ -174,6 +174,7 @@ clutter_x11_register_input_devices (ClutterBackendX11 *backend)
device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11, device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11,
"id", info->id, "id", info->id,
"device-type", device_type, "device-type", device_type,
"name", info->name,
NULL); NULL);
n_events = _clutter_input_device_x11_construct (device, backend); n_events = _clutter_input_device_x11_construct (device, backend);
@ -226,7 +227,7 @@ default_device:
* - we do not have the XInput extension * - we do not have the XInput extension
* - we do not have a XInput pointer device * - we do not have a XInput pointer device
* *
* we register two default devices, one for the pointer * we register two default core devices, one for the pointer
* and one for the keyboard * and one for the keyboard
*/ */
if (!have_an_xpointer) if (!have_an_xpointer)
@ -235,6 +236,7 @@ default_device:
d = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11, d = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11,
"id", 0, "id", 0,
"name", "Core Pointer",
"device-type", CLUTTER_POINTER_DEVICE, "device-type", CLUTTER_POINTER_DEVICE,
"is-core", TRUE, "is-core", TRUE,
NULL); NULL);
@ -245,6 +247,7 @@ default_device:
d = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11, d = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_X11,
"id", 1, "id", 1,
"name", "Core Keyboard",
"device-type", CLUTTER_KEYBOARD_DEVICE, "device-type", CLUTTER_KEYBOARD_DEVICE,
"is-core", TRUE, "is-core", TRUE,
NULL); NULL);

View File

@ -810,8 +810,9 @@ event_translate (ClutterBackend *backend,
device = _clutter_x11_get_device_for_xid (xbev->deviceid); device = _clutter_x11_get_device_for_xid (xbev->deviceid);
CLUTTER_NOTE (EVENT, CLUTTER_NOTE (EVENT,
"XINPUT Button press event for %li at %d, %d", "XI ButtonPress for %li ('%s') at %d, %d",
xbev->deviceid, xbev->deviceid,
device->device_name,
xbev->x, xbev->x,
xbev->y); xbev->y);
@ -858,8 +859,9 @@ event_translate (ClutterBackend *backend,
device = _clutter_x11_get_device_for_xid (xbev->deviceid); device = _clutter_x11_get_device_for_xid (xbev->deviceid);
CLUTTER_NOTE (EVENT, "XINPUT Button release event for %li at %d, %d", CLUTTER_NOTE (EVENT, "XI ButtonRelease for %li ('%s') at %d, %d",
xbev->deviceid, xbev->deviceid,
device->device_name,
xbev->x, xbev->x,
xbev->y); xbev->y);
@ -886,8 +888,9 @@ event_translate (ClutterBackend *backend,
device = _clutter_x11_get_device_for_xid (xmev->deviceid); device = _clutter_x11_get_device_for_xid (xmev->deviceid);
CLUTTER_NOTE(EVENT, "XINPUT Motion event for %li at %d, %d", CLUTTER_NOTE(EVENT, "XI Motion for %li ('%s') at %d, %d",
xmev->deviceid, xmev->deviceid,
device->device_name,
xmev->x, xmev->x,
xmev->y); xmev->y);