summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-06-20 18:33:14 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-07-19 12:24:24 -0500
commite0822926068e84b0fc391e0306f66ea0ec16cf47 (patch)
tree66c8968fc9b4a95d0cc659f6ebe951eaefd95d79
parentdeb48ff48b186ff77a7e9d3b3ab724ff4c3c340f (diff)
do not focus clients if a layer surface is focused
-rw-r--r--dwl.c11
1 files 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);