mirror of
https://github.com/microsoft/PowerToys
synced 2024-11-23 01:19:17 +00:00
[FancyZones] Fix canvas zones drawing (#27882)
This commit is contained in:
parent
f0c30132a2
commit
3fe2a2459d
@ -627,6 +627,7 @@ LRESULT FancyZones::WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lpa
|
|||||||
if (auto monitor = MonitorFromPoint(ptScreen, MONITOR_DEFAULTTONULL))
|
if (auto monitor = MonitorFromPoint(ptScreen, MONITOR_DEFAULTTONULL))
|
||||||
{
|
{
|
||||||
MoveSizeStart(hwnd, monitor);
|
MoveSizeStart(hwnd, monitor);
|
||||||
|
MoveSizeUpdate(monitor, ptScreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (message == WM_PRIV_MOVESIZEEND)
|
else if (message == WM_PRIV_MOVESIZEEND)
|
||||||
|
@ -57,19 +57,21 @@ bool WindowDrag::MoveSizeStart(HMONITOR monitor, bool isSnapping)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_currentWorkArea = iter->second.get();
|
m_currentWorkArea = iter->second.get();
|
||||||
|
if (!m_currentWorkArea)
|
||||||
SwitchSnappingMode(isSnapping);
|
|
||||||
|
|
||||||
if (m_currentWorkArea)
|
|
||||||
{
|
{
|
||||||
m_currentWorkArea->UnsnapWindow(m_window);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_currentWorkArea->UnsnapWindow(m_window);
|
||||||
|
SwitchSnappingMode(isSnapping);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowDrag::MoveSizeUpdate(HMONITOR monitor, POINT const& ptScreen, bool isSnapping, bool isSelectManyZonesState)
|
void WindowDrag::MoveSizeUpdate(HMONITOR monitor, POINT const& ptScreen, bool isSnapping, bool isSelectManyZonesState)
|
||||||
{
|
{
|
||||||
|
SwitchSnappingMode(isSnapping);
|
||||||
|
|
||||||
auto iter = m_activeWorkAreas.find(monitor);
|
auto iter = m_activeWorkAreas.find(monitor);
|
||||||
if (isSnapping && iter != m_activeWorkAreas.end())
|
if (isSnapping && iter != m_activeWorkAreas.end())
|
||||||
{
|
{
|
||||||
@ -105,8 +107,6 @@ void WindowDrag::MoveSizeUpdate(HMONITOR monitor, POINT const& ptScreen, bool is
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitchSnappingMode(isSnapping);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowDrag::MoveSizeEnd()
|
void WindowDrag::MoveSizeEnd()
|
||||||
@ -149,10 +149,19 @@ void WindowDrag::MoveSizeEnd()
|
|||||||
|
|
||||||
void WindowDrag::SwitchSnappingMode(bool isSnapping)
|
void WindowDrag::SwitchSnappingMode(bool isSnapping)
|
||||||
{
|
{
|
||||||
|
if (!m_currentWorkArea)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_snappingMode && isSnapping) // turn on
|
if (!m_snappingMode && isSnapping) // turn on
|
||||||
{
|
{
|
||||||
SetWindowTransparency();
|
SetWindowTransparency();
|
||||||
|
|
||||||
|
// init active layout
|
||||||
|
m_currentWorkArea->ShowZonesOverlay(m_highlightedZones.Zones(), m_window);
|
||||||
|
|
||||||
|
// init layouts on other monitors
|
||||||
if (FancyZonesSettings::settings().showZonesOnAllMonitors)
|
if (FancyZonesSettings::settings().showZonesOnAllMonitors)
|
||||||
{
|
{
|
||||||
for (const auto& [_, workArea] : m_activeWorkAreas)
|
for (const auto& [_, workArea] : m_activeWorkAreas)
|
||||||
@ -164,10 +173,7 @@ void WindowDrag::SwitchSnappingMode(bool isSnapping)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_currentWorkArea)
|
Trace::WorkArea::MoveOrResizeStarted(m_currentWorkArea->GetLayout().get(), m_currentWorkArea->GetLayoutWindows().get());
|
||||||
{
|
|
||||||
Trace::WorkArea::MoveOrResizeStarted(m_currentWorkArea->GetLayout().get(), m_currentWorkArea->GetLayoutWindows().get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (m_snappingMode && !isSnapping) // turn off
|
else if (m_snappingMode && !isSnapping) // turn off
|
||||||
{
|
{
|
||||||
@ -183,10 +189,7 @@ void WindowDrag::SwitchSnappingMode(bool isSnapping)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_currentWorkArea)
|
Trace::WorkArea::MoveOrResizeEnd(m_currentWorkArea->GetLayout().get(), m_currentWorkArea->GetLayoutWindows().get());
|
||||||
{
|
|
||||||
Trace::WorkArea::MoveOrResizeEnd(m_currentWorkArea->GetLayout().get(), m_currentWorkArea->GetLayoutWindows().get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_snappingMode = isSnapping;
|
m_snappingMode = isSnapping;
|
||||||
|
Loading…
Reference in New Issue
Block a user