backends/x11: Drop handling of XI_DeviceChange

Even though it's great that XI2 has an event to notify about device
changes, this is something we can let the MetaBackend code handle
consistently for all backends, since looking for the source device
works everywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
This commit is contained in:
Carlos Garnacho 2022-01-13 14:06:30 +01:00 committed by Marge Bot
parent 4e85e0e1b3
commit d72bacb3cd

View File

@ -249,30 +249,6 @@ translate_crossing_event (MetaBackendX11 *x11,
meta_backend_x11_translate_crossing_event (x11, enter_event); meta_backend_x11_translate_crossing_event (x11, enter_event);
} }
static void
handle_device_change (MetaBackendX11 *x11,
XIEvent *event)
{
XIDeviceChangedEvent *device_changed;
ClutterInputDevice *device;
ClutterBackend *backend;
ClutterSeat *seat;
if (event->evtype != XI_DeviceChanged)
return;
device_changed = (XIDeviceChangedEvent *) event;
if (device_changed->reason != XISlaveSwitch)
return;
backend = meta_backend_get_clutter_backend (META_BACKEND (x11));
seat = clutter_backend_get_default_seat (backend);
device = meta_seat_x11_lookup_device_id (META_SEAT_X11 (seat),
device_changed->sourceid);
meta_backend_update_last_device (META_BACKEND (x11), device);
}
/* Clutter makes the assumption that there is only one X window /* Clutter makes the assumption that there is only one X window
* per stage, which is a valid assumption to make for a generic * per stage, which is a valid assumption to make for a generic
* application toolkit. As such, it will ignore any events sent * application toolkit. As such, it will ignore any events sent
@ -321,9 +297,6 @@ handle_input_event (MetaBackendX11 *x11,
{ {
XIEvent *input_event = (XIEvent *) event->xcookie.data; XIEvent *input_event = (XIEvent *) event->xcookie.data;
if (input_event->evtype == XI_DeviceChanged)
handle_device_change (x11, input_event);
else
maybe_spoof_event_as_stage_event (x11, input_event); maybe_spoof_event_as_stage_event (x11, input_event);
} }
} }