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>
This commit is contained in:
Olivier Fourdan 2021-01-22 16:26:17 +01:00 committed by Marge Bot
parent cda26b493e
commit df5a5d279d
4 changed files with 27 additions and 0 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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;

View File

@ -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)