summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Dreßler <verdre@v0yd.nl>2021-03-08 15:09:07 +0100
committerMarge Bot <marge-bot@gnome.org>2021-03-08 15:33:36 +0000
commit3263084bcf7f241267dc4dc840b81cc4617bed20 (patch)
tree2bdbbda525912a0de750385b9214742837391ffc
parentec14f51ae3917d4f3d5f16b0c8c69b780f928568 (diff)
downloadmutter-3263084bcf7f241267dc4dc840b81cc4617bed20.tar.gz
backends/native: Translate right coords when creating motion events
With commit 7d7876880998fe7b414bb38f8094af9822020d1b we switched to storing pointer coordinates in MetaInputDeviceNative instead of ClutterInputDevice, and while we had set the coordinates of the ClutterInputDevice in ClutterStage when queueing an event, we now set the MetaInputDeviceNative coordinates in new_absolute_motion_event(). Here a small mistake snuck in: new_absolute_motion_event() only translates the coordinates of the event, but we call meta_input_device_native_set_coords() using the x and y variables (which remain untranslated), so now the input device coordinates are no longer translated. Fix that by translating the coordinates of the x and y variables in case we're we handling a tablet/stylus event instead of only translating the event coordinates. Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1685 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1760>
-rw-r--r--src/backends/native/meta-seat-impl.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c
index 1ffc9e685..71da8f8fa 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -514,6 +514,17 @@ new_absolute_motion_event (MetaSeatImpl *seat_impl,
seat_impl->pointer_y,
&x, &y);
}
+ else
+ {
+ /* This may happen early at startup */
+ if (seat_impl->viewports)
+ {
+ meta_input_device_native_translate_coordinates_in_impl (input_device,
+ seat_impl->viewports,
+ &x,
+ &y);
+ }
+ }
event->motion.time_us = time_us;
event->motion.time = us2ms (time_us);
@@ -521,15 +532,6 @@ new_absolute_motion_event (MetaSeatImpl *seat_impl,
event->motion.x = x;
event->motion.y = y;
- /* This may happen early at startup */
- if (seat_impl->viewports)
- {
- meta_input_device_native_translate_coordinates_in_impl (input_device,
- seat_impl->viewports,
- &event->motion.x,
- &event->motion.y);
- }
-
event->motion.axes = axes;
clutter_event_set_device (event, seat_impl->core_pointer);
clutter_event_set_source_device (event, input_device);