mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
virtual-input-device/native: Emit added/removed events
Without these devices, things that depend on the existance of input device classes won't know about the existance of e.g. pointer devices, if the only pointer device is from a virtual one. This requires handling situations where e.g. a device doesn't have a device node thus can't be matched against a udev device. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1688>
This commit is contained in:
parent
5e34ae2154
commit
671bda2509
@ -386,6 +386,9 @@ input_device_get_physical_size (MetaInputMapper *mapper,
|
||||
const char *node;
|
||||
|
||||
node = clutter_input_device_get_device_node (device);
|
||||
if (!node)
|
||||
return FALSE;
|
||||
|
||||
udev_device = g_udev_client_query_by_device_file (mapper->udev_client, node);
|
||||
|
||||
if (udev_device &&
|
||||
|
@ -162,6 +162,7 @@ release_device_in_impl (GTask *task)
|
||||
MetaSeatImpl *seat_impl;
|
||||
int code;
|
||||
uint64_t time_us;
|
||||
ClutterEvent *device_event;
|
||||
|
||||
device_native = META_INPUT_DEVICE_NATIVE (impl_state->device);
|
||||
seat_impl = meta_input_device_native_get_seat_impl (device_native);
|
||||
@ -198,6 +199,10 @@ release_device_in_impl (GTask *task)
|
||||
}
|
||||
}
|
||||
|
||||
device_event = clutter_event_new (CLUTTER_DEVICE_REMOVED);
|
||||
clutter_event_set_device (device_event, impl_state->device);
|
||||
_clutter_event_push (device_event, FALSE);
|
||||
|
||||
g_clear_object (&impl_state->device);
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
||||
@ -1006,6 +1011,7 @@ meta_virtual_input_device_native_constructed (GObject *object)
|
||||
MetaVirtualInputDeviceNative *virtual_evdev =
|
||||
META_VIRTUAL_INPUT_DEVICE_NATIVE (object);
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterEvent *device_event = NULL;
|
||||
|
||||
device_type = clutter_virtual_input_device_get_device_type (virtual_device);
|
||||
|
||||
@ -1018,6 +1024,10 @@ meta_virtual_input_device_native_constructed (GObject *object)
|
||||
meta_input_device_native_new_virtual (virtual_evdev->seat->impl,
|
||||
device_type,
|
||||
CLUTTER_INPUT_MODE_PHYSICAL);
|
||||
|
||||
device_event = clutter_event_new (CLUTTER_DEVICE_ADDED);
|
||||
clutter_event_set_device (device_event, virtual_evdev->impl_state->device);
|
||||
_clutter_event_push (device_event, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user