Skip to content

Commit

Permalink
do not focus clients if a layer surface is focused
Browse files Browse the repository at this point in the history
  • Loading branch information
sevz17 committed Jul 19, 2022
1 parent deb48ff commit e082292
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dwl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e082292

Please sign in to comment.