Skip to content

Commit 0b264db

Browse files
author
ookami
committed
Fix cursor events on lock/unlock
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.
1 parent 96db66a commit 0b264db

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sway/lock.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,19 @@ static void refocus_output(struct sway_session_lock_output *output) {
5959
}
6060
}
6161

62-
static void handle_surface_map(struct wl_listener *listener, void *data) {
62+
static void update_focus(void *data) {
63+
struct wl_listener *listener = data;
6364
struct sway_session_lock_output *surf = wl_container_of(listener, surf, surface_map);
6465
if (surf->lock->focused == NULL) {
6566
focus_surface(surf->lock, surf->surface->surface);
6667
}
6768
cursor_rebase_all();
6869
}
6970

71+
static void handle_surface_map(struct wl_listener *listener, void *data) {
72+
wl_event_loop_add_idle(server.wl_event_loop, update_focus, listener);
73+
}
74+
7075
static void handle_surface_destroy(struct wl_listener *listener, void *data) {
7176
struct sway_session_lock_output *output =
7277
wl_container_of(listener, output, surface_destroy);
@@ -234,6 +239,7 @@ static void handle_unlock(struct wl_listener *listener, void *data) {
234239
struct sway_output *output = root->outputs->items[i];
235240
arrange_layers(output);
236241
}
242+
cursor_rebase_all();
237243
}
238244

239245
static void handle_abandon(struct wl_listener *listener, void *data) {

0 commit comments

Comments
 (0)