fix placing windows of the same app in the project

This commit is contained in:
seraphima
2024-06-20 12:54:47 +02:00
parent 1e28cb8c40
commit 5f42c6ef66
2 changed files with 3 additions and 8 deletions

View File

@@ -235,14 +235,14 @@ void Launch(const Project& project)
{
// Get the set of windows before launching the app
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();
for (const auto& app : project.apps)
{
if (Launch(app))
{
launchedWindows.insert({ app, nullptr });
launchedWindows.push_back({ app, nullptr });
}
}
@@ -263,7 +263,7 @@ void Launch(const Project& project)
}
// 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())
{
res->second = window;

View File

@@ -33,11 +33,6 @@ struct Project
bool isMaximized{};
Position position{};
int monitor{};
bool operator<(const Application& rhs) const noexcept
{
return path < rhs.path;
}
};
struct Monitor