backends/native: Unset the correct button codes when a virtual device is destroyed

We were iterating through evcodes, but using API that expects Clutter button
numbers. Instead of transforming those to Clutter numbers to have those translated
back, use the inner seat API that already takes evcodes.

Fixes stuck buttons keys after a virtual device is destroyed while those are
pressed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1239
This commit is contained in:
Carlos Garnacho 2020-05-07 18:20:32 +02:00 committed by Jonas Ådahl
parent 5d58156134
commit e073076119

View File

@ -129,20 +129,25 @@ release_pressed_buttons (ClutterVirtualInputDevice *virtual_device)
switch (get_button_type (code)) switch (get_button_type (code))
{ {
case EVDEV_BUTTON_TYPE_KEY: case EVDEV_BUTTON_TYPE_KEY:
clutter_virtual_input_device_notify_key (virtual_device, meta_seat_native_notify_key (virtual_evdev->seat,
time_us, virtual_evdev->device,
code, time_us,
CLUTTER_KEY_STATE_RELEASED); code,
CLUTTER_KEY_STATE_RELEASED,
TRUE);
break; break;
case EVDEV_BUTTON_TYPE_BUTTON: case EVDEV_BUTTON_TYPE_BUTTON:
clutter_virtual_input_device_notify_button (virtual_device, meta_seat_native_notify_button (virtual_evdev->seat,
time_us, virtual_evdev->device,
code, time_us,
CLUTTER_BUTTON_STATE_RELEASED); code,
CLUTTER_BUTTON_STATE_RELEASED);
break; break;
case EVDEV_BUTTON_TYPE_NONE: case EVDEV_BUTTON_TYPE_NONE:
g_assert_not_reached (); g_assert_not_reached ();
} }
update_button_count (virtual_evdev, code, 0);
} }
} }