diff --git a/clutter/wayland/clutter-wayland-surface.c b/clutter/wayland/clutter-wayland-surface.c index e16c3ff34..9ee40359a 100644 --- a/clutter/wayland/clutter-wayland-surface.c +++ b/clutter/wayland/clutter-wayland-surface.c @@ -511,7 +511,7 @@ clutter_wayland_surface_new (struct wl_surface *surface) /** * clutter_wayland_surface_attach_buffer: * @self: A #ClutterWaylandSurface actor - * @buffer: A compositor side struct wl_buffer pointer + * @buffer: A compositor side resource representing a wl_buffer * @error: A #GError * * This associates a client's buffer with the #ClutterWaylandSurface @@ -523,7 +523,7 @@ clutter_wayland_surface_new (struct wl_surface *surface) */ gboolean clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self, - struct wl_buffer *buffer, + struct wl_resource *buffer, GError **error) { ClutterWaylandSurfacePrivate *priv; @@ -536,8 +536,6 @@ clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self, free_surface_buffers (self); - set_size (self, buffer->width, buffer->height); - priv->buffer = cogl_wayland_texture_2d_new_from_buffer (context, buffer, error); @@ -551,13 +549,17 @@ clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self, if (!priv->buffer) return FALSE; + set_size (self, + cogl_texture_get_width (COGL_TEXTURE (priv->buffer)), + cogl_texture_get_height (COGL_TEXTURE (priv->buffer))); + return TRUE; } /** * clutter_wayland_surface_damage_buffer: * @self: A #ClutterWaylandSurface actor - * @buffer: A compositor side struct wl_buffer pointer + * @buffer: A wayland resource for a buffer * @x: The x coordinate of the damaged rectangle * @y: The y coordinate of the damaged rectangle * @width: The width of the damaged rectangle @@ -575,23 +577,26 @@ clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self, */ void clutter_wayland_surface_damage_buffer (ClutterWaylandSurface *self, - struct wl_buffer *buffer, + struct wl_resource *buffer, gint32 x, gint32 y, gint32 width, gint32 height) { ClutterWaylandSurfacePrivate *priv; + struct wl_shm_buffer *shm_buffer; g_return_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self)); priv = self->priv; - if (priv->buffer && wl_buffer_is_shm (buffer)) + shm_buffer = wl_shm_buffer_get (buffer); + + if (priv->buffer && shm_buffer) { CoglPixelFormat format; - switch (wl_shm_buffer_get_format (buffer)) + switch (wl_shm_buffer_get_format (shm_buffer)) { #if G_BYTE_ORDER == G_BIG_ENDIAN case WL_SHM_FORMAT_ARGB8888: @@ -619,8 +624,8 @@ clutter_wayland_surface_damage_buffer (ClutterWaylandSurface *self, width, height, width, height, format, - wl_shm_buffer_get_stride (buffer), - wl_shm_buffer_get_data (buffer)); + wl_shm_buffer_get_stride (shm_buffer), + wl_shm_buffer_get_data (shm_buffer)); } g_signal_emit (self, signals[QUEUE_DAMAGE_REDRAW], diff --git a/clutter/wayland/clutter-wayland-surface.h b/clutter/wayland/clutter-wayland-surface.h index b68483ec7..da051e4af 100644 --- a/clutter/wayland/clutter-wayland-surface.h +++ b/clutter/wayland/clutter-wayland-surface.h @@ -95,10 +95,10 @@ void clutter_wayland_surface_set_surface (ClutterWaylandSurface * struct wl_surface *surface); struct wl_surface *clutter_wayland_surface_get_surface (ClutterWaylandSurface *self); gboolean clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self, - struct wl_buffer *buffer, + struct wl_resource *buffer, GError **error); void clutter_wayland_surface_damage_buffer (ClutterWaylandSurface *self, - struct wl_buffer *buffer, + struct wl_resource *buffer, gint32 x, gint32 y, gint32 width,