summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Glidic <sardemff7+git@sardemff7.net>2017-12-08 11:10:53 +0100
committerDaniel Stone <daniels@collabora.com>2017-12-11 09:34:26 +0000
commit8e8fa8e885306f32342bfe19256c4df540273fc8 (patch)
tree5972358a9b977aaa18f31159b42debbd6aaf34be
parent2006655b31abee042f889dc5221cf2a894669d69 (diff)
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 <sardemff7+git@sardemff7.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Acked-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--libweston-desktop/xwayland.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c
index 002e2523..4b4407b9 100644
--- a/libweston-desktop/xwayland.c
+++ b/libweston-desktop/xwayland.c
@@ -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
weston_desktop_api_surface_added(surface->desktop,
surface->surface);
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 */
+ weston_desktop_api_committed(surface->desktop,
+ surface->surface,
+ 0, 0);
+
} else if (surface->added) {
weston_desktop_api_surface_removed(surface->desktop,
surface->surface);
@@ -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);