mirror of
https://github.com/virtcode/hypr-dynamic-cursors
synced 2025-09-19 16:13:21 +02:00
fix: chase hl on various pointer changes
1309b59f2c
efc51eb7d1
5f60fc7d00
This commit is contained in:
parent
c6473ac2db
commit
9f40dc905e
1 changed files with 19 additions and 4 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue