mirror of
https://github.com/swaywm/sway.git
synced 2026-04-18 06:46:56 -04:00
seat: Drop has_exclusive_layer
We can just check if the current focused layer has exclusive input.
This commit is contained in:
parent
5e18ed3cf0
commit
1800b1266b
2 changed files with 5 additions and 10 deletions
|
|
@ -99,8 +99,6 @@ struct sway_seat {
|
||||||
char *prev_workspace_name; // for workspace back_and_forth
|
char *prev_workspace_name; // for workspace back_and_forth
|
||||||
|
|
||||||
struct wlr_layer_surface_v1 *focused_layer;
|
struct wlr_layer_surface_v1 *focused_layer;
|
||||||
// If the exclusive layer is set, views cannot receive keyboard focus
|
|
||||||
bool has_exclusive_layer;
|
|
||||||
|
|
||||||
// Last touch point
|
// Last touch point
|
||||||
int32_t touch_id;
|
int32_t touch_id;
|
||||||
|
|
|
||||||
|
|
@ -1255,13 +1255,15 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
|
||||||
}
|
}
|
||||||
|
|
||||||
void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
|
void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
|
||||||
|
struct wlr_layer_surface_v1 *layer = seat->focused_layer;
|
||||||
|
|
||||||
// Prevents the layer from losing focus if it has keyboard exclusivity
|
// Prevents the layer from losing focus if it has keyboard exclusivity
|
||||||
if (seat->has_exclusive_layer) {
|
if (layer && layer->current.keyboard_interactive ==
|
||||||
struct wlr_layer_surface_v1 *layer = seat->focused_layer;
|
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) {
|
||||||
seat_set_focus_layer(seat, NULL);
|
seat_set_focus_layer(seat, NULL);
|
||||||
seat_set_workspace_focus(seat, node);
|
seat_set_workspace_focus(seat, node);
|
||||||
seat_set_focus_layer(seat, layer);
|
seat_set_focus_layer(seat, layer);
|
||||||
} else if (seat->focused_layer) {
|
} else if (layer) {
|
||||||
seat_set_focus_layer(seat, NULL);
|
seat_set_focus_layer(seat, NULL);
|
||||||
seat_set_workspace_focus(seat, node);
|
seat_set_workspace_focus(seat, node);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1315,11 +1317,6 @@ void seat_set_focus_layer(struct sway_seat *seat,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(layer->surface->mapped);
|
assert(layer->surface->mapped);
|
||||||
if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP &&
|
|
||||||
layer->current.keyboard_interactive
|
|
||||||
== ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) {
|
|
||||||
seat->has_exclusive_layer = true;
|
|
||||||
}
|
|
||||||
if (seat->focused_layer == layer) {
|
if (seat->focused_layer == layer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue