2022-05-20 10:51:15 +02:00
|
|
|
#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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
// 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);
|
2022-05-30 12:16:33 +02:00
|
|
|
auto currentDesktopId = VirtualDesktop::instance().GetCurrentVirtualDesktopId();
|
|
|
|
|
if (!desktopId.has_value())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentDesktopId != GUID_NULL && desktopId.value() != currentDesktopId)
|
2022-05-20 10:51:15 +02:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|