mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
Fix rcNormalPosition in SetWindowPlacement
This commit is contained in:
parent
f254afbd00
commit
03cb04823c
@ -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;
|
||||
|
@ -270,10 +270,6 @@ IFACEMETHODIMP_(void) ZoneSet::MoveSizeEnd(HWND window, HWND zoneWindow, POINT p
|
||||
if (auto zone = ZoneFromPoint(ptClient))
|
||||
{
|
||||
zone->AddWindowToZone(window, zoneWindow, true);
|
||||
|
||||
POINT pointAdjustedScreen = ptClient;
|
||||
MapWindowPoints(zoneWindow, nullptr, &pointAdjustedScreen, 1);
|
||||
SetCursorPos(pointAdjustedScreen.x, pointAdjustedScreen.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user