diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 13:19:58 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 13:19:58 -0400 |
commit | 22287b42bf323457d779b1023764ade83313b199 (patch) | |
tree | ed053057234d2bedb58e679234a6d4ac132f4986 /sway/input/input-manager.c | |
parent | remove unused attachment config (diff) | |
download | sway-22287b42bf323457d779b1023764ade83313b199.tar.gz sway-22287b42bf323457d779b1023764ade83313b199.tar.zst sway-22287b42bf323457d779b1023764ade83313b199.zip |
dont copy input config
Diffstat (limited to 'sway/input/input-manager.c')
-rw-r--r-- | sway/input/input-manager.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 34d5b4cf..34aed115 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -95,7 +95,7 @@ static bool input_has_seat_configuration(struct sway_input_manager *input) { | |||
95 | static void input_manager_libinput_config_pointer( | 95 | static void input_manager_libinput_config_pointer( |
96 | struct sway_input_device *input_device) { | 96 | struct sway_input_device *input_device) { |
97 | struct wlr_input_device *wlr_device = input_device->wlr_device; | 97 | struct wlr_input_device *wlr_device = input_device->wlr_device; |
98 | struct input_config *ic = input_device->config; | 98 | struct input_config *ic = input_device_get_config(input_device); |
99 | struct libinput_device *libinput_device; | 99 | struct libinput_device *libinput_device; |
100 | 100 | ||
101 | if (!ic || !wlr_input_device_is_libinput(wlr_device)) { | 101 | if (!ic || !wlr_input_device_is_libinput(wlr_device)) { |
@@ -196,7 +196,6 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) { | |||
196 | 196 | ||
197 | wl_list_remove(&input_device->link); | 197 | wl_list_remove(&input_device->link); |
198 | wl_list_remove(&input_device->device_destroy.link); | 198 | wl_list_remove(&input_device->device_destroy.link); |
199 | free_input_config(input_device->config); | ||
200 | free(input_device->identifier); | 199 | free(input_device->identifier); |
201 | free(input_device); | 200 | free(input_device); |
202 | } | 201 | } |
@@ -219,16 +218,6 @@ static void handle_new_input(struct wl_listener *listener, void *data) { | |||
219 | wlr_log(L_DEBUG, "adding device: '%s'", | 218 | wlr_log(L_DEBUG, "adding device: '%s'", |
220 | input_device->identifier); | 219 | input_device->identifier); |
221 | 220 | ||
222 | // find config | ||
223 | for (int i = 0; i < config->input_configs->length; ++i) { | ||
224 | struct input_config *input_config = config->input_configs->items[i]; | ||
225 | if (strcmp(input_config->identifier, input_device->identifier) == 0) { | ||
226 | free_input_config(input_device->config); | ||
227 | input_device->config = copy_input_config(input_config); | ||
228 | break; | ||
229 | } | ||
230 | } | ||
231 | |||
232 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { | 221 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { |
233 | input_manager_libinput_config_pointer(input_device); | 222 | input_manager_libinput_config_pointer(input_device); |
234 | } | 223 | } |
@@ -320,9 +309,6 @@ void input_manager_apply_input_config(struct sway_input_manager *input, | |||
320 | struct sway_input_device *input_device = NULL; | 309 | struct sway_input_device *input_device = NULL; |
321 | wl_list_for_each(input_device, &input->devices, link) { | 310 | wl_list_for_each(input_device, &input->devices, link) { |
322 | if (strcmp(input_device->identifier, input_config->identifier) == 0) { | 311 | if (strcmp(input_device->identifier, input_config->identifier) == 0) { |
323 | free_input_config(input_device->config); | ||
324 | input_device->config = copy_input_config(input_config); | ||
325 | |||
326 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { | 312 | if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { |
327 | input_manager_libinput_config_pointer(input_device); | 313 | input_manager_libinput_config_pointer(input_device); |
328 | } | 314 | } |
@@ -410,3 +396,15 @@ struct sway_seat *input_manager_get_default_seat( | |||
410 | } | 396 | } |
411 | return seat; | 397 | return seat; |
412 | } | 398 | } |
399 | |||
400 | struct input_config *input_device_get_config(struct sway_input_device *device) { | ||
401 | struct input_config *input_config = NULL; | ||
402 | for (int i = 0; i < config->input_configs->length; ++i) { | ||
403 | input_config = config->input_configs->items[i]; | ||
404 | if (strcmp(input_config->identifier, device->identifier) == 0) { | ||
405 | return input_config; | ||
406 | } | ||
407 | } | ||
408 | |||
409 | return NULL; | ||
410 | } | ||