Don't use title content in size calculations

This prevents distracting screen flashing and seems to work fine
for larger glyphs as well (Tested with Japanese).

This is perhaps not the best solution, but it's much less noticeable
than the current behaviour.

Fixes #4992
This commit is contained in:
Jarkko Oranen 2020-03-13 21:33:05 +02:00
parent 55016729a5
commit dc76c52c30

View file

@ -513,8 +513,16 @@ void container_calculate_title_height(struct sway_container *container) {
cairo_t *cairo = cairo_create(NULL);
int height;
int baseline;
get_text_size(cairo, config->font, NULL, &height, &baseline, 1,
/* Calculate height using regular ASCII characters and allow larger glyphs to
* "leak" into the margins. This avoids distracting height changes if switching
* between containers that have differently sized text.
* Larger characters might get cut off, but affected users can work around it by
* increasing the title margins */
get_text_size(cairo, config->font, NULL, &height, NULL, 1,
config->pango_markup, "%s", "ASCII Baseline");
get_text_size(cairo, config->font, NULL, NULL, &baseline, 1,
config->pango_markup, "%s", container->formatted_title);
cairo_destroy(cairo);
container->title_height = height;
container->title_baseline = baseline;