xwm: move frame_set_title() into draw_decoration()

The only thing using the frame title is frame_repaint(). Move the call
to frame_set_title() from weston_wm_window_read_properties() into
weston_wm_window_draw_decoration() where the only call to
frame_repaint() is.

Do not check for window->name == NULL, because frame_set_title() handles
NULL just fine. Also, once window->name becomes set, it cannot become
NULL again unless strndup() fails. The name string can be reset to
the empty string in any case.

This change is prompted by future refactoring where at
weston_wm_window_read_properties() time the frame might not have been
created yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Pekka Paalanen 2016-12-15 15:37:24 +02:00
parent 20111d5d53
commit 9a330e1abb

View file

@ -598,8 +598,6 @@ weston_wm_window_read_properties(struct weston_wm_window *window)
if (window->shsurf && window->name)
xwayland_interface->set_title(window->shsurf, window->name);
if (window->frame && window->name)
frame_set_title(window->frame, window->name);
if (window->shsurf && window->pid > 0)
xwayland_interface->set_pid(window->shsurf, window->pid);
}
@ -1136,6 +1134,7 @@ weston_wm_window_draw_decoration(void *data)
if (wm->focus_window == window)
flags |= THEME_FRAME_ACTIVE;
frame_set_title(window->frame, window->name);
frame_repaint(window->frame, cr);
} else {
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);