diff options
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/sway/config.c b/sway/config.c index fde386c7..1ddedc7e 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -991,31 +991,11 @@ int workspace_output_cmp_workspace(const void *a, const void *b) { | |||
991 | return lenient_strcmp(wsa->workspace, wsb->workspace); | 991 | return lenient_strcmp(wsa->workspace, wsb->workspace); |
992 | } | 992 | } |
993 | 993 | ||
994 | static void find_font_height_iterator(struct sway_container *con, void *data) { | ||
995 | size_t amount_below_baseline = con->title_height - con->title_baseline; | ||
996 | size_t extended_height = config->font_baseline + amount_below_baseline; | ||
997 | if (extended_height > config->font_height) { | ||
998 | config->font_height = extended_height; | ||
999 | } | ||
1000 | } | ||
1001 | |||
1002 | static void find_baseline_iterator(struct sway_container *con, void *data) { | ||
1003 | bool *recalculate = data; | ||
1004 | if (*recalculate) { | ||
1005 | container_calculate_title_height(con); | ||
1006 | } | ||
1007 | if (con->title_baseline > config->font_baseline) { | ||
1008 | config->font_baseline = con->title_baseline; | ||
1009 | } | ||
1010 | } | ||
1011 | 994 | ||
1012 | void config_update_font_height(bool recalculate) { | 995 | void config_update_font_height(void) { |
1013 | size_t prev_max_height = config->font_height; | 996 | int prev_max_height = config->font_height; |
1014 | config->font_height = 0; | ||
1015 | config->font_baseline = 0; | ||
1016 | 997 | ||
1017 | root_for_each_container(find_baseline_iterator, &recalculate); | 998 | get_text_metrics(config->font, &config->font_height, &config->font_baseline); |
1018 | root_for_each_container(find_font_height_iterator, NULL); | ||
1019 | 999 | ||
1020 | if (config->font_height != prev_max_height) { | 1000 | if (config->font_height != prev_max_height) { |
1021 | arrange_root(); | 1001 | arrange_root(); |