mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
fix placing windows of the same app in the project
This commit is contained in:
@@ -235,14 +235,14 @@ void Launch(const Project& project)
|
|||||||
{
|
{
|
||||||
// Get the set of windows before launching the app
|
// Get the set of windows before launching the app
|
||||||
std::vector<HWND> windowsBefore = WindowEnumerator::Enumerate(WindowFilter::Filter);
|
std::vector<HWND> windowsBefore = WindowEnumerator::Enumerate(WindowFilter::Filter);
|
||||||
std::map<Project::Application, HWND> launchedWindows{};
|
std::vector<std::pair<Project::Application, HWND>> launchedWindows{};
|
||||||
auto apps = Utils::Apps::GetAppsList();
|
auto apps = Utils::Apps::GetAppsList();
|
||||||
|
|
||||||
for (const auto& app : project.apps)
|
for (const auto& app : project.apps)
|
||||||
{
|
{
|
||||||
if (Launch(app))
|
if (Launch(app))
|
||||||
{
|
{
|
||||||
launchedWindows.insert({ app, nullptr });
|
launchedWindows.push_back({ app, nullptr });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ void Launch(const Project& project)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the window
|
// set the window
|
||||||
auto res = std::find_if(launchedWindows.begin(), launchedWindows.end(), [&](const std::pair<Project::Application, HWND>& val) { return val.first.name == app->name; });
|
auto res = std::find_if(launchedWindows.begin(), launchedWindows.end(), [&](const std::pair<Project::Application, HWND>& val) { return val.first.name == app->name && val.second == nullptr; });
|
||||||
if (res != launchedWindows.end())
|
if (res != launchedWindows.end())
|
||||||
{
|
{
|
||||||
res->second = window;
|
res->second = window;
|
||||||
|
|||||||
@@ -33,11 +33,6 @@ struct Project
|
|||||||
bool isMaximized{};
|
bool isMaximized{};
|
||||||
Position position{};
|
Position position{};
|
||||||
int monitor{};
|
int monitor{};
|
||||||
|
|
||||||
bool operator<(const Application& rhs) const noexcept
|
|
||||||
{
|
|
||||||
return path < rhs.path;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Monitor
|
struct Monitor
|
||||||
|
|||||||
Reference in New Issue
Block a user