Commit 8e8fa8e8 authored by Quentin Glidic's avatar Quentin Glidic Committed by Daniel Stone

libweston-desktop/xwayland: Make sure racy surfaces are properly mapped

This fixes a race between Xwayland committing the surface content via
the wl_surface, and the XWM setting the role of the surface.
We now keep track of the (first) content commit on the surface and
forward it to the shell when we finally get the role.
There is no need to track later changes, as the only way for Xwayland to
unmap a surface is to destroy it.
Signed-off-by: Quentin Glidic's avatarQuentin Glidic <>
Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <>
Acked-by: Daniel Stone's avatarDaniel Stone <>
parent 2006655b
......@@ -61,6 +61,7 @@ struct weston_desktop_xwayland_surface {
const struct weston_xwayland_client_interface *client_interface;
struct weston_geometry next_geometry;
bool has_next_geometry;
bool committed;
bool added;
enum weston_desktop_xwayland_surface_state state;
......@@ -99,6 +100,14 @@ weston_desktop_xwayland_surface_change_state(struct weston_desktop_xwayland_surf
surface->added = true;
if (surface->state == NONE && surface->committed)
/* We had a race, and wl_surface.commit() was
* faster, just fake a commit to map the
* surface */
0, 0);
} else if (surface->added) {
......@@ -133,6 +142,7 @@ weston_desktop_xwayland_surface_committed(struct weston_desktop_surface *dsurfac
struct weston_geometry oldgeom;
assert(dsurface == surface->surface);
surface->committed = true;
#ifdef WM_DEBUG
weston_log("%s: xwayland surface %p\n", __func__, surface);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment