mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 11:30:45 -05:00
wayland: Move surface_set_buffer back into the commits
For XWayland support, we need to delay the buffer set until after we do the typechecking, as we need to bail out early in that case.
This commit is contained in:
parent
371fba6843
commit
a21e7a2188
@ -144,22 +144,37 @@ ensure_buffer_texture (MetaWaylandBuffer *buffer)
|
|||||||
buffer->texture = texture;
|
buffer->texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
cursor_surface_commit (MetaWaylandSurface *surface,
|
commit_attached_surface (MetaWaylandSurface *surface,
|
||||||
MetaWaylandDoubleBufferedState *pending,
|
MetaWaylandDoubleBufferedState *pending)
|
||||||
gboolean buffer_changed)
|
|
||||||
{
|
{
|
||||||
if (buffer_changed)
|
/* wl_surface.attach */
|
||||||
meta_wayland_seat_update_cursor_surface (surface->compositor->seat);
|
if (pending->newly_attached && surface->buffer != pending->buffer)
|
||||||
|
{
|
||||||
|
surface_set_buffer (surface, pending->buffer);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
cursor_surface_commit (MetaWaylandSurface *surface,
|
||||||
|
MetaWaylandDoubleBufferedState *pending)
|
||||||
|
{
|
||||||
|
if (commit_attached_surface (surface, pending))
|
||||||
|
meta_wayland_seat_update_cursor_surface (surface->compositor->seat);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
actor_surface_commit (MetaWaylandSurface *surface,
|
actor_surface_commit (MetaWaylandSurface *surface,
|
||||||
MetaWaylandDoubleBufferedState *pending,
|
MetaWaylandDoubleBufferedState *pending)
|
||||||
gboolean buffer_changed)
|
|
||||||
{
|
{
|
||||||
MetaSurfaceActor *surface_actor = surface->surface_actor;
|
MetaSurfaceActor *surface_actor = surface->surface_actor;
|
||||||
MetaWaylandBuffer *buffer = pending->buffer;
|
MetaWaylandBuffer *buffer = pending->buffer;
|
||||||
|
gboolean buffer_changed;
|
||||||
|
|
||||||
|
buffer_changed = commit_attached_surface (surface, pending);
|
||||||
|
|
||||||
if (buffer_changed && buffer)
|
if (buffer_changed && buffer)
|
||||||
{
|
{
|
||||||
@ -173,16 +188,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)
|
||||||
gboolean buffer_changed)
|
|
||||||
{
|
{
|
||||||
actor_surface_commit (surface, pending, buffer_changed);
|
if (actor_surface_commit (surface, pending))
|
||||||
|
|
||||||
if (buffer_changed)
|
|
||||||
{
|
{
|
||||||
MetaWindow *window = surface->window;
|
MetaWindow *window = surface->window;
|
||||||
MetaWaylandBuffer *buffer = pending->buffer;
|
MetaWaylandBuffer *buffer = pending->buffer;
|
||||||
@ -291,8 +305,7 @@ move_double_buffered_state (MetaWaylandDoubleBufferedState *from,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
subsurface_surface_commit (MetaWaylandSurface *surface,
|
subsurface_surface_commit (MetaWaylandSurface *surface,
|
||||||
MetaWaylandDoubleBufferedState *pending,
|
MetaWaylandDoubleBufferedState *pending)
|
||||||
gboolean buffer_changed)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If the sub-surface is in synchronous mode, post-pone the commit of its
|
* If the sub-surface is in synchronous mode, post-pone the commit of its
|
||||||
@ -312,9 +325,7 @@ subsurface_surface_commit (MetaWaylandSurface *surface,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actor_surface_commit (surface, pending, buffer_changed);
|
if (actor_surface_commit (surface, pending))
|
||||||
|
|
||||||
if (buffer_changed)
|
|
||||||
{
|
{
|
||||||
MetaSurfaceActor *surface_actor = surface->surface_actor;
|
MetaSurfaceActor *surface_actor = surface->surface_actor;
|
||||||
MetaWaylandBuffer *buffer = pending->buffer;
|
MetaWaylandBuffer *buffer = pending->buffer;
|
||||||
@ -347,21 +358,13 @@ commit_double_buffered_state (MetaWaylandSurface *surface,
|
|||||||
MetaWaylandDoubleBufferedState *pending)
|
MetaWaylandDoubleBufferedState *pending)
|
||||||
{
|
{
|
||||||
MetaWaylandCompositor *compositor = surface->compositor;
|
MetaWaylandCompositor *compositor = surface->compositor;
|
||||||
gboolean buffer_changed = FALSE;
|
|
||||||
|
|
||||||
/* wl_surface.attach */
|
|
||||||
if (pending->newly_attached && surface->buffer != pending->buffer)
|
|
||||||
{
|
|
||||||
surface_set_buffer (surface, pending->buffer);
|
|
||||||
buffer_changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (surface == compositor->seat->cursor_surface)
|
if (surface == compositor->seat->cursor_surface)
|
||||||
cursor_surface_commit (surface, pending, buffer_changed);
|
cursor_surface_commit (surface, pending);
|
||||||
else if (surface->window)
|
else if (surface->window)
|
||||||
toplevel_surface_commit (surface, pending, buffer_changed);
|
toplevel_surface_commit (surface, pending);
|
||||||
else if (surface->subsurface.resource)
|
else if (surface->subsurface.resource)
|
||||||
subsurface_surface_commit (surface, pending, buffer_changed);
|
subsurface_surface_commit (surface, pending);
|
||||||
|
|
||||||
g_list_foreach (surface->subsurfaces,
|
g_list_foreach (surface->subsurfaces,
|
||||||
parent_surface_committed,
|
parent_surface_committed,
|
||||||
|
Loading…
Reference in New Issue
Block a user