mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[FancyZones] Outlook new message restore placement bug (#2534)
This commit is contained in:
committed by
GitHub
parent
3265549911
commit
3d619f1670
@@ -60,13 +60,13 @@ public:
|
||||
std::unique_lock writeLock(m_lock);
|
||||
m_windowMoveHandler.MoveSizeStart(window, monitor, ptScreen, m_zoneWindowMap);
|
||||
}
|
||||
|
||||
|
||||
void MoveSizeUpdate(HMONITOR monitor, POINT const& ptScreen) noexcept
|
||||
{
|
||||
std::unique_lock writeLock(m_lock);
|
||||
m_windowMoveHandler.MoveSizeUpdate(monitor, ptScreen, m_zoneWindowMap);
|
||||
}
|
||||
|
||||
|
||||
void MoveSizeEnd(HWND window, POINT const& ptScreen) noexcept
|
||||
{
|
||||
std::unique_lock writeLock(m_lock);
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
ToggleEditor() noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
SettingsChanged() noexcept;
|
||||
|
||||
|
||||
void WindowCreated(HWND window) noexcept;
|
||||
|
||||
// IZoneWindowHost
|
||||
@@ -222,9 +222,12 @@ private:
|
||||
bool OnSnapHotkey(DWORD vkCode) noexcept;
|
||||
|
||||
void RegisterVirtualDesktopUpdates(std::vector<GUID>& ids) noexcept;
|
||||
|
||||
void RegisterNewWorkArea(GUID virtualDesktopId, HMONITOR monitor) noexcept;
|
||||
bool IsNewWorkArea(GUID virtualDesktopId, HMONITOR monitor) noexcept;
|
||||
|
||||
bool IsSplashScreen(HWND window);
|
||||
|
||||
void OnEditorExitEvent() noexcept;
|
||||
bool ProcessSnapHotkey() noexcept;
|
||||
|
||||
@@ -340,6 +343,7 @@ IFACEMETHODIMP_(void)
|
||||
FancyZones::WindowCreated(HWND window) noexcept
|
||||
{
|
||||
std::shared_lock readLock(m_lock);
|
||||
|
||||
if (m_settings->GetSettings()->appLastZone_moveWindows && IsInterestingWindow(window, m_settings->GetSettings()->excludedAppsArray))
|
||||
{
|
||||
for (const auto& [monitor, zoneWindow] : m_zoneWindowMap)
|
||||
@@ -357,15 +361,18 @@ FancyZones::WindowCreated(HWND window) noexcept
|
||||
const auto activeZoneSet = zoneWindow->ActiveZoneSet();
|
||||
if (activeZoneSet)
|
||||
{
|
||||
const auto& fancyZonesData = JSONHelpers::FancyZonesDataInstance();
|
||||
auto& fancyZonesData = JSONHelpers::FancyZonesDataInstance();
|
||||
|
||||
wil::unique_cotaskmem_string guidString;
|
||||
if (SUCCEEDED(StringFromCLSID(activeZoneSet->Id(), &guidString)))
|
||||
{
|
||||
std::vector<int> zoneIndexSet = fancyZonesData.GetAppLastZoneIndexSet(window, zoneWindow->UniqueId(), guidString.get());
|
||||
if (zoneIndexSet.size())
|
||||
if (zoneIndexSet.size() &&
|
||||
!IsSplashScreen(window) &&
|
||||
!fancyZonesData.IsAnotherWindowOfApplicationInstanceZoned(window))
|
||||
{
|
||||
m_windowMoveHandler.MoveWindowIntoZoneByIndexSet(window, monitor, zoneIndexSet, m_zoneWindowMap);
|
||||
fancyZonesData.UpdateProcessIdToHandleMap(window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -662,7 +669,6 @@ LRESULT FancyZones::WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lpa
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void FancyZones::OnDisplayChange(DisplayChangeType changeType) noexcept
|
||||
{
|
||||
if (changeType == DisplayChangeType::VirtualDesktop ||
|
||||
@@ -932,6 +938,18 @@ bool FancyZones::IsNewWorkArea(GUID virtualDesktopId, HMONITOR monitor) noexcept
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FancyZones::IsSplashScreen(HWND window)
|
||||
{
|
||||
wchar_t splashClassName[] = L"MsoSplash"; // shouldn't be localized
|
||||
wchar_t className[MAX_PATH];
|
||||
if (GetClassName(window, className, MAX_PATH) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return wcscmp(splashClassName, className) == 0;
|
||||
}
|
||||
|
||||
void FancyZones::OnEditorExitEvent() noexcept
|
||||
{
|
||||
// Collect information about changes in zone layout after editor exited.
|
||||
|
||||
Reference in New Issue
Block a user