From 20e5a00707b612f5fdbde020eaa861e426c49bad Mon Sep 17 00:00:00 2001 From: flodavid Date: Sat, 21 Mar 2026 23:56:00 +0100 Subject: [PATCH 1/2] Apply scaling to virtual monitor reported size --- src/Objects/VirtualMonitor.vala | 6 ++++-- src/Widgets/DisplayWidget.vala | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Objects/VirtualMonitor.vala b/src/Objects/VirtualMonitor.vala index 450add74..bdfc12c2 100644 --- a/src/Objects/VirtualMonitor.vala +++ b/src/Objects/VirtualMonitor.vala @@ -134,8 +134,10 @@ public class Display.VirtualMonitor : GLib.Object { height = current_mode.height; } else { var current_mode = monitor.current_mode; - width = current_mode.width; - height = current_mode.height; + // Apply scaling, then force rounding up by adding "0.49" before converting to int, + // to avoid gaps between monitors in the configuration + width = (int)((current_mode.width / scale) + 0.49); + height = (int)((current_mode.height / scale) + 0.49); } } diff --git a/src/Widgets/DisplayWidget.vala b/src/Widgets/DisplayWidget.vala index 2cbfbc5f..7346c388 100644 --- a/src/Widgets/DisplayWidget.vala +++ b/src/Widgets/DisplayWidget.vala @@ -433,7 +433,9 @@ public class Display.DisplayWidget : Gtk.Box { // Prevent breaking autohide by closing popover popover.popdown (); + virtual_monitor.get_current_mode_size (out real_height, out real_width); configuration_changed (); + check_position (); }); rotation_combobox.set_active ((int) virtual_monitor.transform); From af586966c6a5e8bac348d29e8f14c7d3b3c060d0 Mon Sep 17 00:00:00 2001 From: flodavid Date: Sat, 28 Mar 2026 21:08:45 +0100 Subject: [PATCH 2/2] use Math.ceil instead of adding 0.49 --- src/Objects/VirtualMonitor.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Objects/VirtualMonitor.vala b/src/Objects/VirtualMonitor.vala index bdfc12c2..7136055c 100644 --- a/src/Objects/VirtualMonitor.vala +++ b/src/Objects/VirtualMonitor.vala @@ -134,10 +134,10 @@ public class Display.VirtualMonitor : GLib.Object { height = current_mode.height; } else { var current_mode = monitor.current_mode; - // Apply scaling, then force rounding up by adding "0.49" before converting to int, + // Apply scaling, then rounding up before converting back to int, // to avoid gaps between monitors in the configuration - width = (int)((current_mode.width / scale) + 0.49); - height = (int)((current_mode.height / scale) + 0.49); + width = (int) Math.ceil (current_mode.width / scale); + height = (int) Math.ceil (current_mode.height / scale); } }