fix: chase hl on various pointer changes

1309b59f2c
efc51eb7d1
5f60fc7d00
This commit is contained in:
Virt 2025-03-18 19:09:13 +01:00
commit 9f40dc905e

View file

@ -6,6 +6,7 @@
#include <gbm.h> #include <gbm.h>
#include <hyprland/src/managers/eventLoop/EventLoopTimer.hpp> // required so we don't "unprivate" chrono #include <hyprland/src/managers/eventLoop/EventLoopTimer.hpp> // required so we don't "unprivate" chrono
#include <hyprutils/utils/ScopeGuard.hpp>
#define private public #define private public
#include <hyprland/src/managers/CursorManager.hpp> #include <hyprland/src/managers/CursorManager.hpp>
@ -201,8 +202,12 @@ SP<Aquamarine::IBuffer> CDynamicCursors::renderHardware(CPointerManager* pointer
if (!state->monitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size || state->monitor->cursorSwapchain->currentOptions().length != 3) { if (!state->monitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size || state->monitor->cursorSwapchain->currentOptions().length != 3) {
if (!state->monitor->cursorSwapchain) if (!state->monitor->cursorSwapchain) {
state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(state->monitor->output->getBackend()->preferredAllocator(), state->monitor->output->getBackend()); 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(); auto options = state->monitor->cursorSwapchain->currentOptions();
options.size = maxSize; options.size = maxSize;
@ -301,7 +306,10 @@ bool CDynamicCursors::setHardware(CPointerManager* pointers, SP<CPointerManager:
state->cursorFrontBuffer = buf; state->cursorFrontBuffer = 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; return true;
} }
@ -335,11 +343,18 @@ void CDynamicCursors::onCursorMoved(CPointerManager* pointers) {
recalc = true; recalc = true;
} }
if (state->hardwareFailed || !state->entered) if (!state->entered)
continue;
Hyprutils::Utils::CScopeGuard x([m] { m->onCursorMovedOnMonitor(); });
if (state->hardwareFailed)
continue; continue;
const auto CURSORPOS = pointers->getCursorPosForMonitor(m); const auto CURSORPOS = pointers->getCursorPosForMonitor(m);
m->output->moveCursor(CURSORPOS); m->output->moveCursor(CURSORPOS);
state->monitor->scanoutNeedsCursorUpdate = true;
} }
if (recalc) if (recalc)