From af5e432ba9bf56ccd376d52e73e0e23d5bc9b37c Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 13 Jul 2009 16:18:27 +0100 Subject: [PATCH] [actor] Allow querying whether we are painted by a Clone It would be useful inside a custom actor's paint function to be able to tell if this is a primary paint call, or if we are in fact painting on behalf of a clone. In Mutter we have an optimization not to paint occluded windows; this is desirable for the windows per se, to conserve bandwith to the card, but if something like an application switcher is using clones of these windows, they will not get painted either; currently we have no way of differentiating between the two. Fixes bug: http://bugzilla.openedhand.com/show_bug.cgi?id=1685 --- clutter/clutter-actor.c | 32 ++++++++++++++++++++++ clutter/clutter-actor.h | 2 ++ doc/reference/clutter/clutter-sections.txt | 1 + 3 files changed, 35 insertions(+) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 66e2812c8..5333fc452 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -9184,3 +9184,35 @@ clutter_actor_get_transformation_matrix (ClutterActor *self, CLUTTER_ACTOR_GET_CLASS (self)->apply_transform (self, matrix); } + +/** + * clutter_actor_is_in_clone_paint: + * @self: a #ClutterActor + * + * Checks whether @self is being currently painted by a #ClutterClone + * + * This function is useful only inside the ::paint virtual function + * implementations or within handlers for the #ClutterActor::paint + * signal + * + * This function should not be used by applications + * + * Return value: %TRUE if the #ClutterActor is currently being painted + * by a #ClutterClone, and %FALSE otherwise + * + * Since: 1.0 + */ +gboolean +clutter_actor_is_in_clone_paint (ClutterActor *self) +{ + g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); + + /* XXX - keep in sync with the overrides set by ClutterClone: + * + * - opacity_parent != NULL + * - enable_model_view_transform == FALSE + */ + + return self->priv->opacity_parent != NULL && + !self->priv->enable_model_view_transform; +} diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index 72f7893da..18f776685 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -520,6 +520,8 @@ PangoLayout * clutter_actor_create_pango_layout (ClutterActor *self void clutter_actor_get_transformation_matrix (ClutterActor *self, CoglMatrix *matrix); +gboolean clutter_actor_is_in_clone_paint (ClutterActor *self); + G_END_DECLS #endif /* __CLUTTER_ACTOR_H__ */ diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index 109a66216..2e38c6be5 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -387,6 +387,7 @@ clutter_actor_grab_key_focus clutter_actor_get_pango_context clutter_actor_create_pango_context clutter_actor_create_pango_layout +clutter_actor_is_in_clone_paint ClutterActorBox