wayland/xdg-shell: Queue frame callbacks on new actor after resetting

When a xdg-toplevel is reset, the window and actor are recreated, and
all state is cleared. When this happened, we earlied out from the
xdg-toplevel commit handler, which would mean that if the client had
queued frame callbacks when resetting, they'd be left in the pending
commit state, later hitting an assert as they were not handled.

Fix this by queuing the frame callbacks no the new actor, so that they
are emitted whenever the actor is eventually painted.

https://gitlab.gnome.org/GNOME/mutter/issues/240
(cherry picked from commit d791710197)
This commit is contained in:
Jonas Ådahl 2018-07-25 11:49:36 +02:00 committed by Ray Strode
parent 3712f8c99d
commit b9f5f93956
3 changed files with 16 additions and 4 deletions

View File

@ -47,10 +47,14 @@ meta_wayland_actor_surface_assigned (MetaWaylandSurfaceRole *surface_role)
wl_list_init (&surface->pending_frame_callback_list);
}
static void
queue_surface_actor_frame_callbacks (MetaWaylandSurface *surface,
void
meta_wayland_actor_surface_queue_frame_callbacks (MetaWaylandActorSurface *actor_surface,
MetaWaylandPendingState *pending)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (actor_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaSurfaceActorWayland *surface_actor =
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor);
@ -167,7 +171,7 @@ meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandSurface *toplevel_surface;
queue_surface_actor_frame_callbacks (surface, pending);
meta_wayland_actor_surface_queue_frame_callbacks (actor_surface, pending);
toplevel_surface = meta_wayland_surface_get_toplevel (surface);
if (!toplevel_surface || !toplevel_surface->window)

View File

@ -40,4 +40,7 @@ void meta_wayland_actor_surface_sync_actor_state (MetaWaylandActorSurface *actor
double meta_wayland_actor_surface_calculate_scale (MetaWaylandActorSurface *actor_surface);
void meta_wayland_actor_surface_queue_frame_callbacks (MetaWaylandActorSurface *actor_surface,
MetaWaylandPendingState *pending);
#endif /* META_WAYLAND_ACTOR_SURFACE_H */

View File

@ -626,7 +626,12 @@ meta_wayland_xdg_toplevel_commit (MetaWaylandSurfaceRole *surface_role,
if (!surface->buffer_ref.buffer && xdg_surface_priv->first_buffer_attached)
{
MetaWaylandActorSurface *actor_surface =
META_WAYLAND_ACTOR_SURFACE (xdg_toplevel);
meta_wayland_xdg_surface_reset (xdg_surface);
meta_wayland_actor_surface_queue_frame_callbacks (actor_surface,
pending);
return;
}