diff options
-rw-r--r-- | src/managers/PointerManager.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index ff61cb54..ae90349b 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -51,22 +51,22 @@ void CPointerManager::unlockSoftwareAll() { updateCursorBackend(); } -void CPointerManager::lockSoftwareForMonitor(PHLMONITOR Monitor) { - for (auto const& m : g_pCompositor->m_vMonitors) { - if (m->ID == Monitor->ID) { - lockSoftwareForMonitor(m); - return; - } - } +void CPointerManager::lockSoftwareForMonitor(PHLMONITOR mon) { + auto state = stateFor(mon); + state->softwareLocks++; + + if (state->softwareLocks == 1) + updateCursorBackend(); } -void CPointerManager::unlockSoftwareForMonitor(PHLMONITOR Monitor) { - for (auto const& m : g_pCompositor->m_vMonitors) { - if (m->ID == Monitor->ID) { - unlockSoftwareForMonitor(m); - return; - } - } +void CPointerManager::unlockSoftwareForMonitor(PHLMONITOR mon) { + auto state = stateFor(mon); + state->softwareLocks--; + if (state->softwareLocks < 0) + state->softwareLocks = 0; + + if (state->softwareLocks == 0) + updateCursorBackend(); } bool CPointerManager::softwareLockedFor(SP<CMonitor> mon) { |