diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 780c62e02..499f77b91 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -966,10 +966,18 @@ cleanup: meta_wayland_surface_state_reset (state); } +static void +ensure_cached_state (MetaWaylandSurface *surface) +{ + if (!surface->cached_state) + surface->cached_state = g_object_new (META_TYPE_WAYLAND_SURFACE_STATE, + NULL); +} + void meta_wayland_surface_apply_cached_state (MetaWaylandSurface *surface) { - meta_wayland_surface_ensure_cached_state (surface); + ensure_cached_state (surface); meta_wayland_surface_apply_state (surface, surface->cached_state); } @@ -979,15 +987,6 @@ meta_wayland_surface_get_pending_state (MetaWaylandSurface *surface) return surface->pending_state; } -MetaWaylandSurfaceState * -meta_wayland_surface_ensure_cached_state (MetaWaylandSurface *surface) -{ - if (!surface->cached_state) - surface->cached_state = g_object_new (META_TYPE_WAYLAND_SURFACE_STATE, - NULL); - return surface->cached_state; -} - static void meta_wayland_surface_commit (MetaWaylandSurface *surface) { @@ -1010,17 +1009,15 @@ meta_wayland_surface_commit (MetaWaylandSurface *surface) */ if (meta_wayland_surface_should_cache_state (surface)) { - MetaWaylandSurfaceState *cached_state; - - cached_state = meta_wayland_surface_ensure_cached_state (surface); + ensure_cached_state (surface); /* * A new commit indicates a new content update, so any previous * cached content update did not go on screen and needs to be discarded. */ - meta_wayland_surface_state_discard_presentation_feedback (cached_state); + meta_wayland_surface_state_discard_presentation_feedback (surface->cached_state); - meta_wayland_surface_state_merge_into (pending, cached_state); + meta_wayland_surface_state_merge_into (pending, surface->cached_state); } else { diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index 25b619977..bd2cf6377 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -262,9 +262,6 @@ MetaWaylandSurface *meta_wayland_surface_create (MetaWaylandCompositor *composit MetaWaylandSurfaceState * meta_wayland_surface_get_pending_state (MetaWaylandSurface *surface); -MetaWaylandSurfaceState * - meta_wayland_surface_ensure_cached_state (MetaWaylandSurface *surface); - void meta_wayland_surface_apply_cached_state (MetaWaylandSurface *surface); gboolean meta_wayland_surface_is_effectively_synchronized (MetaWaylandSurface *surface);