summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2015-08-20 16:54:45 +0800
committerJonas Ådahl <jadahl@gmail.com>2015-09-13 21:24:58 +0800
commitdece49b53dcefc59c199850e543eba99a2e5d27a (patch)
treef5c933e2016579e3fc28df92a4b508529ff93384
parent443d579d402d82ae6b178036266f46576f9e2fbc (diff)
downloadmutter-dece49b53dcefc59c199850e543eba99a2e5d27a.tar.gz
wayland: Introduce XWayland surface role
Being a "XWayland window" should be considered equivalent to a role, even though it is not part of any protocol anywhere. The commit doesn't have any functional difference, but just makes it clear that an wl_surface managed by XWayland have the same type of special casing as surface roles as defined by the Wayland protocol. As the semantics are more explicit given the role is defined, a comment explaining why the semantics need to be how they are was added. https://bugzilla.gnome.org/show_bug.cgi?id=744932
-rw-r--r--src/wayland/meta-wayland-surface.c13
-rw-r--r--src/wayland/meta-wayland-surface.h1
-rw-r--r--src/wayland/meta-xwayland.c10
3 files changed, 24 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 369d01d84..14956860e 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -543,6 +543,18 @@ apply_pending_state (MetaWaylandSurface *surface,
switch (surface->role)
{
case META_WAYLAND_SURFACE_ROLE_NONE:
+ case META_WAYLAND_SURFACE_ROLE_XWAYLAND:
+ /* For Xwayland windows, throttling frames when the window isn't actually
+ * drawn is less useful, because Xwayland still has to do the drawing
+ * sent from the application - the throttling would only be of sending us
+ * damage messages, so we simplify and send frame callbacks after the
+ * next paint of the screen, whether the window was drawn or not.
+ *
+ * Currently it may take a few frames before we draw the window, for not
+ * completely understood reasons, and in that case, not thottling frame
+ * callbacks to drawing has the happy side effect that we avoid showing
+ * the user the initial black frame from when the window is mapped empty.
+ */
case META_WAYLAND_SURFACE_ROLE_CURSOR:
case META_WAYLAND_SURFACE_ROLE_DND:
wl_list_insert_list (&compositor->frame_callbacks, &pending->frame_callback_list);
@@ -560,6 +572,7 @@ apply_pending_state (MetaWaylandSurface *surface,
switch (surface->role)
{
case META_WAYLAND_SURFACE_ROLE_NONE:
+ case META_WAYLAND_SURFACE_ROLE_XWAYLAND:
break;
case META_WAYLAND_SURFACE_ROLE_CURSOR:
cursor_surface_commit (surface, pending);
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index 7efb65f42..3ac2834fd 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -51,6 +51,7 @@ typedef enum
META_WAYLAND_SURFACE_ROLE_WL_SHELL_SURFACE,
META_WAYLAND_SURFACE_ROLE_CURSOR,
META_WAYLAND_SURFACE_ROLE_DND,
+ META_WAYLAND_SURFACE_ROLE_XWAYLAND,
} MetaWaylandSurfaceRole;
typedef struct
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index cb7072466..ba2c19192 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -45,6 +45,16 @@ associate_window_with_surface (MetaWindow *window,
if (window->surface)
window->surface->window = NULL;
+ if (!meta_wayland_surface_assign_role (surface,
+ META_WAYLAND_SURFACE_ROLE_XWAYLAND))
+ {
+ wl_resource_post_error (surface->resource,
+ WL_DISPLAY_ERROR_INVALID_OBJECT,
+ "wl_surface@%d already has a different role",
+ wl_resource_get_id (surface->resource));
+ return;
+ }
+
meta_wayland_surface_set_window (surface, window);
window->surface = surface;