mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 17:42:45 +08:00
Fix rcNormalPosition in SetWindowPlacement
This commit is contained in:
parent
f254afbd00
commit
03cb04823c
@ -1,6 +1,5 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
|
|
||||||
struct Zone : winrt::implements<Zone, IZone>
|
struct Zone : winrt::implements<Zone, IZone>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -75,6 +74,12 @@ void Zone::SizeWindowToZone(HWND window, HWND zoneWindow) noexcept
|
|||||||
// Map to screen coords
|
// Map to screen coords
|
||||||
MapWindowRect(zoneWindow, nullptr, &zoneRect);
|
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;
|
WINDOWPLACEMENT placement;
|
||||||
::GetWindowPlacement(window, &placement);
|
::GetWindowPlacement(window, &placement);
|
||||||
placement.rcNormalPosition = zoneRect;
|
placement.rcNormalPosition = zoneRect;
|
||||||
|
@ -270,10 +270,6 @@ IFACEMETHODIMP_(void) ZoneSet::MoveSizeEnd(HWND window, HWND zoneWindow, POINT p
|
|||||||
if (auto zone = ZoneFromPoint(ptClient))
|
if (auto zone = ZoneFromPoint(ptClient))
|
||||||
{
|
{
|
||||||
zone->AddWindowToZone(window, zoneWindow, true);
|
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