mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 11:09:49 +01:00
workspaces: fixup workspaces not activating on workspace switch
This commit is contained in:
parent
3f2a18a435
commit
727160f0a4
2 changed files with 15 additions and 3 deletions
|
@ -477,9 +477,17 @@ float CMonitor::getDefaultScale() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal) {
|
void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal) {
|
||||||
if (!pWorkspace || pWorkspace->m_iID == activeWorkspace)
|
if (!pWorkspace)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (pWorkspace->m_iID == activeWorkspace) {
|
||||||
|
// in some cases (e.g. workspace from one monitor to another)
|
||||||
|
// we need to send this
|
||||||
|
g_pCompositor->deactivateAllWLRWorkspaces(pWorkspace->m_pWlrHandle);
|
||||||
|
pWorkspace->setActive(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pWorkspace->m_bIsSpecialWorkspace) {
|
if (pWorkspace->m_bIsSpecialWorkspace) {
|
||||||
Debug::log(ERR, "BUG THIS: Attempted to changeWorkspace to special!");
|
Debug::log(ERR, "BUG THIS: Attempted to changeWorkspace to special!");
|
||||||
return;
|
return;
|
||||||
|
@ -509,7 +517,7 @@ void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set some flags and fire event
|
// set some flags and fire event
|
||||||
g_pCompositor->deactivateAllWLRWorkspaces();
|
g_pCompositor->deactivateAllWLRWorkspaces(pWorkspace->m_pWlrHandle);
|
||||||
pWorkspace->setActive(true);
|
pWorkspace->setActive(true);
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"workspace", pWorkspace->m_szName});
|
g_pEventManager->postEvent(SHyprIPCEvent{"workspace", pWorkspace->m_szName});
|
||||||
EMIT_HOOK_EVENT("workspace", pWorkspace);
|
EMIT_HOOK_EVENT("workspace", pWorkspace);
|
||||||
|
|
|
@ -777,6 +777,8 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
if (!PMONITORWORKSPACEOWNER)
|
if (!PMONITORWORKSPACEOWNER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_pCompositor->setActiveMonitor(PMONITORWORKSPACEOWNER);
|
||||||
|
|
||||||
const auto PREVWSDATA = pWorkspaceToChangeTo->m_sPrevWorkspace;
|
const auto PREVWSDATA = pWorkspaceToChangeTo->m_sPrevWorkspace;
|
||||||
|
|
||||||
PMONITORWORKSPACEOWNER->changeWorkspace(pWorkspaceToChangeTo);
|
PMONITORWORKSPACEOWNER->changeWorkspace(pWorkspaceToChangeTo);
|
||||||
|
@ -810,11 +812,12 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
|
|
||||||
const auto PMONITORWORKSPACEOWNER = PMONITOR->ID == pWorkspaceToChangeTo->m_iMonitorID ? PMONITOR : g_pCompositor->getMonitorFromID(pWorkspaceToChangeTo->m_iMonitorID);
|
const auto PMONITORWORKSPACEOWNER = PMONITOR->ID == pWorkspaceToChangeTo->m_iMonitorID ? PMONITOR : g_pCompositor->getMonitorFromID(pWorkspaceToChangeTo->m_iMonitorID);
|
||||||
|
|
||||||
|
g_pCompositor->setActiveMonitor(PMONITORWORKSPACEOWNER);
|
||||||
|
|
||||||
PMONITORWORKSPACEOWNER->changeWorkspace(pWorkspaceToChangeTo);
|
PMONITORWORKSPACEOWNER->changeWorkspace(pWorkspaceToChangeTo);
|
||||||
g_pCompositor->warpCursorTo(PMONITORWORKSPACEOWNER->vecPosition + PMONITORWORKSPACEOWNER->vecSize / 2.f);
|
g_pCompositor->warpCursorTo(PMONITORWORKSPACEOWNER->vecPosition + PMONITORWORKSPACEOWNER->vecSize / 2.f);
|
||||||
|
|
||||||
if (PMONITOR != PMONITORWORKSPACEOWNER) {
|
if (PMONITOR != PMONITORWORKSPACEOWNER) {
|
||||||
g_pCompositor->setActiveMonitor(PMONITORWORKSPACEOWNER);
|
|
||||||
if (const auto PLASTWINDOW = pWorkspaceToChangeTo->getLastFocusedWindow(); PLASTWINDOW)
|
if (const auto PLASTWINDOW = pWorkspaceToChangeTo->getLastFocusedWindow(); PLASTWINDOW)
|
||||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||||
else
|
else
|
||||||
|
@ -869,6 +872,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||||
if (pWorkspace) {
|
if (pWorkspace) {
|
||||||
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
|
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
|
||||||
|
g_pCompositor->setActiveMonitor(PMONITOR);
|
||||||
PMONITOR->changeWorkspace(pWorkspace);
|
PMONITOR->changeWorkspace(pWorkspace);
|
||||||
} else {
|
} else {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||||
|
|
Loading…
Reference in a new issue