From f46e656da94cd309e5cbb7ffe7286a8ca73433d1 Mon Sep 17 00:00:00 2001 From: Ben Jargowsky Date: Sun, 5 Jun 2022 15:58:54 +0200 Subject: [PATCH] Free pointer focus for seat at end of destroylayersurfacenotify --- dwl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dwl.c b/dwl.c index f061ebe..5c00fc0 100644 --- a/dwl.c +++ b/dwl.c @@ -1040,6 +1040,11 @@ destroylayersurfacenotify(struct wl_listener *listener, void *data) { LayerSurface *layersurface = wl_container_of(listener, layersurface, destroy); + /* Check if focused_surface saved in the seat pointer_state is the same wlr_surface + * corresponding to this one being destroyed. Clear pointer focus if it is. */ + if (seat->pointer_state.focused_surface == layersurface->layer_surface->surface) + wlr_seat_pointer_notify_clear_focus(seat); + if (layersurface->layer_surface->mapped) unmaplayersurface(layersurface); wl_list_remove(&layersurface->link);