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) {
for (auto& w : m_lWorkspaces) {
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;
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)
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;
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;
// set active workspace and deactivate all other in wlr
g_pCompositor->deactivateAllWLRWorkspaces(g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace)->m_pWlrHandle);
wlr_ext_workspace_handle_v1_set_active(g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace)->m_pWlrHandle, true);
const auto ACTIVEWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
g_pCompositor->deactivateAllWLRWorkspaces(ACTIVEWORKSPACE->m_pWlrHandle);
ACTIVEWORKSPACE->setActive(true);
// 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;

View file

@ -226,7 +226,7 @@ void CKeybindManager::changeworkspace(std::string args) {
// set active and deactivate all other in wlr
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);
@ -271,7 +271,7 @@ void CKeybindManager::changeworkspace(std::string args) {
// set active and deactivate all other
g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACE->m_pWlrHandle);
wlr_ext_workspace_handle_v1_set_active(PWORKSPACE->m_pWlrHandle, true);
PWORKSPACE->setActive(true);
// mark the monitor dirty
g_pHyprRenderer->damageMonitor(PMONITOR);