[mutter/wip/surface-content: 13/13] window: Delay the showing of XWayland clients until set_window_id
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/surface-content: 13/13] window: Delay the showing of XWayland clients until set_window_id
- Date: Wed, 29 Jan 2014 15:31:56 +0000 (UTC)
commit 6d7a843fe3973273d91590c260296d3a874b8ad4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jan 16 17:48:52 2014 -0500
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.
src/core/window.c | 13 +++++++++----
src/wayland/meta-xwayland.c | 14 +++++++++++---
2 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 139551f..c6cdbcd 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -845,7 +845,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)
@@ -875,7 +874,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
@@ -1431,7 +1430,6 @@ meta_window_new_for_wayland (MetaDisplay *display,
META_WINDOW_CLIENT_TYPE_WAYLAND,
surface,
None,
- FALSE,
WithdrawnState,
META_COMP_EFFECT_CREATE,
&attrs);
@@ -1613,11 +1611,18 @@ meta_window_new (MetaDisplay *display,
META_WINDOW_CLIENT_TYPE_X11,
NULL,
xwindow,
- TRUE,
existing_wm_state,
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;
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 44f6c41..3e43aeb 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -44,11 +44,19 @@ xserver_set_window_id (struct wl_client *client,
MetaWindow *window;
window = meta_display_lookup_x_window (display, xid);
- if (window)
+ if (!window)
{
- surface->window = window;
- window->surface = surface;
+ wl_resource_post_error (wl_client_get_display (client),
+ WL_DISPLAY_ERROR_INVALID_OBJECT,
+ "No window for surface %lx from Wayland surface %d",
+ xid, wl_resource_get_id (surface_resource));
+ return;
}
+
+ surface->window = window;
+ window->surface = surface;
+
+ meta_window_set_surface_mapped (window, TRUE);
}
static const struct xserver_interface xserver_implementation = {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]