diff options
author | Vaxry <[email protected]> | 2024-10-19 18:46:55 +0100 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-10-19 18:46:55 +0100 |
commit | a14c39cbe2eb7c039b670a0c0d0819b532b26539 (patch) | |
tree | e05ff92eea35a4e9f313a22ccc1956e84ccab893 | |
parent | 66bf966bbf7b3e78ff4b8a2ca1eb6e9f89ba8686 (diff) | |
download | Hyprland-a14c39cbe2eb7c039b670a0c0d0819b532b26539.tar.gz Hyprland-a14c39cbe2eb7c039b670a0c0d0819b532b26539.zip |
-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) { |