workspace set active

This commit is contained in:
vaxerski 2022-05-25 10:25:36 +02:00
parent c8425926c9
commit 0ae6563fef
6 changed files with 15 additions and 7 deletions

View file

@ -743,7 +743,7 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
void CCompositor::deactivateAllWLRWorkspaces(wlr_ext_workspace_handle_v1* exclude) { void CCompositor::deactivateAllWLRWorkspaces(wlr_ext_workspace_handle_v1* exclude) {
for (auto& w : m_lWorkspaces) { for (auto& w : m_lWorkspaces) {
if (w.m_pWlrHandle && w.m_pWlrHandle != exclude) if (w.m_pWlrHandle && w.m_pWlrHandle != exclude)
wlr_ext_workspace_handle_v1_set_active(w.m_pWlrHandle, false); w.setActive(false);
} }
} }

View file

@ -115,7 +115,7 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
PNEWMONITOR->scale = monitorRule.scale; PNEWMONITOR->scale = monitorRule.scale;
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle); g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);
wlr_ext_workspace_handle_v1_set_active(PNEWWORKSPACE->m_pWlrHandle, true); PNEWWORKSPACE->setActive(true);
if (!pMostHzMonitor || monitorRule.refreshRate > pMostHzMonitor->refreshRate) if (!pMostHzMonitor || monitorRule.refreshRate > pMostHzMonitor->refreshRate)
pMostHzMonitor = PNEWMONITOR; pMostHzMonitor = PNEWMONITOR;

View file

@ -65,3 +65,9 @@ void CWorkspace::startAnim(bool in, bool left) {
} }
} }
} }
void CWorkspace::setActive(bool on) {
if (m_pWlrHandle) {
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, on);
}
}

View file

@ -24,4 +24,5 @@ public:
CAnimatedVariable m_fAlpha; CAnimatedVariable m_fAlpha;
void startAnim(bool in, bool left); void startAnim(bool in, bool left);
void setActive(bool on);
}; };

View file

@ -87,11 +87,12 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
g_pCompositor->m_pLastMonitor = PMONITOR; g_pCompositor->m_pLastMonitor = PMONITOR;
// set active workspace and deactivate all other in wlr // set active workspace and deactivate all other in wlr
g_pCompositor->deactivateAllWLRWorkspaces(g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace)->m_pWlrHandle); const auto ACTIVEWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
wlr_ext_workspace_handle_v1_set_active(g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace)->m_pWlrHandle, true); g_pCompositor->deactivateAllWLRWorkspaces(ACTIVEWORKSPACE->m_pWlrHandle);
ACTIVEWORKSPACE->setActive(true);
// event // event
g_pEventManager->postEvent(SHyprIPCEvent("activemon", PMONITOR->szName + "," + g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace)->m_szName)); g_pEventManager->postEvent(SHyprIPCEvent("activemon", PMONITOR->szName + "," + ACTIVEWORKSPACE->m_szName));
} }
Vector2D surfaceCoords; Vector2D surfaceCoords;

View file

@ -226,7 +226,7 @@ void CKeybindManager::changeworkspace(std::string args) {
// set active and deactivate all other in wlr // set active and deactivate all other in wlr
g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACETOCHANGETO->m_pWlrHandle); g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACETOCHANGETO->m_pWlrHandle);
wlr_ext_workspace_handle_v1_set_active(PWORKSPACETOCHANGETO->m_pWlrHandle, true); PWORKSPACETOCHANGETO->setActive(true);
Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo); Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo);
@ -271,7 +271,7 @@ void CKeybindManager::changeworkspace(std::string args) {
// set active and deactivate all other // set active and deactivate all other
g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACE->m_pWlrHandle); g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACE->m_pWlrHandle);
wlr_ext_workspace_handle_v1_set_active(PWORKSPACE->m_pWlrHandle, true); PWORKSPACE->setActive(true);
// mark the monitor dirty // mark the monitor dirty
g_pHyprRenderer->damageMonitor(PMONITOR); g_pHyprRenderer->damageMonitor(PMONITOR);