diff options
author | 2016-03-30 00:59:40 +0200 | |
---|---|---|
committer | 2016-03-30 01:01:05 +0200 | |
commit | 6fa6c27f3d5f0f49a050cda6c952ad2595e25f32 (patch) | |
tree | 18b9e8de9d753202e414712be8a571958a09e714 /sway | |
parent | Mark focused view focus_inactive on unfocused output (diff) | |
download | sway-6fa6c27f3d5f0f49a050cda6c952ad2595e25f32.tar.gz sway-6fa6c27f3d5f0f49a050cda6c952ad2595e25f32.tar.zst sway-6fa6c27f3d5f0f49a050cda6c952ad2595e25f32.zip |
Update window title when it changes
Diffstat (limited to 'sway')
-rw-r--r-- | sway/border.c | 23 |
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 | |||
157 | render_sharp_line(cr, colors->border, 0, 0, tb->size.w, 1); | 157 | render_sharp_line(cr, colors->border, 0, 0, tb->size.w, 1); |
158 | 158 | ||
159 | // text | 159 | // text |
160 | int width, height; | 160 | if (view->name) { |
161 | get_text_size(cr, config->font, &width, &height, "%s", view->name); | 161 | int width, height; |
162 | cairo_move_to(cr, view->border_thickness, 2); | 162 | get_text_size(cr, config->font, &width, &height, "%s", view->name); |
163 | cairo_set_source_u32(cr, colors->text); | 163 | cairo_move_to(cr, view->border_thickness, 2); |
164 | pango_printf(cr, config->font, "%s", view->name); | 164 | cairo_set_source_u32(cr, colors->text); |
165 | pango_printf(cr, config->font, "%s", view->name); | ||
166 | } | ||
165 | 167 | ||
166 | // header bottom line | 168 | // header bottom line |
167 | render_sharp_line(cr, colors->border, | 169 | render_sharp_line(cr, colors->border, |
@@ -247,6 +249,17 @@ void render_view_borders(wlc_handle view) { | |||
247 | return; | 249 | return; |
248 | } | 250 | } |
249 | 251 | ||
252 | if (c->border_type == B_NORMAL) { | ||
253 | // update window title | ||
254 | const char *new_name = wlc_view_get_title(view); | ||
255 | |||
256 | if (new_name && strcmp(c->name, new_name) != 0) { | ||
257 | free(c->name); | ||
258 | c->name = strdup(new_name); | ||
259 | update_view_border(c); | ||
260 | } | ||
261 | } | ||
262 | |||
250 | if (c->border) { | 263 | if (c->border) { |
251 | wlc_pixels_write(WLC_RGBA8888, &c->border_geometry, c->border); | 264 | wlc_pixels_write(WLC_RGBA8888, &c->border_geometry, c->border); |
252 | } | 265 | } |