From 7841042a85361923ecfe0100456fca33cace6559 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 25 Nov 2013 17:35:44 -0500 Subject: [PATCH] wayland-surface: Restructure code flow in wl_surface_attach a bit more... --- src/compositor/meta-surface-actor.c | 6 +++++- src/wayland/meta-wayland-surface.c | 33 ++++++++++++----------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c index 6697ff1b2..ff71b4618 100644 --- a/src/compositor/meta-surface-actor.c +++ b/src/compositor/meta-surface-actor.c @@ -156,7 +156,11 @@ meta_surface_actor_attach_wayland_buffer (MetaSurfaceActor *self, { MetaSurfaceActorPrivate *priv = self->priv; priv->buffer = buffer; - meta_shaped_texture_set_texture (self->priv->texture, buffer->texture); + + if (buffer) + meta_shaped_texture_set_texture (self->priv->texture, buffer->texture); + else + meta_shaped_texture_set_texture (self->priv->texture, NULL); } void diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 7ee6f21e3..23b816e90 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -286,33 +286,28 @@ toplevel_surface_commit (MetaWaylandSurface *surface) { ensure_buffer_texture (buffer); meta_wayland_buffer_reference (&surface->buffer_ref, buffer); + meta_surface_actor_attach_wayland_buffer (surface_actor, buffer); + surface_process_damage (surface, surface->pending.damage); meta_window_set_surface_mapped (window, buffer != NULL); - if (buffer != NULL) + /* We resize X based surfaces according to X events */ + if (buffer != NULL && window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND) { - meta_surface_actor_attach_wayland_buffer (surface_actor, buffer); + int new_width; + int new_height; - /* We resize X based surfaces according to X events */ - if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND) - { - int new_width; - int new_height; - - new_width = surface->buffer_ref.buffer->width; - new_height = surface->buffer_ref.buffer->height; - if (new_width != window->rect.width || - new_height != window->rect.height || - surface->pending.dx != 0 || - surface->pending.dy != 0) - meta_window_move_resize_wayland (window, new_width, new_height, - surface->pending.dx, surface->pending.dy); - } + new_width = surface->buffer_ref.buffer->width; + new_height = surface->buffer_ref.buffer->height; + if (new_width != window->rect.width || + new_height != window->rect.height || + surface->pending.dx != 0 || + surface->pending.dy != 0) + meta_window_move_resize_wayland (window, new_width, new_height, + surface->pending.dx, surface->pending.dy); } } - surface_process_damage (surface, surface->pending.damage); - if (surface->pending.opaque_region) meta_surface_actor_set_opaque_region (surface_actor, surface->pending.opaque_region); if (surface->pending.input_region)