aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-06 17:01:08 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-08 03:03:55 +0100
commit32cd3f70eb4d9c55b65fa3cdd446c7a096cf4049 (patch)
tree292fcfcb66d365e1aa4b05d57d8a502f0547a308 /sway
parentAdd function for getting list of modifier names. (diff)
downloadsway-32cd3f70eb4d9c55b65fa3cdd446c7a096cf4049.tar.gz
sway-32cd3f70eb4d9c55b65fa3cdd446c7a096cf4049.tar.zst
sway-32cd3f70eb4d9c55b65fa3cdd446c7a096cf4049.zip
Add function for duplication a sway_binding
Diffstat (limited to 'sway')
-rw-r--r--sway/config.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c
index 95d8f339..d923eea5 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -721,6 +721,24 @@ void free_sway_mouse_binding(struct sway_mouse_binding *binding) {
721 free(binding); 721 free(binding);
722} 722}
723 723
724struct sway_binding *sway_binding_dup(struct sway_binding *sb) {
725 struct sway_binding *new_sb = malloc(sizeof(struct sway_binding));
726
727 new_sb->order = sb->order;
728 new_sb->modifiers = sb->modifiers;
729 new_sb->command = strdup(sb->command);
730
731 new_sb->keys = create_list();
732 int i;
733 for (i = 0; i < sb->keys->length; ++i) {
734 xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t));
735 *key = *(xkb_keysym_t *)sb->keys->items[i];
736 list_add(new_sb->keys, key);
737 }
738
739 return new_sb;
740}
741
724struct bar_config *default_bar_config(void) { 742struct bar_config *default_bar_config(void) {
725 struct bar_config *bar = NULL; 743 struct bar_config *bar = NULL;
726 bar = malloc(sizeof(struct bar_config)); 744 bar = malloc(sizeof(struct bar_config));