diff options
| author | Vaxry <vaxry@vaxry.net> | 2024-04-24 16:16:46 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2024-04-24 16:16:52 +0100 |
| commit | 608eff600d31879519aa64b795b45709ebfac267 (patch) | |
| tree | 10279d23e8c41e29ca91f91c83b386bb3cb2abca /src/events/Windows.cpp | |
| parent | 81bb4eb2f6e385431dab0ae664bb59f35c8c069e (diff) | |
tokens: add more modes to initial_workspace_tracking
1 is single-shot, 2 is persistent
fixes #5732
Diffstat (limited to 'src/events/Windows.cpp')
| -rw-r--r-- | src/events/Windows.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index b02d63a7..2d1e1384 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -81,14 +81,25 @@ void Events::listener_mapWindow(void* owner, void* data) { const auto TOKEN = g_pTokenManager->getToken(SZTOKEN); if (TOKEN) { // find workspace and use it - std::string WS = std::any_cast<std::string>(TOKEN->data); + SInitialWorkspaceToken WS = std::any_cast<SInitialWorkspaceToken>(TOKEN->data); - Debug::log(LOG, "HL_INITIAL_WORKSPACE_TOKEN {} -> {}", SZTOKEN, WS); + Debug::log(LOG, "HL_INITIAL_WORKSPACE_TOKEN {} -> {}", SZTOKEN, WS.workspace); - if (g_pCompositor->getWorkspaceByString(WS) != PWINDOW->m_pWorkspace) { - requestedWorkspace = WS; + if (g_pCompositor->getWorkspaceByString(WS.workspace) != PWINDOW->m_pWorkspace) { + requestedWorkspace = WS.workspace; workspaceSilent = true; } + + if (*PINITIALWSTRACKING == 1) // one-shot token + g_pTokenManager->removeToken(TOKEN); + else if (*PINITIALWSTRACKING == 2) { // persistent + if (!WS.primaryOwner) { + WS.primaryOwner = PWINDOW; + TOKEN->data = WS; + } + + PWINDOW->m_szInitialWorkspaceToken = SZTOKEN; + } } } } |
