tokens: add more modes to initial_workspace_tracking
1 is single-shot, 2 is persistent fixes #5732
This commit is contained in:
parent
81bb4eb2f6
commit
608eff600d
4 changed files with 52 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue