fix: rename windows while queued for creation
this avoids the window arriving with the wrong icon when its eventually able to be createdpull/2817/head
parent
512c6fb127
commit
bc7acbde5c
|
@ -424,6 +424,7 @@ void Workspaces::onWindowMoved(std::string const &payload) {
|
||||||
void Workspaces::onWindowTitleEvent(std::string const &payload) {
|
void Workspaces::onWindowTitleEvent(std::string const &payload) {
|
||||||
std::optional<std::function<void(WindowCreationPayload)>> inserter;
|
std::optional<std::function<void(WindowCreationPayload)>> inserter;
|
||||||
|
|
||||||
|
// If the window was an orphan, rename it at the orphan's vector
|
||||||
if (m_orphanWindowMap.contains(payload)) {
|
if (m_orphanWindowMap.contains(payload)) {
|
||||||
inserter = [this](WindowCreationPayload wcp) { this->registerOrphanWindow(std::move(wcp)); };
|
inserter = [this](WindowCreationPayload wcp) { this->registerOrphanWindow(std::move(wcp)); };
|
||||||
} else {
|
} else {
|
||||||
|
@ -431,10 +432,21 @@ void Workspaces::onWindowTitleEvent(std::string const &payload) {
|
||||||
std::find_if(m_workspaces.begin(), m_workspaces.end(),
|
std::find_if(m_workspaces.begin(), m_workspaces.end(),
|
||||||
[payload](auto &workspace) { return workspace->containsWindow(payload); });
|
[payload](auto &workspace) { return workspace->containsWindow(payload); });
|
||||||
|
|
||||||
|
// If the window exists on a workspace, rename it at the workspace's window
|
||||||
|
// map
|
||||||
if (windowWorkspace != m_workspaces.end()) {
|
if (windowWorkspace != m_workspaces.end()) {
|
||||||
inserter = [windowWorkspace](WindowCreationPayload wcp) {
|
inserter = [windowWorkspace](WindowCreationPayload wcp) {
|
||||||
(*windowWorkspace)->insertWindow(std::move(wcp));
|
(*windowWorkspace)->insertWindow(std::move(wcp));
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
auto queuedWindow = std::find_if(
|
||||||
|
m_windowsToCreate.begin(), m_windowsToCreate.end(),
|
||||||
|
[payload](auto &windowPayload) { return windowPayload.getAddress() == payload; });
|
||||||
|
|
||||||
|
// If the window was queued, rename it in the queue
|
||||||
|
if (queuedWindow != m_windowsToCreate.end()) {
|
||||||
|
inserter = [queuedWindow](WindowCreationPayload wcp) { *queuedWindow = std::move(wcp); };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue