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
This commit is contained in:
Rui Matos 2017-08-09 18:41:13 +02:00
parent 9a47e5c832
commit 420a712ad5

View File

@ -27,9 +27,11 @@
#include "backends/meta-monitor-manager-private.h" #include "backends/meta-monitor-manager-private.h"
#include "backends/meta-settings-private.h" #include "backends/meta-settings-private.h"
#define SCALE_FACTORS_PER_INTEGER 8 #define SCALE_FACTORS_PER_INTEGER 4
#define MINIMUM_SCALE_FACTOR 0.5f #define MINIMUM_SCALE_FACTOR 1.0f
#define MAXIMUM_SCALE_FACTOR 4.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) #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_w = width / scale;
scaled_h = height / 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; goto out;
if (floorf (scaled_w) == scaled_w && floorf (scaled_h) == scaled_h) if (floorf (scaled_w) == scaled_w && floorf (scaled_h) == scaled_h)