From cddd3a7df02f395e5e5bafad410d3633a9654c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 31 Aug 2024 22:54:35 +0200 Subject: [PATCH] x11-display: Use X11 UI scaling factor for cursor theme size As with Xsettings, we want to use the X11 UI scaling factor to set the cursor size, so that clients use a larger theme, both when using `native-xwayland-scaling` and a physical layout mode. Fixes: 6e8c7c5f84 ("Add experimental mode to use native scaling of Xwayland clients") Part-of: --- src/wayland/meta-wayland-cursor-surface.c | 13 ++++++++++++- src/x11/meta-x11-display.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-wayland-cursor-surface.c b/src/wayland/meta-wayland-cursor-surface.c index 83ad04355..9def1e9f3 100644 --- a/src/wayland/meta-wayland-cursor-surface.c +++ b/src/wayland/meta-wayland-cursor-surface.c @@ -103,8 +103,19 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite, meta_monitor_manager_get_logical_monitor_at (monitor_manager, x, y); if (logical_monitor) { - int surface_scale = surface->applied_state.scale; + int surface_scale; float texture_scale; +#ifdef HAVE_XWAYLAND + MetaWaylandCompositor *wayland_compositor = + meta_context_get_wayland_compositor (context); + MetaXWaylandManager *xwayland_manager = + &wayland_compositor->xwayland_manager; + + if (meta_wayland_surface_is_xwayland (surface)) + surface_scale = meta_xwayland_get_x11_ui_scaling_factor (xwayland_manager); + else +#endif /* HAVE_XWAYLAND */ + surface_scale = surface->applied_state.scale; if (meta_backend_is_stage_views_scaled (backend)) texture_scale = 1.0f / surface_scale; diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c index 40f95c08a..d885a3176 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c @@ -1965,7 +1965,7 @@ update_cursor_theme (MetaX11Display *x11_display) MetaXWaylandManager *xwayland_manager = &wayland_compositor->xwayland_manager; - scale = meta_xwayland_get_effective_scale (xwayland_manager); + scale = meta_xwayland_get_x11_ui_scaling_factor (xwayland_manager); #endif break; }