backends/native/seat-impl: Translate touch coords before storing

For the coordinates of pointers or stylii, we translate the ones we store
using the viewport matrix already. For touch events otoh, we store coords
untranslated and translate them later only for event emission.

Let's be consistent here and store the coordinates of touch events
translated, just like we do for pointer events.

This fixes touch window dragging on rotated monitors. MetaWindowDrag calls
clutter_seat_query_state(), which uses those stored coordinates. So in case
of a touch sequence the coords returned by query_state() would be
untranslated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2859>
This commit is contained in:
Jonas Dreßler 2023-02-19 18:19:51 +01:00 committed by Marge Bot
parent 65b93e1d45
commit d6062baef3

View File

@ -991,10 +991,6 @@ meta_seat_impl_notify_touch_event_in_impl (MetaSeatImpl *seat_impl,
event->touch.time = us2ms (time_us);
event->touch.x = x;
event->touch.y = y;
meta_input_device_native_translate_coordinates_in_impl (input_device,
seat_impl->viewports,
&event->touch.x,
&event->touch.y);
/* "NULL" sequences are special cased in clutter */
event->touch.sequence = GINT_TO_POINTER (MAX (1, slot + 1));
@ -2282,6 +2278,10 @@ process_device_event (MetaSeatImpl *seat_impl,
touch_state = meta_seat_impl_acquire_touch_state_in_impl (seat_impl, seat_slot);
touch_state->coords.x = x;
touch_state->coords.y = y;
meta_input_device_native_translate_coordinates_in_impl (device,
seat_impl->viewports,
&touch_state->coords.x,
&touch_state->coords.y);
g_rw_lock_writer_unlock (&seat_impl->state_lock);
@ -2352,6 +2352,10 @@ process_device_event (MetaSeatImpl *seat_impl,
{
touch_state->coords.x = x;
touch_state->coords.y = y;
meta_input_device_native_translate_coordinates_in_impl (device,
seat_impl->viewports,
&touch_state->coords.x,
&touch_state->coords.y);
}
g_rw_lock_writer_unlock (&seat_impl->state_lock);