diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-01-21 11:17:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-21 11:17:07 -0500 |
commit | c933781facbb664fedcd52ab19f35c392cd9e7b4 (patch) | |
tree | 95b0e63411e44958364321bbfe3bc00515625cc6 /sway/input | |
parent | 3dd915876d459a2aeeb7a5864330f5bc30bc2f00 (diff) | |
parent | 9f54cd89359119897fed2747c373879c09ae8706 (diff) | |
download | sway-c933781facbb664fedcd52ab19f35c392cd9e7b4.tar.xz |
Merge pull request #1570 from acrisci/config-references
Copy input config references
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/input-manager.c | 7 | ||||
-rw-r--r-- | sway/input/seat.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 26cf5035..bfe9d9c4 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -174,7 +174,8 @@ static void input_add_notify(struct wl_listener *listener, void *data) { for (int i = 0; i < config->input_configs->length; ++i) { struct input_config *input_config = config->input_configs->items[i]; if (strcmp(input_config->identifier, input_device->identifier) == 0) { - input_device->config = input_config; + free_input_config(input_device->config); + input_device->config = copy_input_config(input_config); break; } } @@ -240,6 +241,7 @@ static void input_remove_notify(struct wl_listener *listener, void *data) { } wl_list_remove(&input_device->link); + free_input_config(input_device->config); free(input_device->identifier); free(input_device); } @@ -293,7 +295,8 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input, struct sway_input_device *input_device = NULL; wl_list_for_each(input_device, &input->devices, link) { if (strcmp(input_device->identifier, input_config->identifier) == 0) { - input_device->config = input_config; + free_input_config(input_device->config); + input_device->config = copy_input_config(input_config); if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { sway_input_manager_libinput_config_pointer(input_device); diff --git a/sway/input/seat.c b/sway/input/seat.c index d24a6c7a..22fee3c3 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -242,6 +242,7 @@ void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) { void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config) { // clear configs + free_seat_config(seat->config); seat->config = NULL; struct sway_seat_device *seat_device = NULL; @@ -254,11 +255,9 @@ void sway_seat_set_config(struct sway_seat *seat, } // add configs - seat->config = seat_config; + seat->config = copy_seat_config(seat_config); wl_list_for_each(seat_device, &seat->devices, link) { - seat_device->attachment_config = - seat_config_get_attachment(seat_config, - seat_device->input_device->identifier); + sway_seat_configure_device(seat, seat_device->input_device); } } |