From 8ae2b1b9a811fe1589238066e357c713cdf5ebab Mon Sep 17 00:00:00 2001 From: ookami Date: Sun, 6 Oct 2024 13:39:26 +0800 Subject: [PATCH] Fix cursor events on screen lock/unlock After the scene graph refactor, node_at_coords no longer return the lock surface after the screen is locked, thereby cursor_rebase_all in handle_surface_map won't work. This commit make node_at_coords return lock surface when locked. I also found that the cursor would disappear after screen is unlocked, thereby adding a cursor_rebase_all in handle_unlock. --- sway/input/cursor.c | 5 +++++ sway/lock.c | 1 + 2 files changed, 6 insertions(+) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index bbd16717ff..624c522b6b 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -63,6 +63,11 @@ struct sway_node *node_at_coords( } } + if (server.session_lock.lock) { + *surface = server.session_lock.lock->focused; + return NULL; + } + if (scene_node) { // determine what wlr_surface we clicked on if (scene_node->type == WLR_SCENE_NODE_BUFFER) { diff --git a/sway/lock.c b/sway/lock.c index 43f3133088..10d055aa0a 100644 --- a/sway/lock.c +++ b/sway/lock.c @@ -234,6 +234,7 @@ static void handle_unlock(struct wl_listener *listener, void *data) { struct sway_output *output = root->outputs->items[i]; arrange_layers(output); } + cursor_rebase_all(); } static void handle_abandon(struct wl_listener *listener, void *data) {