[PATCH weston v2 23/24] xwm: do not draw decor twice on map

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


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

Normal windows enter the MapRequest handler, which schedules drawing the
decorations. Then Xwayland realizes the window, which ends with a call
to xserver_map_shell_surface(). The decorations are already drawn, no
need to draw them a second time. However, MapRequest handler could not
set the pending state because the weston_surface did not exist at the
time, because it gets created only when Xwayland realizes the window,
which happens after XWM has forwarded the MapWindow in MapRequest
handler. Therefore set the pending state explicitly at the end.
Scheduling had it done much later anyway.

There is still the race between Xwayland committing and XWM setting the
pending state assuming the very next commit latches it in appropriately.
The race exists not because of Wayland, but because WL_SURFACE_ID comes
via X11, and could be processed after wl_compositor.create_surface and
wl_surface.commit. That commit/pending race is solved by a following patch.

For override-redirect windows weston_wm_window_schedule_repaint()
reduced into a call to weston_wm_window_set_pending_state_OR(), so we
can just call that directly. It should not matter that the call is moved
to the end of the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 xwayland/window-manager.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 38d530f..95164f9 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -2679,8 +2679,6 @@ xserver_map_shell_surface(struct weston_wm_window *window,
 	wl_signal_add(&window->surface->destroy_signal,
 		      &window->surface_destroy_listener);
 
-	weston_wm_window_schedule_repaint(window);
-
 	if (!xwayland_interface)
 		return;
 
@@ -2740,6 +2738,11 @@ xserver_map_shell_surface(struct weston_wm_window *window,
 			xwayland_interface->set_toplevel(window->shsurf);
 		}
 	}
+
+	if (window->frame_id == XCB_WINDOW_NONE)
+		weston_wm_window_set_pending_state_OR(window);
+	else
+		weston_wm_window_set_pending_state(window);
 }
 
 const struct weston_xwayland_surface_api surface_api = {
-- 
2.10.2



More information about the wayland-devel mailing list