mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
Fix rcNormalPosition in SetWindowPlacement
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "pch.h"
|
||||
|
||||
|
||||
struct Zone : winrt::implements<Zone, IZone>
|
||||
{
|
||||
public:
|
||||
@@ -75,6 +74,12 @@ void Zone::SizeWindowToZone(HWND window, HWND zoneWindow) noexcept
|
||||
// Map to screen coords
|
||||
MapWindowRect(zoneWindow, nullptr, &zoneRect);
|
||||
|
||||
MONITORINFO mi{sizeof(mi)};
|
||||
if (GetMonitorInfoW(MonitorFromWindow(zoneWindow, MONITOR_DEFAULTTONEAREST), &mi))
|
||||
{
|
||||
OffsetRect(&zoneRect, mi.rcMonitor.left - mi.rcWork.left, mi.rcMonitor.top - mi.rcWork.top);
|
||||
}
|
||||
|
||||
WINDOWPLACEMENT placement;
|
||||
::GetWindowPlacement(window, &placement);
|
||||
placement.rcNormalPosition = zoneRect;
|
||||
|
||||
Reference in New Issue
Block a user