From 9f54cd89359119897fed2747c373879c09ae8706 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Wed, 17 Jan 2018 09:49:02 -0500 Subject: copy config references for input and seat --- sway/config/input.c | 10 ++++++++++ sway/config/seat.c | 11 +++++++++++ 2 files changed, 21 insertions(+) (limited to 'sway/config') diff --git a/sway/config/input.c b/sway/config/input.c index 96181302..c4f6211d 100644 --- a/sway/config/input.c +++ b/sway/config/input.c @@ -90,6 +90,16 @@ void merge_input_config(struct input_config *dst, struct input_config *src) { } } +struct input_config *copy_input_config(struct input_config *ic) { + struct input_config *copy = calloc(1, sizeof(struct input_config)); + if (copy == NULL) { + wlr_log(L_ERROR, "could not allocate input config"); + return NULL; + } + merge_input_config(copy, ic); + return copy; +} + void free_input_config(struct input_config *ic) { if (!ic) { return; diff --git a/sway/config/seat.c b/sway/config/seat.c index 03cc6d4e..bd8b45c8 100644 --- a/sway/config/seat.c +++ b/sway/config/seat.c @@ -99,6 +99,17 @@ void merge_seat_config(struct seat_config *dest, struct seat_config *source) { } } +struct seat_config *copy_seat_config(struct seat_config *seat) { + struct seat_config *copy = new_seat_config(seat->name); + if (copy == NULL) { + return NULL; + } + + merge_seat_config(copy, seat); + + return copy; +} + void free_seat_config(struct seat_config *seat) { if (!seat) { return; -- cgit v1.2.3-54-g00ecf