diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-09-08 09:19:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-08 09:19:47 -0400 |
commit | 3600b3db577298bc553c394a4b09e71163f76561 (patch) | |
tree | a1defcadae4b1d07388fd9e6bfe2a09051aec777 /sway/config.c | |
parent | 030b5bc02455bc936a9a7fedc05c3f9b7c813098 (diff) | |
parent | 9215ca0f01f7d155191d11fd9caa2574387c6f84 (diff) |
Merge pull request #2602 from RyanDwyer/fix-title-textures
Fix gaps in title textures and vertically center them
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 21 |
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) { return lenient_strcmp(wsa->workspace, wsb->workspace); } -static void find_font_height_iterator(struct sway_container *container, - void *data) { +static void find_font_height_iterator(struct sway_container *con, void *data) { + size_t amount_below_baseline = con->title_height - con->title_baseline; + size_t extended_height = config->font_baseline + amount_below_baseline; + if (extended_height > config->font_height) { + config->font_height = extended_height; + } +} + +static void find_baseline_iterator(struct sway_container *con, void *data) { bool *recalculate = data; if (*recalculate) { - container_calculate_title_height(container); + container_calculate_title_height(con); } - if (container->title_height > config->font_height) { - config->font_height = container->title_height; + if (con->title_baseline > config->font_baseline) { + config->font_baseline = con->title_baseline; } } void config_update_font_height(bool recalculate) { size_t prev_max_height = config->font_height; config->font_height = 0; + config->font_baseline = 0; - root_for_each_container(find_font_height_iterator, &recalculate); + root_for_each_container(find_baseline_iterator, &recalculate); + root_for_each_container(find_font_height_iterator, NULL); if (config->font_height != prev_max_height) { arrange_root(); |