aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorHugo Osvaldo Barrera <hugo@barrera.io>2021-09-17 17:32:29 +0200
committerSimon Ser <contact@emersion.fr>2021-09-20 09:25:47 +0200
commitc16b2a26ed2c2f718cb8a2084fa93636fabed95f (patch)
tree2a0ea215552cf497f2f6b4f25552975eb33781b0 /sway/commands
parent49da73d4ac3ad85e8d271e1a0cb778280c2c434d (diff)
Avoid unecessary font metric calculations
Prior to 62d90a8e, titlebar's font height (and other related values) would change any time any titlebar's content changed, so these values were recalculated each time any titlebar's content changed (or a new titlebar was created). However, since the above was merge, these values no longer change so often and we only need to recalculate them when the configured font changes (and stop calling `config_update_font_height` each time titlebars are rendered). This commit removes all the unecessary calls to this function and avoids all those unecessary calculations. Whenever the font strays from the default value, the `font` command is called, and it calls `config_update_font_height`, which is enough to keep the value always up to date. I've also added a default value to the `font_baseline` config, since otherwise that's zero for setups that don't explicitly specify a font.
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/reload.c1
-rw-r--r--sway/commands/title_format.c1
2 files changed, 0 insertions, 2 deletions
diff --git a/sway/commands/reload.c b/sway/commands/reload.c
index 09ccd9d4..76f14bba 100644
--- a/sway/commands/reload.c
+++ b/sway/commands/reload.c
@@ -48,7 +48,6 @@ static void do_reload(void *data) {
}
list_free_items_and_destroy(bar_ids);
- config_update_font_height();
root_for_each_container(rebuild_textures_iterator, NULL);
arrange_root();
diff --git a/sway/commands/title_format.c b/sway/commands/title_format.c
index 8d907e76..a2446b7e 100644
--- a/sway/commands/title_format.c
+++ b/sway/commands/title_format.c
@@ -23,6 +23,5 @@ struct cmd_results *cmd_title_format(int argc, char **argv) {
}
view->title_format = format;
view_update_title(view, true);
- config_update_font_height();
return cmd_results_new(CMD_SUCCESS, NULL);
}