aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-09-15 18:20:30 +0100
committerVaxry <[email protected]>2024-09-15 18:20:30 +0100
commit793633ba4839018bc31f0d1ddf4b3de2039ead4f (patch)
tree8ca0c9080fd41ee68175e36ac92e29fa3fa35812
parent4dbdb556fe441506ec5cf129c65b14e514dbcc5a (diff)
downloadHyprland-793633ba4839018bc31f0d1ddf4b3de2039ead4f.tar.gz
Hyprland-793633ba4839018bc31f0d1ddf4b3de2039ead4f.zip
hide cursor on leave
-rw-r--r--src/managers/PointerManager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp
index 6b2a40f5..90652526 100644
--- a/src/managers/PointerManager.cpp
+++ b/src/managers/PointerManager.cpp
@@ -307,6 +307,8 @@ void CPointerManager::resetCursorImage(bool apply) {
void CPointerManager::updateCursorBackend() {
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
+ const auto CURSORBOX = getCursorBoxGlobal();
+
for (auto const& m : g_pCompositor->m_vMonitors) {
auto state = stateFor(m);
@@ -315,6 +317,17 @@ void CPointerManager::updateCursorBackend() {
continue;
}
+ auto CROSSES = !m->logicalBox().intersection(CURSORBOX).empty();
+
+ if (!CROSSES) {
+ if (state->cursorFrontBuffer) {
+ Debug::log(TRACE, "Output {}: cursor left the viewport, removing it from the backend", m->szName);
+ setHWCursorBuffer(state, nullptr);
+ }
+
+ continue;
+ }
+
if (state->softwareLocks > 0 || *PNOHW || !attemptHardwareCursor(state)) {
Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->szName);
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());