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))
{
case EVDEV_BUTTON_TYPE_KEY:
clutter_virtual_input_device_notify_key (virtual_device,
time_us,
code,
CLUTTER_KEY_STATE_RELEASED);
meta_seat_native_notify_key (virtual_evdev->seat,
virtual_evdev->device,
time_us,
code,
CLUTTER_KEY_STATE_RELEASED,
TRUE);
break;
case EVDEV_BUTTON_TYPE_BUTTON:
clutter_virtual_input_device_notify_button (virtual_device,
time_us,
code,
CLUTTER_BUTTON_STATE_RELEASED);
meta_seat_native_notify_button (virtual_evdev->seat,
virtual_evdev->device,
time_us,
code,
CLUTTER_BUTTON_STATE_RELEASED);
break;
case EVDEV_BUTTON_TYPE_NONE:
g_assert_not_reached ();
}
update_button_count (virtual_evdev, code, 0);
}
}