From db0b042f7e7faac1f85697be7caf1bd26d98b0d2 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 15 Aug 2020 19:36:36 +0200 Subject: [PATCH] + fix: DPI Awarenes of window positions (default, sticky, ...) --- minipath/src/minipath.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/minipath/src/minipath.c b/minipath/src/minipath.c index ad62e5bcb..a379adefa 100644 --- a/minipath/src/minipath.c +++ b/minipath/src/minipath.c @@ -3644,15 +3644,14 @@ void SnapToTarget(HWND hwnd) void SnapToDefaultPos(HWND hwnd) { WINDOWPLACEMENT wndpl; - HMONITOR hMonitor; - MONITORINFO mi; int x,y,cx,cy; RECT rcOld; GetWindowRect(hwnd,&rcOld); - hMonitor = MonitorFromRect(&rcOld,MONITOR_DEFAULTTONEAREST); - mi.cbSize = sizeof(mi); + MONITORINFO mi = {0}; + mi.cbSize = sizeof(MONITORINFO); + HMONITOR const hMonitor = MonitorFromRect(&rcOld, MONITOR_DEFAULTTONEAREST); GetMonitorInfo(hMonitor,&mi); x = mi.rcWork.left + 16; @@ -3680,7 +3679,8 @@ void SnapToDefaultPos(HWND hwnd) OffsetRect(&wndpl.rcNormalPosition,mi.rcMonitor.left - mi.rcWork.left,mi.rcMonitor.top - mi.rcWork.top); } - SetWindowPlacement(hwnd,&wndpl); + SetWindowPlacement(hwnd, &wndpl); // 1st set correct screen (DPI Aware) + SetWindowPlacement(hwnd, &wndpl); // 2nd resize position to correct DPI settings }