aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPuck Meerburg <puck@puckipedia.com>2022-08-07 10:12:05 +0000
committerSimon Ser <contact@emersion.fr>2022-10-30 10:57:19 +0100
commit0fdeb4ca843c847abc3c089dd9ab80f1e285497f (patch)
treefe821265d298eec9b14a2f3d3083bc65ea1b8f94
parent7cc8ab6d6c4e7ebbfee832b3d8d8fd86623d89fc (diff)
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.
-rw-r--r--sway/tree/view.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 7d9e038d..0004ed14 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -1282,21 +1282,23 @@ void view_update_title(struct sway_view *view, bool force) {
free(view->container->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));
if (!sway_assert(buffer, "Unable to allocate title string")) {
return;
}
- parse_title_format(view, buffer);
- view->container->title = strdup(title);
+ parse_title_format(view, buffer);
view->container->formatted_title = buffer;
} else {
- view->container->title = NULL;
view->container->formatted_title = NULL;
}
+ view->container->title = title ? strdup(title) : NULL;
+
// Update title after the global font height is updated
container_update_title_textures(view->container);