mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-09-07 11:44:43 +00:00
add support for layer-shell on-demand keyboard interactivity
This commit is contained in:
parent
15bfffd87a
commit
f2c09f9b11
24
dwl.c
24
dwl.c
@ -592,7 +592,7 @@ arrangelayers(Monitor *m)
|
||||
/* Find topmost keyboard interactive layer, if such a layer exists */
|
||||
for (i = 0; i < (int)LENGTH(layers_above_shell); i++) {
|
||||
wl_list_for_each_reverse(l, &m->layers[layers_above_shell[i]], link) {
|
||||
if (locked || !l->layer_surface->current.keyboard_interactive || !l->mapped)
|
||||
if (locked || l->layer_surface->current.keyboard_interactive != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE || !l->mapped)
|
||||
continue;
|
||||
/* Deactivate the focused client. */
|
||||
focusclient(NULL, 0);
|
||||
@ -625,6 +625,8 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
struct wlr_keyboard *keyboard;
|
||||
uint32_t mods;
|
||||
Client *c;
|
||||
LayerSurface *l;
|
||||
struct wlr_surface *surface;
|
||||
const Button *b;
|
||||
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
@ -637,9 +639,16 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
break;
|
||||
|
||||
/* Change focus if the button was _pressed_ over a client */
|
||||
xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL);
|
||||
if (c && (!client_is_unmanaged(c) || client_wants_focus(c)))
|
||||
focusclient(c, 1);
|
||||
xytonode(cursor->x, cursor->y, &surface, NULL, NULL, NULL, NULL);
|
||||
if (toplevel_from_wlr_surface(surface, &c, &l) >= 0) {
|
||||
if (c && (!client_is_unmanaged(c) || client_wants_focus(c)))
|
||||
focusclient(c, 1);
|
||||
|
||||
if (l && l->layer_surface->current.keyboard_interactive) {
|
||||
focusclient(NULL, 0);
|
||||
client_notify_enter(l->layer_surface->surface, wlr_seat_get_keyboard(seat));
|
||||
}
|
||||
}
|
||||
|
||||
keyboard = wlr_seat_get_keyboard(seat);
|
||||
mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
|
||||
@ -837,6 +846,11 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (layer_surface == exclusive_focus
|
||||
&& layer_surface->current.keyboard_interactive !=
|
||||
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
||||
exclusive_focus = NULL;
|
||||
|
||||
if (layer_surface->current.committed == 0 && l->mapped == layer_surface->surface->mapped)
|
||||
return;
|
||||
l->mapped = layer_surface->surface->mapped;
|
||||
@ -2558,7 +2572,7 @@ setup(void)
|
||||
wl_signal_add(&xdg_shell->events.new_toplevel, &new_xdg_toplevel);
|
||||
wl_signal_add(&xdg_shell->events.new_popup, &new_xdg_popup);
|
||||
|
||||
layer_shell = wlr_layer_shell_v1_create(dpy, 3);
|
||||
layer_shell = wlr_layer_shell_v1_create(dpy, 4);
|
||||
wl_signal_add(&layer_shell->events.new_surface, &new_layer_surface);
|
||||
|
||||
idle_notifier = wlr_idle_notifier_v1_create(dpy);
|
||||
|
Loading…
x
Reference in New Issue
Block a user