From 420a712ad5b12bdf7ed10071adb5824d0fd44832 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Wed, 9 Aug 2017 18:41:13 +0200 Subject: [PATCH] meta-monitor: Make supported scales determination saner Scales below 1 and scales that result in a too small logical monitor size don't make sense. We also don't need so many intermediate scales. https://bugzilla.gnome.org/show_bug.cgi?id=786474 --- src/backends/meta-monitor.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index c2477e60d..f7e23b0b5 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -27,9 +27,11 @@ #include "backends/meta-monitor-manager-private.h" #include "backends/meta-settings-private.h" -#define SCALE_FACTORS_PER_INTEGER 8 -#define MINIMUM_SCALE_FACTOR 0.5f +#define SCALE_FACTORS_PER_INTEGER 4 +#define MINIMUM_SCALE_FACTOR 1.0f #define MAXIMUM_SCALE_FACTOR 4.0f +#define MINIMUM_LOGICAL_WIDTH 800 +#define MINIMUM_LOGICAL_HEIGHT 600 #define HANDLED_CRTC_MODE_FLAGS (META_CRTC_MODE_FLAG_INTERLACE) @@ -1438,7 +1440,10 @@ get_closest_scale_factor_for_resolution (float width, scaled_w = width / scale; scaled_h = height / scale; - if (scale < MINIMUM_SCALE_FACTOR || scale > MAXIMUM_SCALE_FACTOR) + if (scale < MINIMUM_SCALE_FACTOR || + scale > MAXIMUM_SCALE_FACTOR || + floorf (scaled_w) < MINIMUM_LOGICAL_WIDTH || + floorf (scaled_h) < MINIMUM_LOGICAL_HEIGHT) goto out; if (floorf (scaled_w) == scaled_w && floorf (scaled_h) == scaled_h)