backend: Don't emit last-device updates with no device

When removing a device that has been just marked as the last in use, we may
try to notify that a NULL device is the last one.

This is not supported, as both update_last_device() and the clients of the
"::last-device-changed" signal are assuming that the last device is always
a valid ClutterInputDevice.

So let's avoid erroring, and stop the idle when clearing the current device.

Related to: https://gitlab.gnome.org/GNOME/mutter/-/issues/1345
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
This commit is contained in:
Marco Trevisan (Treviño) 2020-07-15 00:49:08 +02:00 committed by Robert Mader
parent 285f2a2124
commit 0756826753

View File

@ -438,6 +438,7 @@ on_device_removed (ClutterSeat *seat,
ClutterInputDeviceType device_type; ClutterInputDeviceType device_type;
priv->current_device = NULL; priv->current_device = NULL;
g_clear_handle_id (&priv->device_update_idle_id, g_source_remove);
device_type = clutter_input_device_get_device_type (device); device_type = clutter_input_device_get_device_type (device);
has_touchscreen = check_has_slave_touchscreen (seat); has_touchscreen = check_has_slave_touchscreen (seat);