1
0
Fork 0

backends/native: Translate right coords when creating motion events

With commit 7d78768809 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>
This commit is contained in:
Jonas Dreßler 2021-03-08 15:09:07 +01:00 committed by Marge Bot
parent ec14f51ae3
commit 3263084bcf

View file

@ -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);