Refactor window platform helper functions

This commit is contained in:
WarmUpTill
2026-05-18 19:35:41 +02:00
parent ee1d0136d9
commit 930e8b38d4
10 changed files with 388 additions and 470 deletions

View File

@@ -42,19 +42,20 @@ void CloseWindow(const std::string &) {}
std::optional<std::string> MacroActionWindow::GetMatchingWindow() const
{
const auto windowList = GetWindowList();
const auto windows = GetWindows();
if (!_regex.Enabled()) {
if (std::find(windowList.begin(), windowList.end(),
std::string(_window)) == windowList.end()) {
return {};
for (const auto &info : windows) {
if (info.title == std::string(_window)) {
return info.title;
}
}
return _window;
return {};
}
for (const auto &window : windowList) {
if (_regex.Matches(window, _window)) {
return window;
for (const auto &info : windows) {
if (_regex.Matches(info.title, _window)) {
return info.title;
}
}