aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Hugo Osvaldo Barrera <hugo@barrera.io>2021-09-17 17:32:29 +0200
committerLibravatar Simon Ser <contact@emersion.fr>2021-09-20 09:25:47 +0200
commitc16b2a26ed2c2f718cb8a2084fa93636fabed95f (patch)
tree2a0ea215552cf497f2f6b4f25552975eb33781b0 /sway/config.c
parentsway-ipc.7.scd: fix typo (diff)
downloadsway-c16b2a26ed2c2f718cb8a2084fa93636fabed95f.tar.gz
sway-c16b2a26ed2c2f718cb8a2084fa93636fabed95f.tar.zst
sway-c16b2a26ed2c2f718cb8a2084fa93636fabed95f.zip
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/config.c')
-rw-r--r--sway/config.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c
index 1ddedc7e..6d0f465a 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -237,6 +237,7 @@ static void config_defaults(struct sway_config *config) {
237 config->default_orientation = L_NONE; 237 config->default_orientation = L_NONE;
238 if (!(config->font = strdup("monospace 10"))) goto cleanup; 238 if (!(config->font = strdup("monospace 10"))) goto cleanup;
239 config->font_height = 17; // height of monospace 10 239 config->font_height = 17; // height of monospace 10
240 config->font_baseline = 11; // baselint of monospace 10
240 config->urgent_timeout = 500; 241 config->urgent_timeout = 500;
241 config->focus_on_window_activation = FOWA_URGENT; 242 config->focus_on_window_activation = FOWA_URGENT;
242 config->popup_during_fullscreen = POPUP_SMART; 243 config->popup_during_fullscreen = POPUP_SMART;