From fa36852a58d8348c7a2b3cb33825a2cf57145685 Mon Sep 17 00:00:00 2001 From: Keith Bowes Date: Mon, 1 Jan 2024 21:49:58 -0500 Subject: [PATCH] Don't focus a toplevel if a layer is focused Previously, it would focus the toplevel and then focus would return to the layer, but now focusing the toplevel is skipped. --- waybox/xdg_shell.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/waybox/xdg_shell.c b/waybox/xdg_shell.c index 6a05d1d..9f8a855 100644 --- a/waybox/xdg_shell.c +++ b/waybox/xdg_shell.c @@ -41,10 +41,14 @@ void focus_toplevel(struct wb_toplevel *toplevel, struct wlr_surface *surface) { xdg_surface->toplevel->app_id); struct wb_server *server = toplevel->server; + if (server->seat->focused_layer != NULL) { + /* If a layer is focused, don't focus a toplevel. */ + return; + } struct wlr_seat *seat = server->seat->seat; struct wlr_surface *prev_surface = seat->keyboard_state.focused_surface; if (prev_surface == surface) { - /* Don't re-focus an already focused surface. */ + /* Don't focus a surface that's already focused. */ return; } if (prev_surface != NULL) { @@ -60,9 +64,7 @@ void focus_toplevel(struct wb_toplevel *toplevel, struct wlr_surface *surface) { } } /* Move the toplevel to the front */ - if (!server->seat->focused_layer) { - wlr_scene_node_raise_to_top(&toplevel->scene_tree->node); - } + wlr_scene_node_raise_to_top(&toplevel->scene_tree->node); wl_list_remove(&toplevel->link); wl_list_insert(&server->toplevels, &toplevel->link); /* Activate the new surface */