window: Delay the showing of XWayland clients until set_window_id

Use our new "surface_mapped" field to delay the showing of XWayland clients
until we have associated together the window's XID and the Wayland surface ID.

This ensures that when we show this window to the compositor, it will properly
use the Wayland surface for rendering, rather than trying to use COMPOSITE and
crash.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
This commit is contained in:
Jasper St. Pierre 2014-02-01 19:16:25 -05:00
parent 6dbb3fddce
commit 59c8b949ad
2 changed files with 11 additions and 3 deletions

View File

@ -833,7 +833,6 @@ meta_window_new_shared (MetaDisplay *display,
MetaWindowClientType client_type,
MetaWaylandSurface *surface,
Window xwindow,
gboolean surface_mapped,
gulong existing_wm_state,
MetaCompEffect effect,
XWindowAttributes *attrs)
@ -863,7 +862,7 @@ meta_window_new_shared (MetaDisplay *display,
window->client_type = client_type;
window->surface = surface;
window->xwindow = xwindow;
window->surface_mapped = surface_mapped;
window->surface_mapped = FALSE;
/* this is in window->screen->display, but that's too annoying to
* type
@ -1413,7 +1412,6 @@ meta_window_new_for_wayland (MetaDisplay *display,
META_WINDOW_CLIENT_TYPE_WAYLAND,
surface,
None,
FALSE,
WithdrawnState,
META_COMP_EFFECT_CREATE,
&attrs);
@ -1585,6 +1583,14 @@ meta_window_new (MetaDisplay *display,
effect,
&attrs);
/* When running as an X compositor, we can simply show the window now.
*
* When running as a Wayland compositor, we need to wait until we see
* the Wayland surface appear. We will later call meta_window_set_surface_mapped()
* to show the window in our in our set_surface_id implementation */
if (!meta_is_wayland_compositor ())
meta_window_set_surface_mapped (window, TRUE);
meta_error_trap_pop (display); /* pop the XSync()-reducing trap */
return window;

View File

@ -49,6 +49,8 @@ xserver_set_window_id (struct wl_client *client,
surface->window = window;
window->surface = surface;
meta_window_set_surface_mapped (window, TRUE);
}
static const struct xserver_interface xserver_implementation = {