do not focus clients if a layer surface is focused

This commit is contained in:
Leonardo Hernández Hernández 2022-06-20 18:33:14 -05:00
parent deb48ff48b
commit e082292606
No known key found for this signature in database
GPG key ID: E538897EE11B9624

11
dwl.c
View file

@ -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);