[FancyZones] Fix handling newly created windows on Windows 11 (#28646)

This commit is contained in:
Seraphima Zykova
2023-09-21 11:11:51 +03:00
committed by GitHub
parent 59f0ccebc7
commit 8cd2b7cdc3
8 changed files with 91 additions and 88 deletions

View File

@@ -1,39 +1,6 @@
#pragma once
#include <FancyZonesLib/VirtualDesktop.h>
#include <FancyZonesLib/WindowUtils.h>
namespace FancyZonesWindowProcessing
{
inline bool IsProcessable(HWND window) noexcept
{
const bool isSplashScreen = FancyZonesWindowUtils::IsSplashScreen(window);
if (isSplashScreen)
{
return false;
}
const bool windowMinimized = IsIconic(window);
if (windowMinimized)
{
return false;
}
// For windows that FancyZones shouldn't process (start menu, tray, popup menus)
// VirtualDesktopManager is unable to retrieve virtual desktop id and returns an error.
auto desktopId = VirtualDesktop::instance().GetDesktopId(window);
if (!desktopId.has_value())
{
return false;
}
// Switch between virtual desktops results with posting same windows messages that also indicate
// creation of new window. We need to check if window being processed is on currently active desktop.
if (!VirtualDesktop::instance().IsWindowOnCurrentDesktop(window))
{
return false;
}
return true;
}
bool IsProcessable(HWND window) noexcept;
}