From 7ffd1c225f72cce40b188e61bf7f0078f6afc4ac Mon Sep 17 00:00:00 2001 From: Leonhard Kargl Date: Thu, 29 Oct 2026 12:21:23 +0100 Subject: [PATCH] PanelWindow: Fix gap between maximized window and wingpanel When fractional scaling is enabled it can happen that the wingpanel covers half a pixel. This causes a visible gap to appear between a maximized window and the panel. We will be able to solve this properly in Gtk 4.24 with Gtk.Snapshot.set_snap but since that's not available even in OS 9 let's work around it. The workaround might cause the top most pixel of an app to disappear behind the panel but that shouldn't be really noticeable. --- src/PanelWindow.vala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PanelWindow.vala b/src/PanelWindow.vala index 158bcffc..d036d196 100644 --- a/src/PanelWindow.vala +++ b/src/PanelWindow.vala @@ -78,7 +78,13 @@ public class Wingpanel.PanelWindow : Gtk.Window { } private static void on_compute_size (Gdk.ToplevelSize top_level_size) { - top_level_size.set_shadow_width (0, 0, 0, BottomMargin.SIZE); + /* +1 to make sure that even with fractional scaling there are + no gaps between wingpanel and a maximized window. Currently with + certain scale factors and the current CSS we might end up with a gap + because we cover half a pixel. We can solve this properly in Gtk 4.24 + with Gtk.Snapshot.set_snap (see https://blogs.gnome.org/gtk/2026/05/28/snapping/), + but for now lets work around it */ + top_level_size.set_shadow_width (0, 0, 0, BottomMargin.SIZE + 1); } private void on_layout (Gdk.Surface surface, int width, int height) {