diff --git a/hyprpm.toml b/hyprpm.toml index 5840fbd..8ae67c2 100644 --- a/hyprpm.toml +++ b/hyprpm.toml @@ -14,9 +14,6 @@ commit_pins = [ ["788ae588979c2a1ff8a660f16e3c502ef5796755", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.0 ["254fc2bc6000075f660b4b8ed818a6af544d1d64", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.1 ["0bd541f2fd902dbfa04c3ea2ccf679395e316887", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.2 - ["04ac46c54357278fc68f0a95d26347ea0db99496", "261bc1668f7de45b48ba6a40d5d727025575390b"], # v0.47.0 - ["75dff7205f6d2bd437abfb4196f700abee92581a", "261bc1668f7de45b48ba6a40d5d727025575390b"], # v0.47.1 - ["882f7ad7d2bbfc7440d0ccaef93b1cdd78e8e3ff", "261bc1668f7de45b48ba6a40d5d727025575390b"], # v0.47.2 ] [dynamic-cursors] diff --git a/src/cursor.cpp b/src/cursor.cpp index a997790..1ccefcb 100644 --- a/src/cursor.cpp +++ b/src/cursor.cpp @@ -6,7 +6,6 @@ #include #include // required so we don't "unprivate" chrono -#include #define private public #include @@ -128,6 +127,8 @@ void CDynamicCursors::renderSoftware(CPointerManager* pointers, SP pMo CCursorPassElement::SRenderData data; data.tex = texture; data.box = box; + data.syncTimeline = pointers->currentCursorImage.waitTimeline; + data.syncPoint = pointers->currentCursorImage.waitPoint; data.hotspot = pointers->currentCursorImage.hotspot * state->monitor->scale * zoom; data.nearest = nearest; data.stretchAngle = resultShown.stretch.angle; @@ -202,12 +203,8 @@ 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) { - 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); - } + if (!state->monitor->cursorSwapchain) + state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(state->monitor->output->getBackend()->preferredAllocator(), state->monitor->output->getBackend()); auto options = state->monitor->cursorSwapchain->currentOptions(); options.size = maxSize; @@ -268,7 +265,7 @@ SP CDynamicCursors::renderHardware(CPointerManager* pointer xbox.rot = resultShown.rotation; // use our custom draw function - renderCursorTextureInternalWithDamage(texture, &xbox, damage, 1.F, pointers->currentCursorImage.hotspot * state->monitor->scale * zoom, zoom > 1 && **PNEAREST, resultShown.stretch.angle, resultShown.stretch.magnitude); + renderCursorTextureInternalWithDamage(texture, &xbox, damage, 1.F, pointers->currentCursorImage.waitTimeline, pointers->currentCursorImage.waitPoint, pointers->currentCursorImage.hotspot * state->monitor->scale * zoom, zoom > 1 && **PNEAREST, resultShown.stretch.angle, resultShown.stretch.magnitude); g_pHyprOpenGL->end(); glFlush(); @@ -306,10 +303,7 @@ bool CDynamicCursors::setHardware(CPointerManager* pointers, SPcursorFrontBuffer = buf; - if (!state->monitor->shouldSkipScheduleFrameOnMouseEvent()) - g_pCompositor->scheduleFrameForMonitor(state->monitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE); - - state->monitor->scanoutNeedsCursorUpdate = true; + g_pCompositor->scheduleFrameForMonitor(state->monitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE); return true; } @@ -343,18 +337,11 @@ void CDynamicCursors::onCursorMoved(CPointerManager* pointers) { recalc = true; } - if (!state->entered) - continue; - - Hyprutils::Utils::CScopeGuard x([m] { m->onCursorMovedOnMonitor(); }); - - if (state->hardwareFailed) + if (state->hardwareFailed || !state->entered) continue; const auto CURSORPOS = pointers->getCursorPosForMonitor(m); m->output->moveCursor(CURSORPOS); - - state->monitor->scanoutNeedsCursorUpdate = true; } if (recalc) diff --git a/src/render/CursorPassElement.cpp b/src/render/CursorPassElement.cpp index 1c2f74f..e4292dc 100644 --- a/src/render/CursorPassElement.cpp +++ b/src/render/CursorPassElement.cpp @@ -17,6 +17,8 @@ void CCursorPassElement::draw(const CRegion& damage) { &data.box, data.damage.empty() ? damage : data.damage, 1.F, + data.syncTimeline, + data.syncPoint, data.hotspot, data.nearest, data.stretchAngle, diff --git a/src/render/CursorPassElement.hpp b/src/render/CursorPassElement.hpp index 855037d..a5d50a2 100644 --- a/src/render/CursorPassElement.hpp +++ b/src/render/CursorPassElement.hpp @@ -13,6 +13,8 @@ class CCursorPassElement : public IPassElement { SP tex; CBox box; CRegion damage; + SP syncTimeline; + int64_t syncPoint = 0; Vector2D hotspot; bool nearest; diff --git a/src/render/renderer.cpp b/src/render/renderer.cpp index cd4f78d..2389d30 100644 --- a/src/render/renderer.cpp +++ b/src/render/renderer.cpp @@ -52,9 +52,16 @@ Mat3x3 projectCursorBox(CBox& box, eTransform transform, float rotation, const M /* This renders a texture with damage but rotates the texture around a given hotspot. */ -void renderCursorTextureInternalWithDamage(SP tex, CBox* pBox, const CRegion& damage, float alpha, Vector2D hotspot, bool nearest, float stretchAngle, Vector2D stretch) { +void renderCursorTextureInternalWithDamage(SP tex, CBox* pBox, const CRegion& damage, float alpha, SP waitTimeline, uint64_t waitPoint, Vector2D hotspot, bool nearest, float stretchAngle, Vector2D stretch) { TRACY_GPU_ZONE("RenderDynamicCursor"); + if (waitTimeline != nullptr) { + if (!g_pHyprOpenGL->waitForTimelinePoint(waitTimeline, waitPoint)) { + Debug::log(ERR, "renderTextureInternalWithDamage: failed to wait for explicit sync point {}", waitPoint); + return; + } + } + alpha = std::clamp(alpha, 0.f, 1.f); if (damage.empty()) diff --git a/src/render/renderer.hpp b/src/render/renderer.hpp index be60d6b..d265d15 100644 --- a/src/render/renderer.hpp +++ b/src/render/renderer.hpp @@ -1,4 +1,4 @@ #include #include -void renderCursorTextureInternalWithDamage(SP tex, CBox* pBox, const CRegion& damage, float alpha, Vector2D hotspot, bool nearest, float stretchAngle, Vector2D stretch); +void renderCursorTextureInternalWithDamage(SP tex, CBox* pBox, const CRegion& damage, float alpha, SP waitTimeline, uint64_t waitPoint, Vector2D hotspot, bool nearest, float stretchAngle, Vector2D stretch);