From dbd70faf2e0a8115f681995801fd4b82f4682604 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 22 Nov 2023 00:49:23 +0100 Subject: [PATCH] input/seat: drop exclusive_client This was a input-inhibit concept. --- include/sway/input/seat.h | 3 --- sway/desktop/layer_shell.c | 3 +-- sway/input/keyboard.c | 3 +-- sway/input/seat.c | 5 +---- sway/input/switch.c | 3 +-- sway/lock.c | 5 ----- 6 files changed, 4 insertions(+), 18 deletions(-) diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 97e81c19..a6c68fb8 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h @@ -108,9 +108,6 @@ struct sway_seat { // If the exclusive layer is set, views cannot receive keyboard focus bool has_exclusive_layer; - // If exclusive_client is set, no other clients will receive input events - struct wl_client *exclusive_client; - // Last touch point int32_t touch_id; double touch_x, touch_y; diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 979c4449..31d8558c 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -305,9 +305,8 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) { struct sway_seat *seat = input_manager_get_default_seat(); struct wl_client *client = wl_resource_get_client(sway_layer->layer_surface->resource); - bool set_focus = seat->exclusive_client == client; - if (set_focus) { + if (!server.session_lock.locked) { struct sway_layer_surface *layer = find_mapped_layer_by_client(client, sway_layer->layer_surface->output); if (layer) { diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 8927287f..577ec9f5 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c @@ -405,8 +405,7 @@ static void handle_key_event(struct sway_keyboard *keyboard, char *device_identifier = input_device_get_identifier(wlr_device); bool exact_identifier = keyboard->wlr->group != NULL; seat_idle_notify_activity(seat, IDLE_SOURCE_KEYBOARD); - bool input_inhibited = seat->exclusive_client != NULL || - server.session_lock.locked; + bool input_inhibited = server.session_lock.locked; struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = keyboard_shortcuts_inhibitor_get_for_focused_surface(seat); bool shortcuts_inhibited = sway_inhibitor && sway_inhibitor->inhibitor->active; diff --git a/sway/input/seat.c b/sway/input/seat.c index 0fd0e8e6..3ef0d713 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1104,8 +1104,7 @@ bool seat_is_input_allowed(struct sway_seat *seat, } return false; } - struct wl_client *client = wl_resource_get_client(surface->resource); - return seat->exclusive_client == client || seat->exclusive_client == NULL; + return true; } static void send_unfocus(struct sway_container *con, void *data) { @@ -1373,7 +1372,6 @@ void seat_set_focus_layer(struct sway_seat *seat, void seat_set_exclusive_client(struct sway_seat *seat, struct wl_client *client) { if (!client) { - seat->exclusive_client = client; // Triggers a refocus of the topmost surface layer if necessary // TODO: Make layer surface focus per-output based on cursor position for (int i = 0; i < root->outputs->length; ++i) { @@ -1408,7 +1406,6 @@ void seat_set_exclusive_client(struct sway_seat *seat, now.tv_nsec / 1000, point->touch_id); } } - seat->exclusive_client = client; } struct sway_node *seat_get_focus_inactive(struct sway_seat *seat, diff --git a/sway/input/switch.c b/sway/input/switch.c index 7a539801..32d9c7e0 100644 --- a/sway/input/switch.c +++ b/sway/input/switch.c @@ -34,8 +34,7 @@ static bool sway_switch_trigger_test(enum sway_switch_trigger trigger, static void execute_binding(struct sway_switch *sway_switch) { struct sway_seat* seat = sway_switch->seat_device->sway_seat; - bool input_inhibited = seat->exclusive_client != NULL || - server.session_lock.locked; + bool input_inhibited = server.session_lock.locked; list_t *bindings = config->current_mode->switch_bindings; struct sway_switch_binding *matched_binding = NULL; diff --git a/sway/lock.c b/sway/lock.c index 199624fc..6e279a51 100644 --- a/sway/lock.c +++ b/sway/lock.c @@ -155,11 +155,6 @@ static void handle_abandon(struct wl_listener *listener, void *data) { wl_list_remove(&server.session_lock.lock_unlock.link); wl_list_remove(&server.session_lock.lock_destroy.link); - struct sway_seat *seat; - wl_list_for_each(seat, &server.input->seats, link) { - seat->exclusive_client = NULL; - } - // redraw everything for (int i = 0; i < root->outputs->length; ++i) { struct sway_output *output = root->outputs->items[i];