From 4786cc85bd3932da57f899da3a03f4729933f070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 27 Oct 2017 17:41:42 +0800 Subject: [PATCH] monitor-config-manager: Round layout size after scaling When calculating the logical monitor layout size given a scale, don't risk precision loss by float to int casting, which could result in a too small layout. https://bugzilla.gnome.org/show_bug.cgi?id=765011 --- src/backends/meta-monitor-config-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c index a3e92f2e7..431f1c1c3 100644 --- a/src/backends/meta-monitor-config-manager.c +++ b/src/backends/meta-monitor-config-manager.c @@ -545,8 +545,8 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma switch (layout_mode) { case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL: - width /= scale; - height /= scale; + width = (int) roundf (width / scale); + height = (int) roundf (height / scale); break; case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL: break;