From 9f40dc905e5b7e00f0c00956a5c2b007b26c50c2 Mon Sep 17 00:00:00 2001 From: Virt <41426325+VirtCode@users.noreply.github.com> Date: Tue, 18 Mar 2025 19:09:13 +0100 Subject: [PATCH] fix: chase hl on various pointer changes https://github.com/hyprwm/Hyprland/commit/1309b59f2cb5179a4c59c111c35c7feede535eb6 https://github.com/hyprwm/Hyprland/commit/efc51eb7d1ec8377425bb7b623b54831f2c18afc https://github.com/hyprwm/Hyprland/commit/5f60fc7d00eb08ee39cac1f5eceeb97ffbea0e7f --- src/cursor.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/cursor.cpp b/src/cursor.cpp index 80724a0..a997790 100644 --- a/src/cursor.cpp +++ b/src/cursor.cpp @@ -6,6 +6,7 @@ #include #include // required so we don't "unprivate" chrono +#include #define private public #include @@ -201,8 +202,12 @@ SP CDynamicCursors::renderHardware(CPointerManager* pointer if (!state->monitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size || state->monitor->cursorSwapchain->currentOptions().length != 3) { - if (!state->monitor->cursorSwapchain) - state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(state->monitor->output->getBackend()->preferredAllocator(), state->monitor->output->getBackend()); + if (!state->monitor->cursorSwapchain) { + auto backend = state->monitor->output->getBackend(); + auto primary = backend->getPrimary(); + + state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(state->monitor->output->getBackend()->preferredAllocator(), primary ? primary.lock() : backend); + } auto options = state->monitor->cursorSwapchain->currentOptions(); options.size = maxSize; @@ -301,7 +306,10 @@ bool CDynamicCursors::setHardware(CPointerManager* pointers, SPcursorFrontBuffer = buf; - g_pCompositor->scheduleFrameForMonitor(state->monitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE); + if (!state->monitor->shouldSkipScheduleFrameOnMouseEvent()) + g_pCompositor->scheduleFrameForMonitor(state->monitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE); + + state->monitor->scanoutNeedsCursorUpdate = true; return true; } @@ -335,11 +343,18 @@ void CDynamicCursors::onCursorMoved(CPointerManager* pointers) { recalc = true; } - if (state->hardwareFailed || !state->entered) + if (!state->entered) + continue; + + Hyprutils::Utils::CScopeGuard x([m] { m->onCursorMovedOnMonitor(); }); + + if (state->hardwareFailed) continue; const auto CURSORPOS = pointers->getCursorPosForMonitor(m); m->output->moveCursor(CURSORPOS); + + state->monitor->scanoutNeedsCursorUpdate = true; } if (recalc)