aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/config.h
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 /include/sway/config.h
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 'include/sway/config.h')
-rw-r--r--include/sway/config.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index b8da29c5..92536d10 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -22,14 +22,28 @@ struct sway_variable {
22 char *value; 22 char *value;
23}; 23};
24 24
25
26enum binding_input_type {
27 BINDING_KEYCODE,
28 BINDING_KEYSYM,
29 BINDING_MOUSE,
30};
31
32enum binding_flags {
33 BINDING_RELEASE=1,
34 BINDING_LOCKED=2, // keyboard only
35 BINDING_BORDER=4, // mouse only; trigger on container border
36 BINDING_CONTENTS=8, // mouse only; trigger on container contents
37 BINDING_TITLEBAR=16 // mouse only; trigger on container titlebar
38};
39
25/** 40/**
26 * A key binding and an associated command. 41 * A key binding and an associated command.
27 */ 42 */
28struct sway_binding { 43struct sway_binding {
44 enum binding_input_type type;
29 int order; 45 int order;
30 bool release; 46 uint32_t flags;
31 bool locked;
32 bool bindcode;
33 list_t *keys; // sorted in ascending order 47 list_t *keys; // sorted in ascending order
34 uint32_t modifiers; 48 uint32_t modifiers;
35 char *command; 49 char *command;
@@ -50,6 +64,7 @@ struct sway_mode {
50 char *name; 64 char *name;
51 list_t *keysym_bindings; 65 list_t *keysym_bindings;
52 list_t *keycode_bindings; 66 list_t *keycode_bindings;
67 list_t *mouse_bindings;
53 bool pango; 68 bool pango;
54}; 69};
55 70