This commit is contained in:
seraphima
2024-07-13 21:07:37 +02:00
parent 8620d80047
commit 5576c7b23f
2 changed files with 24 additions and 0 deletions

View File

@@ -201,6 +201,11 @@ namespace SnapshotUtils
}
}
if (WindowFilter::FilterPopup(window))
{
continue;
}
auto data = Utils::Apps::GetApp(processPath, installedApps);
if (!data.has_value() || data->name.empty())
{

View File

@@ -38,4 +38,23 @@ namespace WindowFilter
return true;
}
inline bool FilterPopup(HWND window)
{
auto style = GetWindowLong(window, GWL_STYLE);
bool isPopup = WindowUtils::HasStyle(style, WS_POPUP);
bool hasThickFrame = WindowUtils::HasStyle(style, WS_THICKFRAME);
bool hasCaption = WindowUtils::HasStyle(style, WS_CAPTION);
bool hasMinimizeMaximizeButtons = WindowUtils::HasStyle(style, WS_MINIMIZEBOX) || WindowUtils::HasStyle(style, WS_MAXIMIZEBOX);
if (isPopup && !(hasThickFrame && (hasCaption || hasMinimizeMaximizeButtons)))
{
// popup windows we want to snap: e.g. Calculator, Telegram
// popup windows we don't want to snap: start menu, notification popup, tray window, etc.
// WS_CAPTION, WS_MINIMIZEBOX, WS_MAXIMIZEBOX are used for filtering out menus,
// e.g., in Edge "Running as admin" menu when creating a new PowerToys issue.
return true;
}
return false;
}
}