From 498da80b50d6f4f32164469ef3e11c5e6d0e3197 Mon Sep 17 00:00:00 2001 From: Stefan <11146296+tryallthethings@users.noreply.github.com> Date: Thu, 1 Jun 2023 10:53:21 +0200 Subject: [PATCH] Update Windows.cs Potential fix for #420 This should calculate the correct DPI scaling factor and apply it. It also forces the sidebar to use the full window height. --- SidebarDiagnostics/Windows.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SidebarDiagnostics/Windows.cs b/SidebarDiagnostics/Windows.cs index 43d8896..bd4e953 100644 --- a/SidebarDiagnostics/Windows.cs +++ b/SidebarDiagnostics/Windows.cs @@ -873,7 +873,10 @@ public static void GetWorkArea(AppBarWindow window, out int screen, out DockEdge }; windowWA = Windows.WorkArea.FromRECT(_active.WorkArea); - windowWA.Scale(_active.InverseScaleX, _active.InverseScaleY); + + double scaleX = _active.ScaleX / _primary.ScaleX; + double scaleY = _active.ScaleY / _primary.ScaleY; + windowWA.Scale(scaleX, scaleY); double _modifyX = 0d; double _modifyY = 0d; @@ -889,6 +892,9 @@ public static void GetWorkArea(AppBarWindow window, out int screen, out DockEdge windowWA.Offset(_offsetX, _offsetY); + windowWA.Top = 0; + windowWA.Bottom = _active.WorkArea.Height; + appbarWA = Windows.WorkArea.FromRECT(_active.WorkArea); appbarWA.Offset(_modifyX, _modifyY); @@ -1530,4 +1536,4 @@ private IntPtr AppBarHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, re private CancellationTokenSource _cancelReposition { get; set; } } -} \ No newline at end of file +}