From 0fc39b2a87c82c0a67aca936f1c4ec33e9d58df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Mon, 19 Feb 2024 19:25:59 +0100 Subject: [PATCH] Revert "wayland/surface: Add fallback for get_highest_output_scale" Turns out there is a better solution: Almost always, MetaWindow already has an idea on which monitor it will be, even if it isn't positioned yet. Since the last commit we're now using that monitor for setting the highest-output-scale of the window, so this fallback is no longer necessary. While we could keep this fallback around and also return a valid scale in case the surface is not even mapped yet, this means we report fractional scale twice for new surfaces: Once from wp_fractional_scale_manager::get_fractional_scale() (here we'll enter the fallback), and a second time (this time with correct scale) right after creating the MetaWindow. Note that wp_fractional_scale_v1 doesn't specify that a preferred_scale event must be sent immediately after wp_fractional_scale_manager::get_fractional_scale(), so we can safely remove the fallback. This reverts commit 8cfbdb4313edbd7748fb21769d37bf5c35692042. Part-of: --- src/wayland/meta-wayland-surface.c | 31 +++--------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 3761c7b72..0028f26dc 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1419,26 +1419,6 @@ surface_output_disconnect_signals (gpointer key, surface); } -static void -get_highest_output_scale (gpointer key, - gpointer value, - gpointer user_data) -{ - MetaWaylandOutput *wayland_output = value; - MetaLogicalMonitor *logical_monitor; - double *highest_scale = user_data; - double scale; - - logical_monitor = meta_wayland_output_get_logical_monitor (wayland_output); - if (!logical_monitor) - return; - - scale = meta_logical_monitor_get_scale (logical_monitor); - - if (scale > *highest_scale) - *highest_scale = scale; -} - double meta_wayland_surface_get_highest_output_scale (MetaWaylandSurface *surface) { @@ -1448,20 +1428,15 @@ meta_wayland_surface_get_highest_output_scale (MetaWaylandSurface *surface) window = meta_wayland_surface_get_window (surface); if (!window) - goto fallback; + goto out; logical_monitor = meta_window_get_highest_scale_monitor (window); if (!logical_monitor) - goto fallback; + goto out; scale = meta_logical_monitor_get_scale (logical_monitor); - return scale; - -fallback: - g_hash_table_foreach (surface->compositor->outputs, - get_highest_output_scale, - &scale); +out: return scale; }