diff options
author | Hugo Osvaldo Barrera <hugo@barrera.io> | 2021-08-18 23:27:01 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-08-26 20:16:14 +0200 |
commit | 62d90a8e959c6edcc752e124a9928cfa2399fbd1 (patch) | |
tree | d7f26db04a7a57b3b304768631348e8450197ba4 /include/sway | |
parent | Update Pango font description URL in sway.5.scd (diff) | |
download | sway-62d90a8e959c6edcc752e124a9928cfa2399fbd1.tar.gz sway-62d90a8e959c6edcc752e124a9928cfa2399fbd1.tar.zst sway-62d90a8e959c6edcc752e124a9928cfa2399fbd1.zip |
Use fixed titlebar heights
Use fixed titlebar heights. The default height is calculated based on
font metrics for the configured font and current locale.
Some testing with titles with emoji and CJK characters (which are
substantially higher in my setup) shows that the titlebars retain their
initial value, text does shift up or down, and all titlebars always
remain aligned.
Also drop some also now-unecessary title_height calculations.
Makes also needed to be updated, since they should be positioned with
the same rules.
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/config.h | 13 | ||||
-rw-r--r-- | include/sway/tree/container.h | 7 |
2 files changed, 6 insertions, 14 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index b8327e9c..d6c29fe6 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -486,8 +486,8 @@ struct sway_config { | |||
486 | enum sway_container_layout default_orientation; | 486 | enum sway_container_layout default_orientation; |
487 | enum sway_container_layout default_layout; | 487 | enum sway_container_layout default_layout; |
488 | char *font; | 488 | char *font; |
489 | size_t font_height; | 489 | int font_height; |
490 | size_t font_baseline; | 490 | int font_baseline; |
491 | bool pango_markup; | 491 | bool pango_markup; |
492 | int titlebar_border_thickness; | 492 | int titlebar_border_thickness; |
493 | int titlebar_h_padding; | 493 | int titlebar_h_padding; |
@@ -696,14 +696,13 @@ void free_bar_binding(struct bar_binding *binding); | |||
696 | void free_workspace_config(struct workspace_config *wsc); | 696 | void free_workspace_config(struct workspace_config *wsc); |
697 | 697 | ||
698 | /** | 698 | /** |
699 | * Updates the value of config->font_height based on the max title height | 699 | * Updates the value of config->font_height based on the metrics for title's |
700 | * reported by each container. If recalculate is true, the containers will | 700 | * font as reported by pango. |
701 | * recalculate their heights before reporting. | 701 | * |
702 | * | ||
703 | * If the height has changed, all containers will be rearranged to take on the | 702 | * If the height has changed, all containers will be rearranged to take on the |
704 | * new size. | 703 | * new size. |
705 | */ | 704 | */ |
706 | void config_update_font_height(bool recalculate); | 705 | void config_update_font_height(void); |
707 | 706 | ||
708 | /** | 707 | /** |
709 | * Convert bindsym into bindcode using the first configured layout. | 708 | * Convert bindsym into bindcode using the first configured layout. |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 38ee68bd..97fa98c1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -119,8 +119,6 @@ struct sway_container { | |||
119 | struct wlr_texture *title_focused_inactive; | 119 | struct wlr_texture *title_focused_inactive; |
120 | struct wlr_texture *title_unfocused; | 120 | struct wlr_texture *title_unfocused; |
121 | struct wlr_texture *title_urgent; | 121 | struct wlr_texture *title_urgent; |
122 | size_t title_height; | ||
123 | size_t title_baseline; | ||
124 | 122 | ||
125 | list_t *marks; // char * | 123 | list_t *marks; // char * |
126 | struct wlr_texture *marks_focused; | 124 | struct wlr_texture *marks_focused; |
@@ -183,11 +181,6 @@ struct sway_container *container_flatten(struct sway_container *container); | |||
183 | 181 | ||
184 | void container_update_title_textures(struct sway_container *container); | 182 | void container_update_title_textures(struct sway_container *container); |
185 | 183 | ||
186 | /** | ||
187 | * Calculate the container's title_height property. | ||
188 | */ | ||
189 | void container_calculate_title_height(struct sway_container *container); | ||
190 | |||
191 | size_t container_build_representation(enum sway_container_layout layout, | 184 | size_t container_build_representation(enum sway_container_layout layout, |
192 | list_t *children, char *buffer); | 185 | list_t *children, char *buffer); |
193 | 186 | ||