clutter/actor: Add private API to get whether we're painting unmapped

Add new private API to ClutterActor, returning TRUE in case the actor is
being painted while unmapped. This is useful for implementations of the
paint() vfunc or for signal handlers of the "notify::mapped" signal.

Use this API in CallyActor to properly detect "notify::mapped" emissions
while painting unmapped, this fixes detecting the case where
painting-unmapped is used for screencasting.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1366
This commit is contained in:
Jonas Dreßler 2020-07-11 12:18:59 +02:00 committed by Carlos Garnacho
parent bf7cfb877c
commit cbf3001bc2
3 changed files with 13 additions and 1 deletions

View File

@ -72,6 +72,8 @@
#include <glib.h> #include <glib.h>
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "clutter/clutter-actor-private.h"
#ifdef CLUTTER_WINDOWING_X11 #ifdef CLUTTER_WINDOWING_X11
#include <clutter/x11/clutter-x11.h> #include <clutter/x11/clutter-x11.h>
#endif #endif
@ -972,7 +974,7 @@ cally_actor_real_notify_clutter (GObject *obj,
* paint it; we don't want this to generate an ATK * paint it; we don't want this to generate an ATK
* state change * state change
*/ */
if (clutter_actor_is_in_clone_paint (actor)) if (clutter_actor_is_painting_unmapped (actor))
return; return;
state = ATK_STATE_SHOWING; state = ATK_STATE_SHOWING;

View File

@ -293,6 +293,8 @@ void clutter_actor_update_stage_views (ClutterActor *self,
void clutter_actor_queue_immediate_relayout (ClutterActor *self); void clutter_actor_queue_immediate_relayout (ClutterActor *self);
gboolean clutter_actor_is_painting_unmapped (ClutterActor *self);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_ACTOR_PRIVATE_H__ */ #endif /* __CLUTTER_ACTOR_PRIVATE_H__ */

View File

@ -14921,6 +14921,14 @@ clutter_actor_is_in_clone_paint (ClutterActor *self)
return FALSE; return FALSE;
} }
gboolean
clutter_actor_is_painting_unmapped (ClutterActor *self)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
return self->priv->unmapped_paint_branch_counter > 0;
}
gboolean gboolean
clutter_actor_has_damage (ClutterActor *actor) clutter_actor_has_damage (ClutterActor *actor)
{ {