Skip to content

Commit

Permalink
Fix cursor events on lock/unlock
Browse files Browse the repository at this point in the history
See labwc/labwc#1858

Delay refocus operations because only the role-specific surface
commit/map handler has been processed in wlroots at this moment and
node_at_coords returns the WLR_SCENE_NODE_RECT as a buffer has not
been actually attached to the surface.
  • Loading branch information
ookami committed Nov 13, 2024
1 parent fdc4318 commit 8eed156
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sway/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,19 @@ static void refocus_output(struct sway_session_lock_output *output) {
}
}

static void handle_surface_map(struct wl_listener *listener, void *data) {
static void update_focus(void *data) {
struct wl_listener *listener = data;
struct sway_session_lock_output *surf = wl_container_of(listener, surf, surface_map);
if (surf->lock->focused == NULL) {
focus_surface(surf->lock, surf->surface->surface);
}
cursor_rebase_all();
}

static void handle_surface_map(struct wl_listener *listener, void *data) {
wl_event_loop_add_idle(server.wl_event_loop, update_focus, listener);
}

static void handle_surface_destroy(struct wl_listener *listener, void *data) {
struct sway_session_lock_output *output =
wl_container_of(listener, output, surface_destroy);
Expand Down Expand Up @@ -234,6 +239,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) {
Expand Down

0 comments on commit 8eed156

Please sign in to comment.