Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat(domain): adjust width/height of window if there's a pending DPI adjustment

Lars Berger01777f62c66d
diff --git a/LarsWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs b/LarsWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
index 46438905..cbd8e442 100644
--- a/LarsWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
+++ b/LarsWM.Domain/Containers/CommandHandlers/RedrawContainersHandler.cs
@@ -57,12 +57,13 @@ namespace LarsWM.Domain.Containers.CommandHandlers
// Adjust the width and height of the window if there's a mismatch between the DPI of the
// monitor and the window. This occurs when moving a window between screens of different DPIs.
- if (dpiScaleFactor != 1)
+ if (window.PendingDpiScaling != 1)
{
- int adjustedWidth = Convert.ToInt32(window.Width * dpiScaleFactor);
- int adjustedHeight = Convert.ToInt32(window.Height * dpiScaleFactor);
+ int adjustedWidth = Convert.ToInt32(window.Width * window.PendingDpiScaling);
+ int adjustedHeight = Convert.ToInt32(window.Height * window.PendingDpiScaling);
SetWindowPos(window.Hwnd, IntPtr.Zero, window.X, window.Y, adjustedWidth, adjustedHeight, flags);
+ window.PendingDpiScaling = 1;
continue;
}