From 381de44c5dd50ec61f583239a11d5a9c35c5f05d Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 3 Dec 2022 10:36:26 -0300 Subject: [PATCH] window-actor: Use logical monitor scale on cursor scale When using 'scale-monitor-framebuffer', it's important to use the monitor's scale on top of the cursor texture scale. This matches what the monitor screencast source does. Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1541 Part-of: --- src/compositor/meta-window-actor.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index d63d7e600..8299a7b7d 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -1222,15 +1222,20 @@ meta_window_actor_transform_cursor_position (MetaScreenCastWindow *screen_cast_w meta_cursor_sprite_get_cogl_texture (cursor_sprite) && out_cursor_scale) { - MetaShapedTexture *stex; - double texture_scale; + MetaLogicalMonitor *logical_monitor; + float view_scale; float cursor_texture_scale; - stex = meta_surface_actor_get_texture (priv->surface); - texture_scale = meta_shaped_texture_get_buffer_scale (stex); + logical_monitor = meta_window_get_main_logical_monitor (window); + + if (meta_is_stage_views_scaled ()) + view_scale = meta_logical_monitor_get_scale (logical_monitor); + else + view_scale = 1.0; + cursor_texture_scale = meta_cursor_sprite_get_texture_scale (cursor_sprite); - *out_cursor_scale = texture_scale / cursor_texture_scale; + *out_cursor_scale = view_scale * cursor_texture_scale; } if (cursor_sprite &&