aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-03 13:56:05 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-02-11 10:15:00 -0500
commit4272bf127439a2d8515e934821a9744537260b9d (patch)
tree30972bfd6f93afc9ac339b3ae89c1aedbe509c11 /sway/input
parentFocus ws inactive node with focus_follows_mouse (diff)
downloadsway-4272bf127439a2d8515e934821a9744537260b9d.tar.gz
sway-4272bf127439a2d8515e934821a9744537260b9d.tar.zst
sway-4272bf127439a2d8515e934821a9744537260b9d.zip
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.
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/input-manager.c9
1 files changed, 5 insertions, 4 deletions
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
33struct sway_seat *input_manager_get_default_seat(void) { 33struct 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
37struct sway_seat *input_manager_get_seat(const char *seat_name) { 37struct 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
48char *input_device_get_identifier(struct wlr_input_device *device) { 48char *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 }