From 6fa6c27f3d5f0f49a050cda6c952ad2595e25f32 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Date: Wed, 30 Mar 2016 00:59:40 +0200 Subject: Update window title when it changes --- sway/border.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sway/border.c b/sway/border.c index e820794f..ab4b70f6 100644 --- a/sway/border.c +++ b/sway/border.c @@ -157,11 +157,13 @@ static void render_with_title_bar(swayc_t *view, cairo_t *cr, struct border_colo render_sharp_line(cr, colors->border, 0, 0, tb->size.w, 1); // text - int width, height; - get_text_size(cr, config->font, &width, &height, "%s", view->name); - cairo_move_to(cr, view->border_thickness, 2); - cairo_set_source_u32(cr, colors->text); - pango_printf(cr, config->font, "%s", view->name); + if (view->name) { + int width, height; + get_text_size(cr, config->font, &width, &height, "%s", view->name); + cairo_move_to(cr, view->border_thickness, 2); + cairo_set_source_u32(cr, colors->text); + pango_printf(cr, config->font, "%s", view->name); + } // header bottom line render_sharp_line(cr, colors->border, @@ -247,6 +249,17 @@ void render_view_borders(wlc_handle view) { return; } + if (c->border_type == B_NORMAL) { + // update window title + const char *new_name = wlc_view_get_title(view); + + if (new_name && strcmp(c->name, new_name) != 0) { + free(c->name); + c->name = strdup(new_name); + update_view_border(c); + } + } + if (c->border) { wlc_pixels_write(WLC_RGBA8888, &c->border_geometry, c->border); } -- cgit v1.2.3