mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[FancyZones] Do not zone window if it merges with other window (#6549)
* Do not zone window if it merges with other window (e.g. merge Chrome tab into other Chrome window * Small move of func call * Address PR comment * remove include * Address PR comment 2
This commit is contained in:
@@ -104,9 +104,10 @@ private:
|
|||||||
|
|
||||||
HWND m_windowMoveSize{}; // The window that is being moved/sized
|
HWND m_windowMoveSize{}; // The window that is being moved/sized
|
||||||
bool m_inMoveSize{}; // Whether or not a move/size operation is currently active
|
bool m_inMoveSize{}; // Whether or not a move/size operation is currently active
|
||||||
|
FancyZonesUtils::FancyZonesWindowInfo m_moveSizeStartWindowInfo; // WindowInfo of the window at the moment when dragging started
|
||||||
winrt::com_ptr<IZoneWindow> m_zoneWindowMoveSize; // "Active" ZoneWindow, where the move/size is happening. Will update as drag moves between monitors.
|
winrt::com_ptr<IZoneWindow> m_zoneWindowMoveSize; // "Active" ZoneWindow, where the move/size is happening. Will update as drag moves between monitors.
|
||||||
bool m_dragEnabled{}; // True if we should be showing zone hints while dragging
|
bool m_dragEnabled{}; // True if we should be showing zone hints while dragging
|
||||||
|
|
||||||
std::atomic<bool> m_mouseState;
|
std::atomic<bool> m_mouseState;
|
||||||
SecondaryMouseButtonsHook m_mouseHook;
|
SecondaryMouseButtonsHook m_mouseHook;
|
||||||
KeyState<VK_LSHIFT, VK_RSHIFT> m_shiftKeyState;
|
KeyState<VK_LSHIFT, VK_RSHIFT> m_shiftKeyState;
|
||||||
@@ -183,6 +184,7 @@ void WindowMoveHandlerPrivate::MoveSizeStart(HWND window, HMONITOR monitor, POIN
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_moveSizeStartWindowInfo = FancyZonesUtils::GetFancyZonesWindowInfo(window);
|
||||||
m_inMoveSize = true;
|
m_inMoveSize = true;
|
||||||
|
|
||||||
auto iter = zoneWindowMap.find(monitor);
|
auto iter = zoneWindowMap.find(monitor);
|
||||||
@@ -309,7 +311,7 @@ void WindowMoveHandlerPrivate::MoveSizeUpdate(HMONITOR monitor, POINT const& ptS
|
|||||||
|
|
||||||
void WindowMoveHandlerPrivate::MoveSizeEnd(HWND window, POINT const& ptScreen, const std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& zoneWindowMap) noexcept
|
void WindowMoveHandlerPrivate::MoveSizeEnd(HWND window, POINT const& ptScreen, const std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& zoneWindowMap) noexcept
|
||||||
{
|
{
|
||||||
if (window != m_windowMoveSize && !FancyZonesUtils::IsCandidateForZoning(window, m_settings->GetSettings()->excludedAppsArray))
|
if (window != m_windowMoveSize)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -322,7 +324,18 @@ void WindowMoveHandlerPrivate::MoveSizeEnd(HWND window, POINT const& ptScreen, c
|
|||||||
{
|
{
|
||||||
auto zoneWindow = std::move(m_zoneWindowMoveSize);
|
auto zoneWindow = std::move(m_zoneWindowMoveSize);
|
||||||
ResetWindowTransparency();
|
ResetWindowTransparency();
|
||||||
zoneWindow->MoveSizeEnd(m_windowMoveSize, ptScreen);
|
|
||||||
|
auto windowInfo = FancyZonesUtils::GetFancyZonesWindowInfo(window);
|
||||||
|
|
||||||
|
if (windowInfo.standardWindow == false && windowInfo.noVisibleOwner == false &&
|
||||||
|
m_moveSizeStartWindowInfo.standardWindow == true && m_moveSizeStartWindowInfo.noVisibleOwner == true)
|
||||||
|
{
|
||||||
|
// Abort the zoning, this is a Chromium based tab that is merged back with an existing window
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zoneWindow->MoveSizeEnd(m_windowMoveSize, ptScreen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -358,7 +371,7 @@ void WindowMoveHandlerPrivate::MoveSizeEnd(HWND window, POINT const& ptScreen, c
|
|||||||
}
|
}
|
||||||
::RemoveProp(window, ZonedWindowProperties::PropertyMultipleZoneID);
|
::RemoveProp(window, ZonedWindowProperties::PropertyMultipleZoneID);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_inMoveSize = false;
|
m_inMoveSize = false;
|
||||||
m_dragEnabled = false;
|
m_dragEnabled = false;
|
||||||
m_mouseState = false;
|
m_mouseState = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user