[FancyZones] Allow snapping apps launched by Workspaces (#35067)

This commit is contained in:
Seraphima Zykova
2024-09-25 19:36:36 +03:00
committed by GitHub
parent ad1f20408c
commit 471db8bf9c
5 changed files with 70 additions and 30 deletions

View File

@@ -398,7 +398,7 @@ void FancyZones::WindowCreated(HWND window) noexcept
return;
}
if (!FancyZonesWindowProcessing::IsProcessable(window))
if (!FancyZonesWindowProcessing::IsProcessableAutomatically(window))
{
return;
}
@@ -1084,7 +1084,7 @@ bool FancyZones::ShouldProcessSnapHotkey(DWORD vkCode) noexcept
}
auto window = GetForegroundWindow();
if (!FancyZonesWindowProcessing::IsProcessable(window))
if (!FancyZonesWindowProcessing::IsProcessableManually(window))
{
return false;
}

View File

@@ -65,16 +65,28 @@ FancyZonesWindowProcessing::ProcessabilityType FancyZonesWindowProcessing::Defin
return ProcessabilityType::NotCurrentVirtualDesktop;
}
// Ignore windows launched by Workspaces
if (FancyZonesWindowProperties::IsLaunchedByWorkspaces(window))
{
return ProcessabilityType::LaunchedByWorkspaces;
}
return ProcessabilityType::Processable;
}
bool FancyZonesWindowProcessing::IsProcessable(HWND window) noexcept
bool FancyZonesWindowProcessing::IsProcessableAutomatically(HWND window) noexcept
{
return DefineWindowType(window) == ProcessabilityType::Processable;
auto type = DefineWindowType(window);
if (type != ProcessabilityType::Processable)
{
return false;
}
// Ignore windows launched by Workspaces
if (FancyZonesWindowProperties::IsLaunchedByWorkspaces(window))
{
return false;
}
return true;
}
bool FancyZonesWindowProcessing::IsProcessableManually(HWND window) noexcept
{
auto type = DefineWindowType(window);
return type == ProcessabilityType::Processable;
}

View File

@@ -13,10 +13,10 @@ namespace FancyZonesWindowProcessing
NonProcessablePopupWindow,
ChildWindow,
Excluded,
NotCurrentVirtualDesktop,
LaunchedByWorkspaces
NotCurrentVirtualDesktop
};
ProcessabilityType DefineWindowType(HWND window) noexcept;
bool IsProcessable(HWND window) noexcept;
bool IsProcessableAutomatically(HWND window) noexcept;
bool IsProcessableManually(HWND window) noexcept;
}

View File

@@ -29,7 +29,7 @@ WindowMouseSnap::~WindowMouseSnap()
std::unique_ptr<WindowMouseSnap> WindowMouseSnap::Create(HWND window, const std::unordered_map<HMONITOR, std::unique_ptr<WorkArea>>& activeWorkAreas)
{
if (FancyZonesWindowUtils::IsCursorTypeIndicatingSizeEvent() || !FancyZonesWindowProcessing::IsProcessable(window))
if (FancyZonesWindowUtils::IsCursorTypeIndicatingSizeEvent() || !FancyZonesWindowProcessing::IsProcessableManually(window))
{
return nullptr;
}