]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/cursor.c: fix invisible cursor on output loss / restore
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 27 Mar 2023 22:58:42 +0000 (00:58 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 29 Mar 2023 20:39:11 +0000 (21:39 +0100)
Previously, the cursor image was only updated on output loss when the
cursor was on a labwc owned surface. This patch forces a re-enter of a
client surface in the remaining case of cursor being over a non-labwc
surface which causes the client to re-set its own cursor image.

This fixes a regression caused by 4dc99e2f3856650f3b61778f015a823cfae978d2.
Thanks to @Flrian for finding the root cause of the issue.

Fixes #820

Reported-by: @Flrian
Tested-by: @Flrian
src/cursor.c

index 2255a5ec3760f2de7f7c3c97ba2bab6312d7863b..2ce8e293db29eca8ccd299e73327f6672f4aea03 100644 (file)
@@ -260,6 +260,16 @@ cursor_update_image(struct seat *seat)
 {
        enum lab_cursors cursor = seat->server_cursor;
        if (cursor == LAB_CURSOR_CLIENT) {
+               /*
+                * When we loose the output cursor while over a client
+                * surface (e.g. output was destroyed and we now deal with
+                * a new output instance), we have to force a re-enter of
+                * the surface so the client sets its own cursor again.
+                */
+               if (seat->seat->pointer_state.focused_surface) {
+                       seat->server_cursor = LAB_CURSOR_DEFAULT;
+                       cursor_update_focus(seat->server);
+               }
                return;
        }
        wlr_xcursor_manager_set_cursor_image(