window-actor: Apply resource scale to cursor position

meta_screen_cast_window_stream_src_set_cursor_metadata() relies
entirely on meta_screen_cast_window_transform_cursor_position()
to return the correct relative cursor position.

However, this function actually does not return the expected
values, since it does not apply the resource scale to the
transformed position.

Actually apply the cursor scale when calculating the cursor
position.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2737>
This commit is contained in:
Georges Basile Stavracas Neto 2022-12-03 10:24:25 -03:00
parent 4d4e8e5862
commit 1f705ee10a

View File

@ -1243,11 +1243,18 @@ meta_window_actor_transform_cursor_position (MetaScreenCastWindow *screen_cast_w
if (out_relative_cursor_position)
{
float resource_scale;
clutter_actor_transform_stage_point (CLUTTER_ACTOR (priv->surface),
cursor_position->x,
cursor_position->y,
&out_relative_cursor_position->x,
&out_relative_cursor_position->y);
resource_scale =
clutter_actor_get_resource_scale (CLUTTER_ACTOR (window_actor));
out_relative_cursor_position->x *= resource_scale;
out_relative_cursor_position->y *= resource_scale;
}
return TRUE;