diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 10:37:31 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 10:37:31 -0400 |
commit | 53bb7ea9962c5d97e0672eabcf1b9dfb7ffad0f1 (patch) | |
tree | 83856846c12de678ac15b5c41e9623f54df725fd /sway/input/seat.c | |
parent | rename input-manager functions (diff) | |
download | sway-53bb7ea9962c5d97e0672eabcf1b9dfb7ffad0f1.tar.gz sway-53bb7ea9962c5d97e0672eabcf1b9dfb7ffad0f1.tar.zst sway-53bb7ea9962c5d97e0672eabcf1b9dfb7ffad0f1.zip |
dont copy seat config on the seat
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index c2ecd1c4..91a9e32b 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -199,9 +199,11 @@ void seat_configure_device(struct sway_seat *seat, | |||
199 | return; | 199 | return; |
200 | } | 200 | } |
201 | 201 | ||
202 | if (seat->config) { | 202 | struct seat_config *seat_config = seat_get_config(seat); |
203 | |||
204 | if (seat_config) { | ||
203 | seat_device->attachment_config = | 205 | seat_device->attachment_config = |
204 | seat_config_get_attachment(seat->config, input_device->identifier); | 206 | seat_config_get_attachment(seat_config, input_device->identifier); |
205 | } | 207 | } |
206 | 208 | ||
207 | switch (input_device->wlr_device->type) { | 209 | switch (input_device->wlr_device->type) { |
@@ -415,12 +417,8 @@ struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, | |||
415 | return container_parent(focus, type); | 417 | return container_parent(focus, type); |
416 | } | 418 | } |
417 | 419 | ||
418 | void seat_set_config(struct sway_seat *seat, | 420 | void seat_apply_config(struct sway_seat *seat, |
419 | struct seat_config *seat_config) { | 421 | struct seat_config *seat_config) { |
420 | // clear configs | ||
421 | free_seat_config(seat->config); | ||
422 | seat->config = NULL; | ||
423 | |||
424 | struct sway_seat_device *seat_device = NULL; | 422 | struct sway_seat_device *seat_device = NULL; |
425 | wl_list_for_each(seat_device, &seat->devices, link) { | 423 | wl_list_for_each(seat_device, &seat->devices, link) { |
426 | seat_device->attachment_config = NULL; | 424 | seat_device->attachment_config = NULL; |
@@ -430,10 +428,19 @@ void seat_set_config(struct sway_seat *seat, | |||
430 | return; | 428 | return; |
431 | } | 429 | } |
432 | 430 | ||
433 | // add configs | ||
434 | seat->config = copy_seat_config(seat_config); | ||
435 | |||
436 | wl_list_for_each(seat_device, &seat->devices, link) { | 431 | wl_list_for_each(seat_device, &seat->devices, link) { |
437 | seat_configure_device(seat, seat_device->input_device); | 432 | seat_configure_device(seat, seat_device->input_device); |
438 | } | 433 | } |
439 | } | 434 | } |
435 | |||
436 | struct seat_config *seat_get_config(struct sway_seat *seat) { | ||
437 | struct seat_config *seat_config = NULL; | ||
438 | for (int i = 0; i < config->seat_configs->length; ++i ) { | ||
439 | seat_config = config->seat_configs->items[i]; | ||
440 | if (strcmp(seat->wlr_seat->name, seat_config->name) == 0) { | ||
441 | return seat_config; | ||
442 | } | ||
443 | } | ||
444 | |||
445 | return NULL; | ||
446 | } | ||