From a89ff5da581c70a912cdb66d8bf414ad995fb8d3 Mon Sep 17 00:00:00 2001 From: Virt <41426325+VirtCode@users.noreply.github.com> Date: Mon, 22 Jul 2024 20:03:57 +0200 Subject: [PATCH] fix: rollback swapchain like hl close #14 --- src/cursor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cursor.cpp b/src/cursor.cpp index 1dddc5f..4c28ca8 100644 --- a/src/cursor.cpp +++ b/src/cursor.cpp @@ -176,6 +176,15 @@ SP CDynamicCursors::renderHardware(CPointerManager* pointer } } + // if we already rendered the cursor, revert the swapchain to avoid rendering the cursor over + // the current front buffer + // this flag will be reset in the preRender hook, so when we commit this buffer to KMS + // see https://github.com/hyprwm/Hyprland/commit/4c3b03516209a49244a8f044143c1162752b8a7a + if (state->cursorRendered) + state->monitor->cursorSwapchain->rollback(); + + state->cursorRendered = true; + auto buf = state->monitor->cursorSwapchain->next(nullptr); if (!buf) { Debug::log(TRACE, "Failed to acquire a buffer from the cursor swapchain");