From d6062baef3f4563a0783fa0183db71a86a8fa78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Sun, 19 Feb 2023 18:19:51 +0100 Subject: [PATCH] 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: --- src/backends/native/meta-seat-impl.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index a394e6b9f..3f0fe4226 100644 --- a/src/backends/native/meta-seat-impl.c +++ b/src/backends/native/meta-seat-impl.c @@ -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);