From 96791f111a034ea3cc571a92c5cad30814b3f564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Mon, 19 Feb 2024 02:08:02 +0100 Subject: [PATCH] monitor: Move check to limit fractional scales to certain monitor sizes We'll reuse meta_monitor_get_closest_scale_factor_for_resolution() for the conversion of monitor configs, and during those conversions, we probably don't want to impose the same limits to fractional scales that we usually impose. This means that we can even convert physical layout configs where the user manually changed to a value higher than what our fractional scale calculations would allow. Move this check into the calling function so that it's not imposed by meta_monitor_get_closest_scale_factor_for_resolution() directly. Part-of: --- src/backends/meta-monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index a896816a0..ea38aec21 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -2009,9 +2009,6 @@ meta_get_closest_monitor_scale_factor_for_resolution (float width, best_scale = 0; - if (!is_scale_valid_for_size (width, height, scale)) - return best_scale; - if (fmodf (width, scale) == 0.0 && fmodf (height, scale) == 0.0) return scale; @@ -2095,6 +2092,9 @@ meta_monitor_calculate_supported_scales (MetaMonitor *monitor, float scale; float scale_value = i + j * SCALE_FACTORS_STEPS; + if (!is_scale_valid_for_size (width, height, scale_value)) + continue; + scale = meta_get_closest_monitor_scale_factor_for_resolution (width, height, scale_value,