diff options
Diffstat (limited to 'include/sway/config.h')
-rw-r--r-- | include/sway/config.h | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 86410544..392f6538 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -24,7 +24,6 @@ struct sway_variable { | |||
24 | char *value; | 24 | char *value; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | |||
28 | enum binding_input_type { | 27 | enum binding_input_type { |
29 | BINDING_KEYCODE, | 28 | BINDING_KEYCODE, |
30 | BINDING_KEYSYM, | 29 | BINDING_KEYSYM, |
@@ -39,6 +38,7 @@ enum binding_flags { | |||
39 | BINDING_BORDER=4, // mouse only; trigger on container border | 38 | BINDING_BORDER=4, // mouse only; trigger on container border |
40 | BINDING_CONTENTS=8, // mouse only; trigger on container contents | 39 | BINDING_CONTENTS=8, // mouse only; trigger on container contents |
41 | BINDING_TITLEBAR=16, // mouse only; trigger on container titlebar | 40 | BINDING_TITLEBAR=16, // mouse only; trigger on container titlebar |
41 | BINDING_CODE=32, // keyboard only; convert keysyms into keycodes | ||
42 | }; | 42 | }; |
43 | 43 | ||
44 | /** | 44 | /** |
@@ -50,6 +50,7 @@ struct sway_binding { | |||
50 | char *input; | 50 | char *input; |
51 | uint32_t flags; | 51 | uint32_t flags; |
52 | list_t *keys; // sorted in ascending order | 52 | list_t *keys; // sorted in ascending order |
53 | list_t *syms; // sorted in ascending order; NULL if BINDING_CODE is not set | ||
53 | uint32_t modifiers; | 54 | uint32_t modifiers; |
54 | char *command; | 55 | char *command; |
55 | }; | 56 | }; |
@@ -407,6 +408,14 @@ enum alignment { | |||
407 | }; | 408 | }; |
408 | 409 | ||
409 | /** | 410 | /** |
411 | * The keysym to keycode translation. | ||
412 | */ | ||
413 | struct keysym_translation_data { | ||
414 | struct xkb_keymap *xkb_keymap; | ||
415 | struct xkb_state *xkb_state; | ||
416 | }; | ||
417 | |||
418 | /** | ||
410 | * The configuration struct. The result of loading a config file. | 419 | * The configuration struct. The result of loading a config file. |
411 | */ | 420 | */ |
412 | struct sway_config { | 421 | struct sway_config { |
@@ -508,6 +517,9 @@ struct sway_config { | |||
508 | list_t *feature_policies; | 517 | list_t *feature_policies; |
509 | list_t *ipc_policies; | 518 | list_t *ipc_policies; |
510 | 519 | ||
520 | // The keysym to keycode translation | ||
521 | struct keysym_translation_data keysym_translation; | ||
522 | |||
511 | // Context for command handlers | 523 | // Context for command handlers |
512 | struct { | 524 | struct { |
513 | struct input_config *input_config; | 525 | struct input_config *input_config; |
@@ -617,12 +629,6 @@ bool spawn_swaybg(void); | |||
617 | 629 | ||
618 | int workspace_output_cmp_workspace(const void *a, const void *b); | 630 | int workspace_output_cmp_workspace(const void *a, const void *b); |
619 | 631 | ||
620 | int sway_binding_cmp(const void *a, const void *b); | ||
621 | |||
622 | int sway_binding_cmp_qsort(const void *a, const void *b); | ||
623 | |||
624 | int sway_binding_cmp_keys(const void *a, const void *b); | ||
625 | |||
626 | void free_sway_binding(struct sway_binding *sb); | 632 | void free_sway_binding(struct sway_binding *sb); |
627 | 633 | ||
628 | void free_switch_binding(struct sway_switch_binding *binding); | 634 | void free_switch_binding(struct sway_switch_binding *binding); |
@@ -651,6 +657,16 @@ void free_workspace_config(struct workspace_config *wsc); | |||
651 | */ | 657 | */ |
652 | void config_update_font_height(bool recalculate); | 658 | void config_update_font_height(bool recalculate); |
653 | 659 | ||
660 | /** | ||
661 | * Convert bindsym into bindcode using the first configured layout. | ||
662 | * Return false in case the conversion is unsuccessful. | ||
663 | */ | ||
664 | bool translate_binding(struct sway_binding *binding); | ||
665 | |||
666 | void translate_keysyms(const char *layout); | ||
667 | |||
668 | void binding_add_translated(struct sway_binding *binding, list_t *bindings); | ||
669 | |||
654 | /* Global config singleton. */ | 670 | /* Global config singleton. */ |
655 | extern struct sway_config *config; | 671 | extern struct sway_config *config; |
656 | 672 | ||