mirror of
https://github.com/swaywm/sway.git
synced 2025-11-14 06:59:47 -05:00
seat_cmd_cursor: do not create non-existing seat
If a seat does not exist in seat_cmd_cursor, do not create it. A seat without any attachments is useless since it will have no capabilities. This changes `input_manager_get_seat` to have an additional argument that dictates whether or not to create the seat if it does not exist.
This commit is contained in:
parent
8e60efe0bf
commit
7299b9a6ca
4 changed files with 13 additions and 9 deletions
|
|
@ -31,10 +31,10 @@ struct sway_seat *input_manager_current_seat(void) {
|
|||
}
|
||||
|
||||
struct sway_seat *input_manager_get_default_seat(void) {
|
||||
return input_manager_get_seat(DEFAULT_SEAT);
|
||||
return input_manager_get_seat(DEFAULT_SEAT, true);
|
||||
}
|
||||
|
||||
struct sway_seat *input_manager_get_seat(const char *seat_name) {
|
||||
struct sway_seat *input_manager_get_seat(const char *seat_name, bool create) {
|
||||
struct sway_seat *seat = NULL;
|
||||
wl_list_for_each(seat, &server.input->seats, link) {
|
||||
if (strcmp(seat->wlr_seat->name, seat_name) == 0) {
|
||||
|
|
@ -42,7 +42,7 @@ struct sway_seat *input_manager_get_seat(const char *seat_name) {
|
|||
}
|
||||
}
|
||||
|
||||
return seat_create(seat_name);
|
||||
return create ? seat_create(seat_name) : NULL;
|
||||
}
|
||||
|
||||
char *input_device_get_identifier(struct wlr_input_device *device) {
|
||||
|
|
@ -674,7 +674,8 @@ void input_manager_apply_seat_config(struct seat_config *seat_config) {
|
|||
seat_apply_config(seat, sc);
|
||||
}
|
||||
} else {
|
||||
struct sway_seat *seat = input_manager_get_seat(seat_config->name);
|
||||
struct sway_seat *seat =
|
||||
input_manager_get_seat(seat_config->name, true);
|
||||
if (!seat) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue