aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar frsfnrrg <frsfnrrg@users.noreply.github.com>2018-07-17 22:01:06 -0400
committerLibravatar frsfnrrg <frsfnrrg@users.noreply.github.com>2018-07-23 21:14:22 -0400
commit754372c3de1f5b357850cb58cc8ddc1aee596bd6 (patch)
treeeccf5a8acb15efe794fabe09e64bab228006f52b /sway/config.c
parentMerge pull request #2342 from RyanDwyer/update-cursor (diff)
downloadsway-754372c3de1f5b357850cb58cc8ddc1aee596bd6.tar.gz
sway-754372c3de1f5b357850cb58cc8ddc1aee596bd6.tar.zst
sway-754372c3de1f5b357850cb58cc8ddc1aee596bd6.zip
Parse mouse binding options
First, the existing sway_binding structure is given an enumerated type code. As all flags to bindsym/bindcode are boolean, a single uint32 is used to hold all flags. The _BORDER, _CONTENTS, _TITLEBAR flags, when active, indicate in which part of a container the binding can trigger; to localize complexity, they do not overlap with the command line arguments, which center around _TITLEBAR being set by default. The keyboard handling code is adjusted for this change, as is binding_key_compare; note that BINDING_LOCKED is *not* part of the key portion of the binding. Next, list of mouse bindings is introduced and cleaned up. Finally, the binding command parsing code is extended to handle the case where bindsym is used to describe a mouse binding rather than a keysym binding; the difference between the two may be detected as late as when the first key/button is parsed, or as early as the first flag. As bindings can have multiple keycodes/keysyms/buttons, mixed keysym/button sequences are prohibited.
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c
index ed624bfa..c2310ff7 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -56,6 +56,12 @@ static void free_mode(struct sway_mode *mode) {
56 } 56 }
57 list_free(mode->keycode_bindings); 57 list_free(mode->keycode_bindings);
58 } 58 }
59 if (mode->mouse_bindings) {
60 for (i = 0; i < mode->mouse_bindings->length; i++) {
61 free_sway_binding(mode->mouse_bindings->items[i]);
62 }
63 list_free(mode->mouse_bindings);
64 }
59 free(mode); 65 free(mode);
60} 66}
61 67
@@ -172,6 +178,7 @@ static void config_defaults(struct sway_config *config) {
172 strcpy(config->current_mode->name, "default"); 178 strcpy(config->current_mode->name, "default");
173 if (!(config->current_mode->keysym_bindings = create_list())) goto cleanup; 179 if (!(config->current_mode->keysym_bindings = create_list())) goto cleanup;
174 if (!(config->current_mode->keycode_bindings = create_list())) goto cleanup; 180 if (!(config->current_mode->keycode_bindings = create_list())) goto cleanup;
181 if (!(config->current_mode->mouse_bindings = create_list())) goto cleanup;
175 list_add(config->modes, config->current_mode); 182 list_add(config->modes, config->current_mode);
176 183
177 config->floating_mod = 0; 184 config->floating_mod = 0;