Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Workspaces] Fix snapshotting minimized apps #37598

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix snapshotting minimized packaged apps
  • Loading branch information
donlaci committed Feb 19, 2025
commit ca55dc7e49fb67e8664b9a077d1984d477b831ee
Original file line number Diff line number Diff line change
@@ -96,7 +96,9 @@ namespace SnapshotUtils
// fix for the packaged apps that are not caught when minimized, e.g., Settings.
if (processPath.ends_with(NonLocalizable::ApplicationFrameHost))
{
for (auto otherWindow : windows)
auto minWindows = WindowEnumerator::Enumerate(WindowFilter::FilterMin);

for (auto otherWindow : minWindows)
{
DWORD otherPid{};
GetWindowThreadProcessId(otherWindow, &otherPid);
39 changes: 39 additions & 0 deletions src/modules/Workspaces/workspaces-common/WindowFilter.h
Original file line number Diff line number Diff line change
@@ -62,4 +62,43 @@ namespace WindowFilter

return true;
}

inline bool FilterMin(HWND window)
{
auto style = GetWindowLong(window, GWL_STYLE);
auto exStyle = GetWindowLong(window, GWL_EXSTYLE);

if (!WindowUtils::HasStyle(style, WS_VISIBLE))
{
return false;
}

if (!IsWindowVisible(window))
{
return false;
}

if (WindowUtils::HasStyle(exStyle, WS_EX_TOOLWINDOW))
{
return false;
}

if (!WindowUtils::IsRoot(window))
{
// child windows such as buttons, combo boxes, etc.
return false;
}

////if (WindowFilter::FilterPopup(window))
////{
//// return false;
////}

if (!VirtualDesktop::instance().IsWindowOnCurrentDesktop(window))
{
return false;
}

return true;
}
}