[mutter] window-actor: Add a new can_freeze_commits() API



commit df5a5d279d1ec9757881304f6cb3ca546a3743a0
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Fri Jan 22 16:26:17 2021 +0100

    window-actor: Add a new can_freeze_commits() API
    
    Mutter freezes Xwayland commits when resizing windows, and thaw them in
    the window actors' after_paint() for X11.
    
    Yet, after_paint() could be never called, as when a new window is mapped
    while the overview is active in gnome-shell.
    
    As a result, the content of the X11 window will remain invisible to the
    overview.
    
    Add a new window actor API to tell whether commits can be frozen. For
    Wayland window actors, this always return FALSE, whereas for X11 window
    actors, it checks whether the Clutter actor is mapped.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1678>

 src/compositor/meta-window-actor-private.h | 3 +++
 src/compositor/meta-window-actor-wayland.c | 7 +++++++
 src/compositor/meta-window-actor-x11.c     | 9 +++++++++
 src/compositor/meta-window-actor.c         | 8 ++++++++
 4 files changed, 27 insertions(+)
---
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index 57dbd0ad07..64741e4167 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -32,6 +32,7 @@ struct _MetaWindowActorClass
   void (*set_frozen) (MetaWindowActor *actor,
                       gboolean         frozen);
   void (*update_regions) (MetaWindowActor *actor);
+  gboolean (*can_freeze_commits) (MetaWindowActor *actor);
 };
 
 typedef enum
@@ -96,4 +97,6 @@ gboolean meta_window_actor_is_opaque (MetaWindowActor *self);
 
 void meta_window_actor_update_regions (MetaWindowActor *self);
 
+gboolean meta_window_actor_can_freeze_commits (MetaWindowActor *self);
+
 #endif /* META_WINDOW_ACTOR_PRIVATE_H */
diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c
index cab6bbc847..7c3be56904 100644
--- a/src/compositor/meta-window-actor-wayland.c
+++ b/src/compositor/meta-window-actor-wayland.c
@@ -146,6 +146,12 @@ meta_window_actor_wayland_update_regions (MetaWindowActor *actor)
 {
 }
 
+static gboolean
+meta_window_actor_wayland_can_freeze_commits (MetaWindowActor *actor)
+{
+  return FALSE;
+}
+
 static void
 meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass)
 {
@@ -159,6 +165,7 @@ meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass)
   window_actor_class->queue_destroy = meta_window_actor_wayland_queue_destroy;
   window_actor_class->set_frozen = meta_window_actor_wayland_set_frozen;
   window_actor_class->update_regions = meta_window_actor_wayland_update_regions;
+  window_actor_class->can_freeze_commits = meta_window_actor_wayland_can_freeze_commits;
 }
 
 static void
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index 566aac4ec9..676487716a 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -1458,6 +1458,14 @@ meta_window_actor_x11_update_regions (MetaWindowActor *actor)
   update_regions (META_WINDOW_ACTOR_X11 (actor));
 }
 
+static gboolean
+meta_window_actor_x11_can_freeze_commits (MetaWindowActor *actor)
+{
+  ClutterActor *clutter_actor = CLUTTER_ACTOR (actor);
+
+  return clutter_actor_is_mapped (clutter_actor);
+}
+
 static void
 meta_window_actor_x11_set_property (GObject      *object,
                                     guint         prop_id,
@@ -1632,6 +1640,7 @@ meta_window_actor_x11_class_init (MetaWindowActorX11Class *klass)
   window_actor_class->queue_destroy = meta_window_actor_x11_queue_destroy;
   window_actor_class->set_frozen = meta_window_actor_x11_set_frozen;
   window_actor_class->update_regions = meta_window_actor_x11_update_regions;
+  window_actor_class->can_freeze_commits = meta_window_actor_x11_can_freeze_commits;
 
   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 1273ff422f..d4fc9a43a0 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -257,6 +257,14 @@ meta_window_actor_update_regions (MetaWindowActor *self)
   META_WINDOW_ACTOR_GET_CLASS (self)->update_regions (self);
 }
 
+gboolean
+meta_window_actor_can_freeze_commits (MetaWindowActor *self)
+{
+  g_return_val_if_fail (META_IS_WINDOW_ACTOR (self), FALSE);
+
+  return META_WINDOW_ACTOR_GET_CLASS (self)->can_freeze_commits (self);
+}
+
 static void
 meta_window_actor_set_frozen (MetaWindowActor *self,
                               gboolean         frozen)


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