aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-09-15 18:24:03 +0100
committerVaxry <[email protected]>2024-09-15 18:24:03 +0100
commita9ba442628049e8d9ace28926683076896bef920 (patch)
tree2ffad912013886560342f18a7c0a7f37db5ac84a
parent793633ba4839018bc31f0d1ddf4b3de2039ead4f (diff)
downloadHyprland-a9ba442628049e8d9ace28926683076896bef920.tar.gz
Hyprland-a9ba442628049e8d9ace28926683076896bef920.zip
e
-rw-r--r--src/managers/PointerManager.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp
index 90652526..1115efa8 100644
--- a/src/managers/PointerManager.cpp
+++ b/src/managers/PointerManager.cpp
@@ -307,8 +307,6 @@ 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);
@@ -317,17 +315,6 @@ 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());
@@ -348,17 +335,34 @@ void CPointerManager::onCursorMoved() {
if (!hasCursor())
return;
+ const auto CURSORBOX = getCursorBoxGlobal();
+ bool recalc = false;
+
for (auto const& m : g_pCompositor->m_vMonitors) {
auto state = stateFor(m);
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
+ auto CROSSES = !m->logicalBox().intersection(CURSORBOX).empty();
+
+ if (!CROSSES && state->cursorFrontBuffer) {
+ Debug::log(TRACE, "onCursorMoved for output {}: cursor left the viewport, removing it from the backend", m->szName);
+ setHWCursorBuffer(state, nullptr);
+ continue;
+ } else if (CROSSES && !state->cursorFrontBuffer) {
+ Debug::log(TRACE, "onCursorMoved for output {}: cursor entered the output, but no front buffer, forcing recalc", m->szName);
+ recalc = true;
+ }
+
if (state->hardwareFailed || !state->entered)
continue;
const auto CURSORPOS = getCursorPosForMonitor(m);
m->output->moveCursor(CURSORPOS);
}
+
+ if (recalc)
+ updateCursorBackend();
}
bool CPointerManager::attemptHardwareCursor(SP<CPointerManager::SMonitorPointerState> state) {