[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
This commit is contained in:
Emmanuele Bassi 2009-07-13 16:18:27 +01:00
parent 43d394ebae
commit af5e432ba9
3 changed files with 35 additions and 0 deletions

View File

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

View File

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

View File

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