diff options
-rw-r--r-- | include/sway/input/input-manager.h | 2 | ||||
-rw-r--r-- | sway/commands/seat/cursor.c | 5 | ||||
-rw-r--r-- | sway/config.c | 6 | ||||
-rw-r--r-- | sway/input/input-manager.c | 9 |
4 files changed, 13 insertions, 9 deletions
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index 8e8bf1f2..e166a237 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -45,7 +45,7 @@ void input_manager_apply_seat_config(struct seat_config *seat_config); | |||
45 | 45 | ||
46 | struct sway_seat *input_manager_get_default_seat(void); | 46 | struct sway_seat *input_manager_get_default_seat(void); |
47 | 47 | ||
48 | struct sway_seat *input_manager_get_seat(const char *seat_name); | 48 | struct sway_seat *input_manager_get_seat(const char *seat_name, bool create); |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * If none of the seat configs have a fallback setting (either true or false), | 51 | * If none of the seat configs have a fallback setting (either true or false), |
diff --git a/sway/commands/seat/cursor.c b/sway/commands/seat/cursor.c index 4f805b22..0c7609ea 100644 --- a/sway/commands/seat/cursor.c +++ b/sway/commands/seat/cursor.c | |||
@@ -61,9 +61,10 @@ struct cmd_results *seat_cmd_cursor(int argc, char **argv) { | |||
61 | } | 61 | } |
62 | 62 | ||
63 | if (strcmp(sc->name, "*") != 0) { | 63 | if (strcmp(sc->name, "*") != 0) { |
64 | struct sway_seat *seat = input_manager_get_seat(sc->name); | 64 | struct sway_seat *seat = input_manager_get_seat(sc->name, false); |
65 | if (!seat) { | 65 | if (!seat) { |
66 | return cmd_results_new(CMD_FAILURE, "Failed to get seat"); | 66 | return cmd_results_new(CMD_FAILURE, |
67 | "Seat %s does not exist", sc->name); | ||
67 | } | 68 | } |
68 | error = handle_command(seat->cursor, argc, argv); | 69 | error = handle_command(seat->cursor, argc, argv); |
69 | } else { | 70 | } else { |
diff --git a/sway/config.c b/sway/config.c index 54d29fc9..ee1c42df 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -149,8 +149,10 @@ static void destroy_removed_seats(struct sway_config *old_config, | |||
149 | /* Also destroy seats that aren't present in new config */ | 149 | /* Also destroy seats that aren't present in new config */ |
150 | if (new_config && list_seq_find(new_config->seat_configs, | 150 | if (new_config && list_seq_find(new_config->seat_configs, |
151 | seat_name_cmp, seat_config->name) < 0) { | 151 | seat_name_cmp, seat_config->name) < 0) { |
152 | seat = input_manager_get_seat(seat_config->name); | 152 | seat = input_manager_get_seat(seat_config->name, false); |
153 | seat_destroy(seat); | 153 | if (seat) { |
154 | seat_destroy(seat); | ||
155 | } | ||
154 | } | 156 | } |
155 | } | 157 | } |
156 | } | 158 | } |
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 8d263e06..f99fc395 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -31,10 +31,10 @@ struct sway_seat *input_manager_current_seat(void) { | |||
31 | } | 31 | } |
32 | 32 | ||
33 | struct sway_seat *input_manager_get_default_seat(void) { | 33 | struct sway_seat *input_manager_get_default_seat(void) { |
34 | return input_manager_get_seat(DEFAULT_SEAT); | 34 | return input_manager_get_seat(DEFAULT_SEAT, true); |
35 | } | 35 | } |
36 | 36 | ||
37 | struct sway_seat *input_manager_get_seat(const char *seat_name) { | 37 | struct sway_seat *input_manager_get_seat(const char *seat_name, bool create) { |
38 | struct sway_seat *seat = NULL; | 38 | struct sway_seat *seat = NULL; |
39 | wl_list_for_each(seat, &server.input->seats, link) { | 39 | wl_list_for_each(seat, &server.input->seats, link) { |
40 | if (strcmp(seat->wlr_seat->name, seat_name) == 0) { | 40 | if (strcmp(seat->wlr_seat->name, seat_name) == 0) { |
@@ -42,7 +42,7 @@ struct sway_seat *input_manager_get_seat(const char *seat_name) { | |||
42 | } | 42 | } |
43 | } | 43 | } |
44 | 44 | ||
45 | return seat_create(seat_name); | 45 | return create ? seat_create(seat_name) : NULL; |
46 | } | 46 | } |
47 | 47 | ||
48 | char *input_device_get_identifier(struct wlr_input_device *device) { | 48 | 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) { | |||
674 | seat_apply_config(seat, sc); | 674 | seat_apply_config(seat, sc); |
675 | } | 675 | } |
676 | } else { | 676 | } else { |
677 | struct sway_seat *seat = input_manager_get_seat(seat_config->name); | 677 | struct sway_seat *seat = |
678 | input_manager_get_seat(seat_config->name, true); | ||
678 | if (!seat) { | 679 | if (!seat) { |
679 | return; | 680 | return; |
680 | } | 681 | } |