From 9c271d792d32030525c4d4c39715640aa10725d2 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Tue, 30 Aug 2022 20:10:21 +0200 Subject: [PATCH] src/xwayland-unmanaged.c: Give keyboard focus back to topmost mapped view Previously, when unmapping and not finding another unmanaged surface to give keyboard focus to we were not doing anything. With this patch we will give focus to the topmost mapped view which is the same behavior that also happens when an usual X11 surface unmaps. This fixes dmenu when being exited with ESC. Reported-by: @Flrian --- src/xwayland-unmanaged.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xwayland-unmanaged.c b/src/xwayland-unmanaged.c index 64a83cca..56befc90 100644 --- a/src/xwayland-unmanaged.c +++ b/src/xwayland-unmanaged.c @@ -88,6 +88,12 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data) return; } } + /* + * If we don't find a surface to focus fall back + * to the topmost mapped view. This fixes dmenu + * not giving focus back when closed with ESC. + */ + desktop_focus_topmost_mapped_view(unmanaged->server); } static void