diff options
Diffstat (limited to 'include/sway/config.h')
-rw-r--r-- | include/sway/config.h | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 2e24c3ae..0be1cd22 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -10,12 +10,15 @@ | |||
10 | #include <xkbcommon/xkbcommon.h> | 10 | #include <xkbcommon/xkbcommon.h> |
11 | #include <xf86drmMode.h> | 11 | #include <xf86drmMode.h> |
12 | #include "../include/config.h" | 12 | #include "../include/config.h" |
13 | #include "gesture.h" | ||
13 | #include "list.h" | 14 | #include "list.h" |
15 | #include "stringop.h" | ||
14 | #include "swaynag.h" | 16 | #include "swaynag.h" |
15 | #include "tree/container.h" | 17 | #include "tree/container.h" |
16 | #include "sway/input/tablet.h" | 18 | #include "sway/input/tablet.h" |
17 | #include "sway/tree/root.h" | 19 | #include "sway/tree/root.h" |
18 | #include "wlr-layer-shell-unstable-v1-protocol.h" | 20 | #include "wlr-layer-shell-unstable-v1-protocol.h" |
21 | #include <pango/pangocairo.h> | ||
19 | 22 | ||
20 | // TODO: Refactor this shit | 23 | // TODO: Refactor this shit |
21 | 24 | ||
@@ -32,7 +35,8 @@ enum binding_input_type { | |||
32 | BINDING_KEYSYM, | 35 | BINDING_KEYSYM, |
33 | BINDING_MOUSECODE, | 36 | BINDING_MOUSECODE, |
34 | BINDING_MOUSESYM, | 37 | BINDING_MOUSESYM, |
35 | BINDING_SWITCH | 38 | BINDING_SWITCH, // dummy, only used to call seat_execute_command |
39 | BINDING_GESTURE // dummy, only used to call seat_execute_command | ||
36 | }; | 40 | }; |
37 | 41 | ||
38 | enum binding_flags { | 42 | enum binding_flags { |
@@ -45,6 +49,7 @@ enum binding_flags { | |||
45 | BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload | 49 | BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload |
46 | BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor | 50 | BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor |
47 | BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key | 51 | BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key |
52 | BINDING_EXACT = 1 << 9, // gesture only; only trigger on exact match | ||
48 | }; | 53 | }; |
49 | 54 | ||
50 | /** | 55 | /** |
@@ -79,6 +84,16 @@ struct sway_switch_binding { | |||
79 | }; | 84 | }; |
80 | 85 | ||
81 | /** | 86 | /** |
87 | * A gesture binding and an associated command. | ||
88 | */ | ||
89 | struct sway_gesture_binding { | ||
90 | char *input; | ||
91 | uint32_t flags; | ||
92 | struct gesture gesture; | ||
93 | char *command; | ||
94 | }; | ||
95 | |||
96 | /** | ||
82 | * Focus on window activation. | 97 | * Focus on window activation. |
83 | */ | 98 | */ |
84 | enum sway_fowa { | 99 | enum sway_fowa { |
@@ -97,6 +112,7 @@ struct sway_mode { | |||
97 | list_t *keycode_bindings; | 112 | list_t *keycode_bindings; |
98 | list_t *mouse_bindings; | 113 | list_t *mouse_bindings; |
99 | list_t *switch_bindings; | 114 | list_t *switch_bindings; |
115 | list_t *gesture_bindings; | ||
100 | bool pango; | 116 | bool pango; |
101 | }; | 117 | }; |
102 | 118 | ||
@@ -135,14 +151,17 @@ struct input_config { | |||
135 | int drag; | 151 | int drag; |
136 | int drag_lock; | 152 | int drag_lock; |
137 | int dwt; | 153 | int dwt; |
154 | int dwtp; | ||
138 | int left_handed; | 155 | int left_handed; |
139 | int middle_emulation; | 156 | int middle_emulation; |
140 | int natural_scroll; | 157 | int natural_scroll; |
141 | float pointer_accel; | 158 | float pointer_accel; |
159 | float rotation_angle; | ||
142 | float scroll_factor; | 160 | float scroll_factor; |
143 | int repeat_delay; | 161 | int repeat_delay; |
144 | int repeat_rate; | 162 | int repeat_rate; |
145 | int scroll_button; | 163 | int scroll_button; |
164 | int scroll_button_lock; | ||
146 | int scroll_method; | 165 | int scroll_method; |
147 | int send_events; | 166 | int send_events; |
148 | int tap; | 167 | int tap; |
@@ -232,12 +251,6 @@ struct seat_config { | |||
232 | } xcursor_theme; | 251 | } xcursor_theme; |
233 | }; | 252 | }; |
234 | 253 | ||
235 | enum config_dpms { | ||
236 | DPMS_IGNORE, | ||
237 | DPMS_ON, | ||
238 | DPMS_OFF, | ||
239 | }; | ||
240 | |||
241 | enum scale_filter_mode { | 254 | enum scale_filter_mode { |
242 | SCALE_FILTER_DEFAULT, // the default is currently smart | 255 | SCALE_FILTER_DEFAULT, // the default is currently smart |
243 | SCALE_FILTER_LINEAR, | 256 | SCALE_FILTER_LINEAR, |
@@ -259,6 +272,7 @@ enum render_bit_depth { | |||
259 | struct output_config { | 272 | struct output_config { |
260 | char *name; | 273 | char *name; |
261 | int enabled; | 274 | int enabled; |
275 | int power; | ||
262 | int width, height; | 276 | int width, height; |
263 | float refresh_rate; | 277 | float refresh_rate; |
264 | int custom_mode; | 278 | int custom_mode; |
@@ -275,7 +289,14 @@ struct output_config { | |||
275 | char *background; | 289 | char *background; |
276 | char *background_option; | 290 | char *background_option; |
277 | char *background_fallback; | 291 | char *background_fallback; |
278 | enum config_dpms dpms_state; | 292 | }; |
293 | |||
294 | /** | ||
295 | * An output config pre-matched to an output | ||
296 | */ | ||
297 | struct matched_output_config { | ||
298 | struct sway_output *output; | ||
299 | struct output_config *config; | ||
279 | }; | 300 | }; |
280 | 301 | ||
281 | /** | 302 | /** |
@@ -490,7 +511,8 @@ struct sway_config { | |||
490 | char *floating_scroll_right_cmd; | 511 | char *floating_scroll_right_cmd; |
491 | enum sway_container_layout default_orientation; | 512 | enum sway_container_layout default_orientation; |
492 | enum sway_container_layout default_layout; | 513 | enum sway_container_layout default_layout; |
493 | char *font; | 514 | char *font; // Used for IPC. |
515 | PangoFontDescription *font_description; // Used internally for rendering and validating. | ||
494 | int font_height; | 516 | int font_height; |
495 | int font_baseline; | 517 | int font_baseline; |
496 | bool pango_markup; | 518 | bool pango_markup; |
@@ -519,6 +541,7 @@ struct sway_config { | |||
519 | bool auto_back_and_forth; | 541 | bool auto_back_and_forth; |
520 | bool show_marks; | 542 | bool show_marks; |
521 | enum alignment title_align; | 543 | enum alignment title_align; |
544 | bool primary_selection; | ||
522 | 545 | ||
523 | bool tiling_drag; | 546 | bool tiling_drag; |
524 | int tiling_drag_threshold; | 547 | int tiling_drag_threshold; |
@@ -612,7 +635,7 @@ void run_deferred_bindings(void); | |||
612 | /** | 635 | /** |
613 | * Adds a warning entry to the swaynag instance used for errors. | 636 | * Adds a warning entry to the swaynag instance used for errors. |
614 | */ | 637 | */ |
615 | void config_add_swaynag_warning(char *fmt, ...); | 638 | void config_add_swaynag_warning(char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2); |
616 | 639 | ||
617 | /** | 640 | /** |
618 | * Free config struct | 641 | * Free config struct |
@@ -665,20 +688,22 @@ const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filt | |||
665 | 688 | ||
666 | struct output_config *new_output_config(const char *name); | 689 | struct output_config *new_output_config(const char *name); |
667 | 690 | ||
668 | void merge_output_config(struct output_config *dst, struct output_config *src); | 691 | bool apply_output_configs(struct matched_output_config *configs, |
692 | size_t configs_len, bool test_only); | ||
669 | 693 | ||
670 | bool apply_output_config(struct output_config *oc, struct sway_output *output); | 694 | void apply_all_output_configs(void); |
671 | 695 | ||
672 | bool test_output_config(struct output_config *oc, struct sway_output *output); | 696 | /** |
673 | 697 | * store_output_config stores a new output config. An output may be matched by | |
674 | struct output_config *store_output_config(struct output_config *oc); | 698 | * three different config types, in order of precedence: Identifier, name and |
699 | * wildcard. When storing a config type of lower precedence, assume that the | ||
700 | * user wants the config to take immediate effect by superseding (clearing) the | ||
701 | * same values from higher presedence configuration. | ||
702 | */ | ||
703 | void store_output_config(struct output_config *oc); | ||
675 | 704 | ||
676 | struct output_config *find_output_config(struct sway_output *output); | 705 | struct output_config *find_output_config(struct sway_output *output); |
677 | 706 | ||
678 | void apply_output_config_to_outputs(struct output_config *oc); | ||
679 | |||
680 | void reset_outputs(void); | ||
681 | |||
682 | void free_output_config(struct output_config *oc); | 707 | void free_output_config(struct output_config *oc); |
683 | 708 | ||
684 | bool spawn_swaybg(void); | 709 | bool spawn_swaybg(void); |
@@ -689,6 +714,8 @@ void free_sway_binding(struct sway_binding *sb); | |||
689 | 714 | ||
690 | void free_switch_binding(struct sway_switch_binding *binding); | 715 | void free_switch_binding(struct sway_switch_binding *binding); |
691 | 716 | ||
717 | void free_gesture_binding(struct sway_gesture_binding *binding); | ||
718 | |||
692 | void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); | 719 | void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); |
693 | 720 | ||
694 | void load_swaybar(struct bar_config *bar); | 721 | void load_swaybar(struct bar_config *bar); |
@@ -706,7 +733,7 @@ void free_workspace_config(struct workspace_config *wsc); | |||
706 | /** | 733 | /** |
707 | * Updates the value of config->font_height based on the metrics for title's | 734 | * Updates the value of config->font_height based on the metrics for title's |
708 | * font as reported by pango. | 735 | * font as reported by pango. |
709 | * | 736 | * |
710 | * If the height has changed, all containers will be rearranged to take on the | 737 | * If the height has changed, all containers will be rearranged to take on the |
711 | * new size. | 738 | * new size. |
712 | */ | 739 | */ |