mirror of
https://github.com/swaywm/sway.git
synced 2024-11-29 19:31:29 +00:00
Add function for duplication a sway_binding
This commit is contained in:
parent
dffacea831
commit
32cd3f70eb
|
@ -189,6 +189,7 @@ int sway_binding_cmp(const void *a, const void *b);
|
||||||
int sway_binding_cmp_qsort(const void *a, const void *b);
|
int sway_binding_cmp_qsort(const void *a, const void *b);
|
||||||
int sway_binding_cmp_keys(const void *a, const void *b);
|
int sway_binding_cmp_keys(const void *a, const void *b);
|
||||||
void free_sway_binding(struct sway_binding *sb);
|
void free_sway_binding(struct sway_binding *sb);
|
||||||
|
struct sway_binding *sway_binding_dup(struct sway_binding *sb);
|
||||||
|
|
||||||
int sway_mouse_binding_cmp(const void *a, const void *b);
|
int sway_mouse_binding_cmp(const void *a, const void *b);
|
||||||
int sway_mouse_binding_cmp_qsort(const void *a, const void *b);
|
int sway_mouse_binding_cmp_qsort(const void *a, const void *b);
|
||||||
|
|
|
@ -721,6 +721,24 @@ void free_sway_mouse_binding(struct sway_mouse_binding *binding) {
|
||||||
free(binding);
|
free(binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct sway_binding *sway_binding_dup(struct sway_binding *sb) {
|
||||||
|
struct sway_binding *new_sb = malloc(sizeof(struct sway_binding));
|
||||||
|
|
||||||
|
new_sb->order = sb->order;
|
||||||
|
new_sb->modifiers = sb->modifiers;
|
||||||
|
new_sb->command = strdup(sb->command);
|
||||||
|
|
||||||
|
new_sb->keys = create_list();
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < sb->keys->length; ++i) {
|
||||||
|
xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t));
|
||||||
|
*key = *(xkb_keysym_t *)sb->keys->items[i];
|
||||||
|
list_add(new_sb->keys, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_sb;
|
||||||
|
}
|
||||||
|
|
||||||
struct bar_config *default_bar_config(void) {
|
struct bar_config *default_bar_config(void) {
|
||||||
struct bar_config *bar = NULL;
|
struct bar_config *bar = NULL;
|
||||||
bar = malloc(sizeof(struct bar_config));
|
bar = malloc(sizeof(struct bar_config));
|
||||||
|
|
Loading…
Reference in a new issue