wayland: Check for newly_attached everywhere

Instead of using commit_attached_buffer / actor_surface_commit.

We want to kill the return values of these methods because we
really should always be calling them, even if the surface doesn't
have a role.
This commit is contained in:
Jasper St. Pierre 2014-04-11 23:26:38 -07:00
parent d0f0be8b03
commit f0bf9c7fc3

View File

@ -145,42 +145,36 @@ ensure_buffer_texture (MetaWaylandBuffer *buffer)
buffer->texture = texture; buffer->texture = texture;
} }
static gboolean static void
commit_attached_buffer (MetaWaylandSurface *surface, commit_attached_buffer (MetaWaylandSurface *surface,
MetaWaylandDoubleBufferedState *pending) MetaWaylandDoubleBufferedState *pending)
{ {
/* wl_surface.attach */
if (pending->newly_attached) if (pending->newly_attached)
{ surface_set_buffer (surface, pending->buffer);
surface_set_buffer (surface, pending->buffer);
return TRUE;
}
else
return FALSE;
} }
static void static void
cursor_surface_commit (MetaWaylandSurface *surface, cursor_surface_commit (MetaWaylandSurface *surface,
MetaWaylandDoubleBufferedState *pending) MetaWaylandDoubleBufferedState *pending)
{ {
if (commit_attached_buffer (surface, pending)) commit_attached_buffer (surface, pending);
if (pending->newly_attached)
meta_wayland_seat_update_cursor_surface (surface->compositor->seat); meta_wayland_seat_update_cursor_surface (surface->compositor->seat);
} }
static gboolean static void
actor_surface_commit (MetaWaylandSurface *surface, actor_surface_commit (MetaWaylandSurface *surface,
MetaWaylandDoubleBufferedState *pending) MetaWaylandDoubleBufferedState *pending)
{ {
MetaSurfaceActor *surface_actor = surface->surface_actor; MetaSurfaceActor *surface_actor = surface->surface_actor;
MetaWaylandBuffer *buffer = pending->buffer;
gboolean buffer_changed;
buffer_changed = commit_attached_buffer (surface, pending); commit_attached_buffer (surface, pending);
if (buffer_changed && buffer) if (pending->newly_attached && pending->buffer)
{ {
ensure_buffer_texture (buffer); ensure_buffer_texture (pending->buffer);
meta_surface_actor_wayland_set_buffer (META_SURFACE_ACTOR_WAYLAND (surface->surface_actor), buffer); meta_surface_actor_wayland_set_buffer (META_SURFACE_ACTOR_WAYLAND (surface->surface_actor), pending->buffer);
} }
surface_process_damage (surface, pending->damage); surface_process_damage (surface, pending->damage);
@ -189,15 +183,15 @@ actor_surface_commit (MetaWaylandSurface *surface,
meta_surface_actor_set_opaque_region (surface_actor, pending->opaque_region); meta_surface_actor_set_opaque_region (surface_actor, pending->opaque_region);
if (pending->input_region) if (pending->input_region)
meta_surface_actor_set_input_region (surface_actor, pending->input_region); meta_surface_actor_set_input_region (surface_actor, pending->input_region);
return buffer_changed;
} }
static void static void
toplevel_surface_commit (MetaWaylandSurface *surface, toplevel_surface_commit (MetaWaylandSurface *surface,
MetaWaylandDoubleBufferedState *pending) MetaWaylandDoubleBufferedState *pending)
{ {
if (actor_surface_commit (surface, pending)) actor_surface_commit (surface, pending);
if (pending->newly_attached)
{ {
MetaWindow *window = surface->window; MetaWindow *window = surface->window;
MetaWaylandBuffer *buffer = pending->buffer; MetaWaylandBuffer *buffer = pending->buffer;
@ -326,7 +320,9 @@ subsurface_surface_commit (MetaWaylandSurface *surface,
} }
else else
{ {
if (actor_surface_commit (surface, pending)) actor_surface_commit (surface, pending);
if (pending->newly_attached)
{ {
MetaSurfaceActor *surface_actor = surface->surface_actor; MetaSurfaceActor *surface_actor = surface->surface_actor;
MetaWaylandBuffer *buffer = pending->buffer; MetaWaylandBuffer *buffer = pending->buffer;