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;