diff --git a/src/backends/meta-monitor-config-store.c b/src/backends/meta-monitor-config-store.c index fe9406fd3..53a32cd2a 100644 --- a/src/backends/meta-monitor-config-store.c +++ b/src/backends/meta-monitor-config-store.c @@ -653,6 +653,7 @@ derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_conf MetaMonitorConfig *monitor_config; int mode_width, mode_height; int width = 0, height = 0; + float scale; GList *l; monitor_config = logical_monitor_config->monitor_configs->data; @@ -683,13 +684,21 @@ derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_conf height = mode_height; } + scale = logical_monitor_config->scale; + switch (layout_mode) { case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL: - width = roundf (width / logical_monitor_config->scale); - height = roundf (height / logical_monitor_config->scale); + width = roundf (width / scale); + height = roundf (height / scale); break; case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL: + if (!G_APPROX_VALUE (scale, roundf (scale), FLT_EPSILON)) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "A fractional scale with physical layout mode not allowed"); + return FALSE; + } break; }