diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-12-11 04:17:14 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-12-11 07:55:01 -0500 |
commit | 462a451328a1d6f0b17d34b431d6bf3dec87c1ba (patch) | |
tree | 56649e0702d13e8a7dd5143b5b7d2b9db094a1a7 /sway/config.c | |
parent | sway pointer (diff) | |
download | sway-462a451328a1d6f0b17d34b431d6bf3dec87c1ba.tar.gz sway-462a451328a1d6f0b17d34b431d6bf3dec87c1ba.tar.zst sway-462a451328a1d6f0b17d34b431d6bf3dec87c1ba.zip |
input config
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c index 61131845..ec8e89b4 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -226,6 +226,59 @@ static int qstrcmp(const void* a, const void* b) { | |||
226 | return strcmp(*((char**) a), *((char**) b)); | 226 | return strcmp(*((char**) a), *((char**) b)); |
227 | } | 227 | } |
228 | 228 | ||
229 | void merge_input_config(struct input_config *dst, struct input_config *src) { | ||
230 | if (src->identifier) { | ||
231 | if (dst->identifier) { | ||
232 | free(dst->identifier); | ||
233 | } | ||
234 | dst->identifier = strdup(src->identifier); | ||
235 | } | ||
236 | if (src->accel_profile != INT_MIN) { | ||
237 | dst->accel_profile = src->accel_profile; | ||
238 | } | ||
239 | if (src->click_method != INT_MIN) { | ||
240 | dst->click_method = src->click_method; | ||
241 | } | ||
242 | if (src->drag_lock != INT_MIN) { | ||
243 | dst->drag_lock = src->drag_lock; | ||
244 | } | ||
245 | if (src->dwt != INT_MIN) { | ||
246 | dst->dwt = src->dwt; | ||
247 | } | ||
248 | if (src->middle_emulation != INT_MIN) { | ||
249 | dst->middle_emulation = src->middle_emulation; | ||
250 | } | ||
251 | if (src->natural_scroll != INT_MIN) { | ||
252 | dst->natural_scroll = src->natural_scroll; | ||
253 | } | ||
254 | if (src->pointer_accel != FLT_MIN) { | ||
255 | dst->pointer_accel = src->pointer_accel; | ||
256 | } | ||
257 | if (src->scroll_method != INT_MIN) { | ||
258 | dst->scroll_method = src->scroll_method; | ||
259 | } | ||
260 | if (src->send_events != INT_MIN) { | ||
261 | dst->send_events = src->send_events; | ||
262 | } | ||
263 | if (src->tap != INT_MIN) { | ||
264 | dst->tap = src->tap; | ||
265 | } | ||
266 | } | ||
267 | |||
268 | void free_input_config(struct input_config *ic) { | ||
269 | if (!ic) { | ||
270 | return; | ||
271 | } | ||
272 | free(ic->identifier); | ||
273 | free(ic); | ||
274 | } | ||
275 | |||
276 | int input_identifier_cmp(const void *item, const void *data) { | ||
277 | const struct input_config *ic = item; | ||
278 | const char *identifier = data; | ||
279 | return strcmp(ic->identifier, identifier); | ||
280 | } | ||
281 | |||
229 | bool load_main_config(const char *file, bool is_active) { | 282 | bool load_main_config(const char *file, bool is_active) { |
230 | char *path; | 283 | char *path; |
231 | if (file != NULL) { | 284 | if (file != NULL) { |