mirror of
https://github.com/swaywm/sway.git
synced 2026-04-25 06:46:24 -04:00
layer-shell: implement on-demand keyboard interactivity
This commit is contained in:
parent
241ce2af83
commit
140321577e
2 changed files with 9 additions and 3 deletions
|
|
@ -211,7 +211,8 @@ void arrange_layers(struct sway_output *output) {
|
|||
for (size_t i = 0; i < nlayers; ++i) {
|
||||
wl_list_for_each_reverse(layer,
|
||||
&output->layers[layers_above_shell[i]], link) {
|
||||
if (layer->layer_surface->current.keyboard_interactive &&
|
||||
if (layer->layer_surface->current.keyboard_interactive ==
|
||||
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE &&
|
||||
layer->layer_surface->mapped) {
|
||||
topmost = layer;
|
||||
break;
|
||||
|
|
@ -227,7 +228,8 @@ void arrange_layers(struct sway_output *output) {
|
|||
if (topmost != NULL) {
|
||||
seat_set_focus_layer(seat, topmost->layer_surface);
|
||||
} else if (seat->focused_layer &&
|
||||
!seat->focused_layer->current.keyboard_interactive) {
|
||||
seat->focused_layer->current.keyboard_interactive !=
|
||||
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) {
|
||||
seat_set_focus_layer(seat, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,8 +365,12 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
|
|||
if (surface && wlr_surface_is_layer_surface(surface)) {
|
||||
struct wlr_layer_surface_v1 *layer =
|
||||
wlr_layer_surface_v1_from_wlr_surface(surface);
|
||||
if (layer->current.keyboard_interactive) {
|
||||
if (layer->current.keyboard_interactive ==
|
||||
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) {
|
||||
seat_set_focus_layer(seat, layer);
|
||||
} else if (layer->current.keyboard_interactive ==
|
||||
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) {
|
||||
seat_set_focus_surface(seat, surface, true);
|
||||
}
|
||||
seat_pointer_notify_button(seat, time_msec, button, state);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue