[mutter] window-actor: Add `set_frozen` vfunc



commit aa017383ace0281397866f2296e0375b266f11d7
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Mon Dec 9 15:06:58 2019 +0100

    window-actor: Add `set_frozen` vfunc
    
    Currently, the window actor freeze/thaw implementation sets the frozen
    state of the surface actor using `meta_surface_actor_set_frozen()`.
    
    If we want to expand that behavior to also freeze/thaw commits for X11
    windows running on Xwayland, we need to have a specific vfunc to abstract
    that in the window actor specific implementation.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/942

 src/compositor/meta-window-actor-private.h |  2 ++
 src/compositor/meta-window-actor-wayland.c |  7 +++++++
 src/compositor/meta-window-actor-x11.c     |  7 +++++++
 src/compositor/meta-window-actor.c         | 21 ++++++++++++++++++---
 4 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index 1b60db025..59dd641d4 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -26,6 +26,8 @@ struct _MetaWindowActorClass
   void (*pre_paint) (MetaWindowActor *actor);
   void (*post_paint) (MetaWindowActor *actor);
   void (*queue_destroy) (MetaWindowActor *actor);
+  void (*set_frozen) (MetaWindowActor *actor,
+                      gboolean         frozen);
 };
 
 typedef enum
diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c
index 544d50564..f145f54c3 100644
--- a/src/compositor/meta-window-actor-wayland.c
+++ b/src/compositor/meta-window-actor-wayland.c
@@ -144,6 +144,12 @@ meta_window_actor_wayland_queue_destroy (MetaWindowActor *actor)
 {
 }
 
+static void
+meta_window_actor_wayland_set_frozen (MetaWindowActor *actor,
+                                      gboolean         frozen)
+{
+}
+
 static gboolean
 meta_window_actor_wayland_get_paint_volume (ClutterActor       *actor,
                                             ClutterPaintVolume *volume)
@@ -181,6 +187,7 @@ meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass)
   window_actor_class->pre_paint = meta_window_actor_wayland_pre_paint;
   window_actor_class->post_paint = meta_window_actor_wayland_post_paint;
   window_actor_class->queue_destroy = meta_window_actor_wayland_queue_destroy;
+  window_actor_class->set_frozen = meta_window_actor_wayland_set_frozen;
 }
 
 static void
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index 2c0bd9939..cc694004a 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -1312,6 +1312,12 @@ meta_window_actor_x11_queue_destroy (MetaWindowActor *actor)
     remove_frame_messages_timer (actor_x11);
 }
 
+static void
+meta_window_actor_x11_set_frozen (MetaWindowActor *actor,
+                                  gboolean         frozen)
+{
+}
+
 static void
 meta_window_actor_x11_set_property (GObject      *object,
                                     guint         prop_id,
@@ -1481,6 +1487,7 @@ meta_window_actor_x11_class_init (MetaWindowActorX11Class *klass)
   window_actor_class->pre_paint = meta_window_actor_x11_pre_paint;
   window_actor_class->post_paint = meta_window_actor_x11_post_paint;
   window_actor_class->queue_destroy = meta_window_actor_x11_queue_destroy;
+  window_actor_class->set_frozen = meta_window_actor_x11_set_frozen;
 
   actor_class->paint = meta_window_actor_x11_paint;
   actor_class->get_paint_volume = meta_window_actor_x11_get_paint_volume;
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 3ebfc81e6..9f4568662 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -251,6 +251,21 @@ meta_window_actor_is_frozen (MetaWindowActor *self)
   return priv->surface == NULL || priv->freeze_count > 0;
 }
 
+static void
+meta_window_actor_set_frozen (MetaWindowActor *self,
+                              gboolean         frozen)
+{
+  MetaWindowActorPrivate *priv =
+    meta_window_actor_get_instance_private (self);
+
+  if (meta_surface_actor_is_frozen (priv->surface) == frozen)
+    return;
+
+  meta_surface_actor_set_frozen (priv->surface, frozen);
+
+  META_WINDOW_ACTOR_GET_CLASS (self)->set_frozen (self, frozen);
+}
+
 static void
 meta_window_actor_freeze (MetaWindowActor *self)
 {
@@ -258,7 +273,7 @@ meta_window_actor_freeze (MetaWindowActor *self)
     meta_window_actor_get_instance_private (self);
 
   if (priv->freeze_count == 0 && priv->surface)
-    meta_surface_actor_set_frozen (priv->surface, TRUE);
+    meta_window_actor_set_frozen (self, TRUE);
 
   priv->freeze_count ++;
 }
@@ -273,7 +288,7 @@ meta_window_actor_sync_thawed_state (MetaWindowActor *self)
     priv->first_frame_state = DRAWING_FIRST_FRAME;
 
   if (priv->surface)
-    meta_surface_actor_set_frozen (priv->surface, FALSE);
+    meta_window_actor_set_frozen (self, FALSE);
 
   /* We sometimes ignore moves and resizes on frozen windows */
   meta_window_actor_sync_actor_geometry (self, FALSE);
@@ -312,7 +327,7 @@ meta_window_actor_real_assign_surface_actor (MetaWindowActor  *self,
   priv->surface = g_object_ref_sink (surface_actor);
 
   if (meta_window_actor_is_frozen (self))
-    meta_surface_actor_set_frozen (priv->surface, TRUE);
+    meta_window_actor_set_frozen (self, TRUE);
   else
     meta_window_actor_sync_thawed_state (self);
 }


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