Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seat: Drop has_exclusive_layer #8032

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/sway/input/seat.h
Expand Up @@ -99,8 +99,6 @@ struct sway_seat {
char *prev_workspace_name; // for workspace back_and_forth

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
int32_t touch_id;
Expand Down
13 changes: 5 additions & 8 deletions sway/input/seat.c
Expand Up @@ -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) {
struct wlr_layer_surface_v1 *layer = seat->focused_layer;

// Prevents the layer from losing focus if it has keyboard exclusivity
if (seat->has_exclusive_layer) {
struct wlr_layer_surface_v1 *layer = seat->focused_layer;
if (layer && layer->current.keyboard_interactive ==
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) {
seat_set_focus_layer(seat, NULL);
seat_set_workspace_focus(seat, node);
seat_set_focus_layer(seat, layer);
} else if (seat->focused_layer) {
} else if (layer) {
seat_set_focus_layer(seat, NULL);
seat_set_workspace_focus(seat, node);
} else {
Expand Down Expand Up @@ -1315,11 +1317,6 @@ void seat_set_focus_layer(struct sway_seat *seat,
return;
}
assert(layer->surface->mapped);
if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we're loosing this condition here?

IOW, exclusive keyboard layers under the toplevels would never get focus before, but now they do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this condition in the first place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a decision we made when implementing layer-shell support. The motivation is that if a particular layer has focus, a lower level layer cannot get focus. So if a toplevel has focus, background/bottom cannot get focus.

layer->current.keyboard_interactive
== ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) {
seat->has_exclusive_layer = true;
}
if (seat->focused_layer == layer) {
return;
}
Expand Down