[PATCH weston v2 11/24] xwm: move frame_set_title() into draw_decoration()

Pekka Paalanen ppaalanen at gmail.com
Wed Dec 21 14:40:09 UTC 2016


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

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 at collabora.co.uk>
---
 xwayland/window-manager.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index c4220ab..e2b1ebf 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -602,8 +602,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);
 }
@@ -1144,6 +1142,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);
-- 
2.10.2



More information about the wayland-devel mailing list