backends: Make device tracking at MetaInputSettings ad-hoc API

Depending on the backend, we want to integrate this object at different
levels. It will sit close to the MetaBackendX11/MetaSeatX11 in X11, but
it will be put deep down with MetaSeatImpl in the native backend, in a
separate thread.

Since we can't depend on a single object type, nor are able to track
ClutterSeat signals neatly, make this API something to be called
explicitly by backends.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
Carlos Garnacho
2020-08-11 16:27:35 +02:00
committed by Marge Bot
parent fe9092da19
commit 2c1558ddbd
6 changed files with 55 additions and 47 deletions

View File

@ -1551,6 +1551,9 @@ process_base_event (MetaSeatImpl *seat_impl,
ClutterInputDevice *device;
ClutterEvent *device_event = NULL;
struct libinput_device *libinput_device;
MetaInputSettings *input_settings;
input_settings = meta_backend_get_input_settings (meta_get_backend ());
switch (libinput_event_get_type (event))
{
@ -1560,6 +1563,7 @@ process_base_event (MetaSeatImpl *seat_impl,
device = evdev_add_device (seat_impl, libinput_device);
device_event = clutter_event_new (CLUTTER_DEVICE_ADDED);
clutter_event_set_device (device_event, device);
meta_input_settings_add_device (input_settings, device);
break;
case LIBINPUT_EVENT_DEVICE_REMOVED:
@ -1570,6 +1574,7 @@ process_base_event (MetaSeatImpl *seat_impl,
clutter_event_set_device (device_event, device);
evdev_remove_device (seat_impl,
META_INPUT_DEVICE_NATIVE (device));
meta_input_settings_remove_device (input_settings, device);
break;
default:
@ -1634,9 +1639,9 @@ input_device_update_tool (ClutterInputDevice *input_device,
struct libinput_tablet_tool *libinput_tool)
{
MetaInputDeviceNative *evdev_device = META_INPUT_DEVICE_NATIVE (input_device);
MetaSeatImpl *seat_impl = seat_impl_from_device (input_device);
ClutterInputDeviceTool *tool = NULL;
ClutterInputDeviceToolType tool_type;
MetaInputSettings *input_settings;
uint64_t tool_serial;
if (libinput_tool)
@ -1660,8 +1665,8 @@ input_device_update_tool (ClutterInputDevice *input_device,
clutter_input_device_update_from_tool (input_device, tool);
evdev_device->last_tool = tool;
g_signal_emit_by_name (seat_impl->seat_native, "tool-changed",
input_device, tool);
input_settings = meta_backend_get_input_settings (meta_get_backend ());
meta_input_settings_notify_tool_change (input_settings, input_device, tool);
}
}
@ -3075,6 +3080,11 @@ meta_seat_impl_notify_kbd_a11y_flags_changed (MetaSeatImpl *seat_impl,
MetaKeyboardA11yFlags new_flags,
MetaKeyboardA11yFlags what_changed)
{
MetaInputSettings *input_settings;
input_settings = meta_backend_get_input_settings (meta_get_backend ());
meta_input_settings_notify_kbd_a11y_change (input_settings,
new_flags, what_changed);
g_signal_emit (seat_impl, signals[KBD_A11Y_FLAGS_CHANGED], 0,
new_flags, what_changed);
}