mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
clean up
This commit is contained in:
@@ -201,6 +201,11 @@ namespace SnapshotUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (WindowFilter::FilterPopup(window))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto data = Utils::Apps::GetApp(processPath, installedApps);
|
auto data = Utils::Apps::GetApp(processPath, installedApps);
|
||||||
if (!data.has_value() || data->name.empty())
|
if (!data.has_value() || data->name.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,4 +38,23 @@ namespace WindowFilter
|
|||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user