Skip to content

Commit 35763b9

Browse files
committed
gnome-rr.c: Restore fractional scale limiting, mistakenly removed
in 23b8dcf. This was allowing up to 200% scaling regardless of whether or not this was actually feasible for the monitor resolution.
1 parent 0dc2cb0 commit 35763b9

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

libcinnamon-desktop/gnome-rr.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2753,20 +2753,31 @@ gnome_rr_crtc_get_gamma (GnomeRRCrtc *crtc, int *size,
27532753

27542754
/* The minimum resolution at which we turn on a window-scale of 2 */
27552755
#define HIDPI_LIMIT 192
2756-
#define HIDPI_MIN_SCALED_HEIGHT 720
27572756

2758-
/* The minimum screen height at which we turn on a window-scale of 2;
2759-
* below this there just isn't enough vertical real estate for GNOME
2757+
/* The minimum screen height at which we automatically turn on a window
2758+
*-scale of 2; below this there just isn't enough vertical real estate for GNOME
27602759
* apps to work, and it's better to just be tiny */
2761-
#define HIDPI_MIN_HEIGHT 1500
2760+
#define MINIMUM_REAL_VERTICAL_PIXELS 1400
2761+
2762+
/* The minimum logical height we'll allow - any smaller than this is
2763+
* not very usable and can make Cinnamon behave unpredictably. */
2764+
#define MINIMUM_LOGICAL_VERTICAL_PIXELS 700
2765+
2766+
static gboolean
2767+
is_logical_size_large_enough (int width,
2768+
int height)
2769+
{
2770+
return height >= MINIMUM_LOGICAL_VERTICAL_PIXELS;
2771+
}
27622772

27632773
static gboolean
27642774
is_scale_valid_for_size (float width,
27652775
float height,
27662776
float scale)
27672777
{
27682778
return scale >= MINIMUM_LOGICAL_SCALE_FACTOR &&
2769-
scale <= MAXIMUM_LOGICAL_SCALE_FACTOR;
2779+
scale <= MAXIMUM_LOGICAL_SCALE_FACTOR &&
2780+
is_logical_size_large_enough (floorf (width/scale), floorf (height/scale));
27702781
}
27712782

27722783
static float
@@ -2969,9 +2980,9 @@ gnome_rr_screen_calculate_best_global_scale (GnomeRRScreen *screen,
29692980
" REAL pixel size: %d x %d. Current global scale: %d, reported monitor scale: %d",
29702981
index, width_mm, height_mm, real_width, real_height, gnome_rr_screen_get_global_scale (NULL), monitor_scale);
29712982

2972-
if (real_height < HIDPI_MIN_HEIGHT)
2983+
if (real_height < MINIMUM_REAL_VERTICAL_PIXELS)
29732984
{
2974-
g_debug ("REAL height of %d for monitor %d is less than %d, so the recommended scale will be 1", real_height, index, HIDPI_MIN_HEIGHT);
2985+
g_debug ("REAL height of %d for monitor %d is less than %d, so the recommended scale will be 1", real_height, index, MINIMUM_REAL_VERTICAL_PIXELS);
29752986
goto out;
29762987
}
29772988

0 commit comments

Comments
 (0)