mirror of
https://github.com/swaywm/sway.git
synced 2024-11-04 23:43:14 +00:00
tree: support formatting null titles
Any windows that have never had a title set visually behave closer to that of an empty title, but are unformattable, as the code bails out early on a NULL title.
This commit is contained in:
parent
7cc8ab6d6c
commit
0fdeb4ca84
|
@ -1282,21 +1282,23 @@ void view_update_title(struct sway_view *view, bool force) {
|
||||||
|
|
||||||
free(view->container->title);
|
free(view->container->title);
|
||||||
free(view->container->formatted_title);
|
free(view->container->formatted_title);
|
||||||
if (title) {
|
|
||||||
size_t len = parse_title_format(view, NULL);
|
size_t len = parse_title_format(view, NULL);
|
||||||
|
|
||||||
|
if (len) {
|
||||||
char *buffer = calloc(len + 1, sizeof(char));
|
char *buffer = calloc(len + 1, sizeof(char));
|
||||||
if (!sway_assert(buffer, "Unable to allocate title string")) {
|
if (!sway_assert(buffer, "Unable to allocate title string")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parse_title_format(view, buffer);
|
|
||||||
|
|
||||||
view->container->title = strdup(title);
|
parse_title_format(view, buffer);
|
||||||
view->container->formatted_title = buffer;
|
view->container->formatted_title = buffer;
|
||||||
} else {
|
} else {
|
||||||
view->container->title = NULL;
|
|
||||||
view->container->formatted_title = NULL;
|
view->container->formatted_title = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view->container->title = title ? strdup(title) : NULL;
|
||||||
|
|
||||||
// Update title after the global font height is updated
|
// Update title after the global font height is updated
|
||||||
container_update_title_textures(view->container);
|
container_update_title_textures(view->container);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue