[mutter] wayland/surface: Make ensure_cached_state() static



commit dea9f8bbfeb83c9aac4b968721da770e311732f6
Author: Robert Mader <robert mader collabora com>
Date:   Mon Jan 10 21:47:26 2022 +0100

    wayland/surface: Make ensure_cached_state() static
    
    There is no reason for it to be public or have a return value.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2232>

 src/wayland/meta-wayland-surface.c | 27 ++++++++++++---------------
 src/wayland/meta-wayland-surface.h |  3 ---
 2 files changed, 12 insertions(+), 18 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 780c62e022..499f77b912 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 25b6199779..bd2cf6377c 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]