virtual-input-device/native: Emit discrete scroll when the source is a wheel

Previously, when scroll was received in a remote session, it was handled
as continuous scroll.

This generated issues with clients without high-resolution scroll
support as the code path in charge of accumulating scroll until 120 is
reached was not used and therefore discrete scroll events were not being
generated.

Handle scroll generated in a remote session as discrete scroll when the
source is CLUTTER_SCROLL_SOURCE_WHEEL to fix this issue.

Fix https://gitlab.gnome.org/GNOME/mutter/-/issues/2473

Fixes: 9dd6268d13 ("wayland/pointer: Send high-resolution scroll data")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2664>
This commit is contained in:
José Expósito 2022-10-16 18:33:37 +02:00 committed by Marge Bot
parent 87e1d72cd4
commit 92a90774a4

View File

@ -743,12 +743,25 @@ notify_scroll_continuous_in_impl (GTask *task)
if (event->time_us == CLUTTER_CURRENT_TIME)
event->time_us = g_get_monotonic_time ();
meta_seat_impl_notify_scroll_continuous_in_impl (seat,
virtual_evdev->impl_state->device,
event->time_us,
event->dx, event->dy,
event->scroll_source,
CLUTTER_SCROLL_FINISHED_NONE);
if (event->scroll_source == CLUTTER_SCROLL_SOURCE_WHEEL)
{
meta_seat_impl_notify_discrete_scroll_in_impl (seat,
virtual_evdev->impl_state->device,
event->time_us,
event->dx * (120.0 / 10.0),
event->dy * (120.0 / 10.0),
event->scroll_source);
}
else
{
meta_seat_impl_notify_scroll_continuous_in_impl (seat,
virtual_evdev->impl_state->device,
event->time_us,
event->dx, event->dy,
event->scroll_source,
CLUTTER_SCROLL_FINISHED_NONE);
}
g_task_return_boolean (task, TRUE);
return G_SOURCE_REMOVE;
}