From e0822926068e84b0fc391e0306f66ea0ec16cf47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 20 Jun 2022 18:33:14 -0500 Subject: [PATCH] do not focus clients if a layer surface is focused --- dwl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 6464289..65d7e24 100644 --- a/dwl.c +++ b/dwl.c @@ -299,6 +299,7 @@ static void zoom(const Arg *arg); /* variables */ static const char broken[] = "broken"; static pid_t child_pid = -1; +static struct wlr_surface *exclusive_focus; static struct wl_display *dpy; static struct wlr_backend *backend; static struct wlr_scene *scene; @@ -610,11 +611,12 @@ arrangelayers(Monitor *m) layersurface->layer_surface->mapped) { /* Deactivate the focused client. */ focusclient(NULL, 0); + exclusive_focus = layersurface->layer_surface->surface; if (kb) - wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, + wlr_seat_keyboard_notify_enter(seat, exclusive_focus, kb->keycodes, kb->num_keycodes, &kb->modifiers); else - wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, NULL, 0, NULL); + wlr_seat_keyboard_notify_enter(seat, exclusive_focus, NULL, 0, NULL); return; } } @@ -1125,6 +1127,9 @@ focusclient(Client *c, int lift) struct wlr_surface *old = seat->keyboard_state.focused_surface; struct wlr_keyboard *kb; int i; + /* Do not focus clients if a layer surface is focused */ + if (exclusive_focus) + return; /* Raise client in stacking order if requested */ if (c && lift) @@ -2261,6 +2266,8 @@ unmaplayersurfacenotify(struct wl_listener *listener, void *data) layersurface->layer_surface->mapped = (layersurface->mapped = 0); wlr_scene_node_set_enabled(layersurface->scene, 0); + if (layersurface->layer_surface->surface == exclusive_focus) + exclusive_focus = NULL; if (layersurface->layer_surface->surface == seat->keyboard_state.focused_surface) focusclient(selclient(), 1);