[mutter] meta-monitor: Make supported scales determination saner



commit 420a712ad5b12bdf7ed10071adb5824d0fd44832
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Aug 9 18:41:13 2017 +0200

    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 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index c2477e6..f7e23b0 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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]