mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
minimized settings snap fix
This commit is contained in:
@@ -12,6 +12,11 @@
|
|||||||
|
|
||||||
namespace SnapshotUtils
|
namespace SnapshotUtils
|
||||||
{
|
{
|
||||||
|
namespace NonLocalizable
|
||||||
|
{
|
||||||
|
const std::wstring ApplicationFrameHost = L"ApplicationFrameHost.exe";
|
||||||
|
}
|
||||||
|
|
||||||
class WbemHelper
|
class WbemHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -169,18 +174,37 @@ namespace SnapshotUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
// filter by app path
|
// filter by app path
|
||||||
std::wstring processPath = get_process_path_waiting_uwp(window);
|
std::wstring processPath = get_process_path(window);
|
||||||
if (processPath.empty() || WindowUtils::IsExcludedByDefault(window, processPath, title))
|
if (processPath.empty() || WindowUtils::IsExcludedByDefault(window, processPath, title))
|
||||||
{
|
{
|
||||||
|
Logger::debug(L"Excluded by default: {}, {}", title, processPath);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD pid{};
|
DWORD pid{};
|
||||||
GetWindowThreadProcessId(window, &pid);
|
GetWindowThreadProcessId(window, &pid);
|
||||||
|
|
||||||
|
// fix for the packaged apps that are not caught when minimized, e.g., Settings.
|
||||||
|
if (processPath.ends_with(NonLocalizable::ApplicationFrameHost))
|
||||||
|
{
|
||||||
|
for (auto otherWindow : windows)
|
||||||
|
{
|
||||||
|
DWORD otherPid{};
|
||||||
|
GetWindowThreadProcessId(otherWindow, &otherPid);
|
||||||
|
|
||||||
|
// searching for the window with the same title but different PID
|
||||||
|
if (pid != otherPid && title == WindowUtils::GetWindowTitle(otherWindow))
|
||||||
|
{
|
||||||
|
processPath = get_process_path(otherPid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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())
|
||||||
{
|
{
|
||||||
|
Logger::debug(L"Installed app not found: {}, {}", title, processPath);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,19 +31,6 @@ namespace WindowFilter
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!VirtualDesktop::instance().IsWindowOnCurrentDesktop(window))
|
if (!VirtualDesktop::instance().IsWindowOnCurrentDesktop(window))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user