mirror of
https://github.com/NickHu/sway
synced 2024-12-26 21:58:30 +01:00
input/seat: drop exclusive_client
This was a input-inhibit concept.
This commit is contained in:
parent
a6ef12d968
commit
dbd70faf2e
6 changed files with 4 additions and 18 deletions
|
@ -108,9 +108,6 @@ struct sway_seat {
|
||||||
// If the exclusive layer is set, views cannot receive keyboard focus
|
// If the exclusive layer is set, views cannot receive keyboard focus
|
||||||
bool has_exclusive_layer;
|
bool has_exclusive_layer;
|
||||||
|
|
||||||
// If exclusive_client is set, no other clients will receive input events
|
|
||||||
struct wl_client *exclusive_client;
|
|
||||||
|
|
||||||
// Last touch point
|
// Last touch point
|
||||||
int32_t touch_id;
|
int32_t touch_id;
|
||||||
double touch_x, touch_y;
|
double touch_x, touch_y;
|
||||||
|
|
|
@ -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 sway_seat *seat = input_manager_get_default_seat();
|
||||||
struct wl_client *client =
|
struct wl_client *client =
|
||||||
wl_resource_get_client(sway_layer->layer_surface->resource);
|
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 =
|
struct sway_layer_surface *layer =
|
||||||
find_mapped_layer_by_client(client, sway_layer->layer_surface->output);
|
find_mapped_layer_by_client(client, sway_layer->layer_surface->output);
|
||||||
if (layer) {
|
if (layer) {
|
||||||
|
|
|
@ -405,8 +405,7 @@ static void handle_key_event(struct sway_keyboard *keyboard,
|
||||||
char *device_identifier = input_device_get_identifier(wlr_device);
|
char *device_identifier = input_device_get_identifier(wlr_device);
|
||||||
bool exact_identifier = keyboard->wlr->group != NULL;
|
bool exact_identifier = keyboard->wlr->group != NULL;
|
||||||
seat_idle_notify_activity(seat, IDLE_SOURCE_KEYBOARD);
|
seat_idle_notify_activity(seat, IDLE_SOURCE_KEYBOARD);
|
||||||
bool input_inhibited = seat->exclusive_client != NULL ||
|
bool input_inhibited = server.session_lock.locked;
|
||||||
server.session_lock.locked;
|
|
||||||
struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor =
|
struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor =
|
||||||
keyboard_shortcuts_inhibitor_get_for_focused_surface(seat);
|
keyboard_shortcuts_inhibitor_get_for_focused_surface(seat);
|
||||||
bool shortcuts_inhibited = sway_inhibitor && sway_inhibitor->inhibitor->active;
|
bool shortcuts_inhibited = sway_inhibitor && sway_inhibitor->inhibitor->active;
|
||||||
|
|
|
@ -1104,8 +1104,7 @@ bool seat_is_input_allowed(struct sway_seat *seat,
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
return true;
|
||||||
return seat->exclusive_client == client || seat->exclusive_client == NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_unfocus(struct sway_container *con, void *data) {
|
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,
|
void seat_set_exclusive_client(struct sway_seat *seat,
|
||||||
struct wl_client *client) {
|
struct wl_client *client) {
|
||||||
if (!client) {
|
if (!client) {
|
||||||
seat->exclusive_client = client;
|
|
||||||
// Triggers a refocus of the topmost surface layer if necessary
|
// Triggers a refocus of the topmost surface layer if necessary
|
||||||
// TODO: Make layer surface focus per-output based on cursor position
|
// TODO: Make layer surface focus per-output based on cursor position
|
||||||
for (int i = 0; i < root->outputs->length; ++i) {
|
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);
|
now.tv_nsec / 1000, point->touch_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seat->exclusive_client = client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_node *seat_get_focus_inactive(struct sway_seat *seat,
|
struct sway_node *seat_get_focus_inactive(struct sway_seat *seat,
|
||||||
|
|
|
@ -34,8 +34,7 @@ static bool sway_switch_trigger_test(enum sway_switch_trigger trigger,
|
||||||
|
|
||||||
static void execute_binding(struct sway_switch *sway_switch) {
|
static void execute_binding(struct sway_switch *sway_switch) {
|
||||||
struct sway_seat* seat = sway_switch->seat_device->sway_seat;
|
struct sway_seat* seat = sway_switch->seat_device->sway_seat;
|
||||||
bool input_inhibited = seat->exclusive_client != NULL ||
|
bool input_inhibited = server.session_lock.locked;
|
||||||
server.session_lock.locked;
|
|
||||||
|
|
||||||
list_t *bindings = config->current_mode->switch_bindings;
|
list_t *bindings = config->current_mode->switch_bindings;
|
||||||
struct sway_switch_binding *matched_binding = NULL;
|
struct sway_switch_binding *matched_binding = NULL;
|
||||||
|
|
|
@ -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_unlock.link);
|
||||||
wl_list_remove(&server.session_lock.lock_destroy.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
|
// redraw everything
|
||||||
for (int i = 0; i < root->outputs->length; ++i) {
|
for (int i = 0; i < root->outputs->length; ++i) {
|
||||||
struct sway_output *output = root->outputs->items[i];
|
struct sway_output *output = root->outputs->items[i];
|
||||||
|
|
Loading…
Reference in a new issue