aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-30 00:59:40 +0200
committerMikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-30 01:01:05 +0200
commit6fa6c27f3d5f0f49a050cda6c952ad2595e25f32 (patch)
tree18b9e8de9d753202e414712be8a571958a09e714
parent7878de5ccc223baa609770e04efa151f5b99b16d (diff)
Update window title when it changes
-rw-r--r--sway/border.c23
1 files 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);
}