summaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/sway/config.c b/sway/config.c
index 89701640..6ff4da03 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -807,22 +807,31 @@ int workspace_output_cmp_workspace(const void *a, const void *b) {
807 return lenient_strcmp(wsa->workspace, wsb->workspace); 807 return lenient_strcmp(wsa->workspace, wsb->workspace);
808} 808}
809 809
810static void find_font_height_iterator(struct sway_container *container, 810static void find_font_height_iterator(struct sway_container *con, void *data) {
811 void *data) { 811 size_t amount_below_baseline = con->title_height - con->title_baseline;
812 size_t extended_height = config->font_baseline + amount_below_baseline;
813 if (extended_height > config->font_height) {
814 config->font_height = extended_height;
815 }
816}
817
818static void find_baseline_iterator(struct sway_container *con, void *data) {
812 bool *recalculate = data; 819 bool *recalculate = data;
813 if (*recalculate) { 820 if (*recalculate) {
814 container_calculate_title_height(container); 821 container_calculate_title_height(con);
815 } 822 }
816 if (container->title_height > config->font_height) { 823 if (con->title_baseline > config->font_baseline) {
817 config->font_height = container->title_height; 824 config->font_baseline = con->title_baseline;
818 } 825 }
819} 826}
820 827
821void config_update_font_height(bool recalculate) { 828void config_update_font_height(bool recalculate) {
822 size_t prev_max_height = config->font_height; 829 size_t prev_max_height = config->font_height;
823 config->font_height = 0; 830 config->font_height = 0;
831 config->font_baseline = 0;
824 832
825 root_for_each_container(find_font_height_iterator, &recalculate); 833 root_for_each_container(find_baseline_iterator, &recalculate);
834 root_for_each_container(find_font_height_iterator, NULL);
826 835
827 if (config->font_height != prev_max_height) { 836 if (config->font_height != prev_max_height) {
828 arrange_root(); 837 arrange_root();