2013-01-23 15:54:41 -05:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2013-03-11 11:52:36 -04:00
|
|
|
/**
|
|
|
|
* SECTION:meta-background-group
|
|
|
|
* @title: MetaBackgroundGroup
|
|
|
|
* @short_description: Container for background actors
|
|
|
|
*
|
|
|
|
* This class is a subclass of ClutterActor with special handling for
|
|
|
|
* MetaBackgroundActor/MetaBackgroundGroup when painting children.
|
|
|
|
* It makes sure to only draw the parts of the backgrounds not
|
|
|
|
* occluded by opaque windows.
|
|
|
|
*
|
|
|
|
* See #MetaWindowGroup for more information behind the motivation,
|
|
|
|
* and details on implementation.
|
|
|
|
*/
|
|
|
|
|
2013-01-23 15:54:41 -05:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "compositor-private.h"
|
|
|
|
#include "clutter-utils.h"
|
|
|
|
#include "meta-background-actor-private.h"
|
|
|
|
#include "meta-background-group-private.h"
|
|
|
|
|
2013-03-14 17:20:54 -04:00
|
|
|
G_DEFINE_TYPE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR);
|
2013-01-23 15:54:41 -05:00
|
|
|
|
|
|
|
static void
|
|
|
|
meta_background_group_class_init (MetaBackgroundGroupClass *klass)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_background_group_init (MetaBackgroundGroup *self)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-08-27 10:30:39 -04:00
|
|
|
* meta_background_group_set_clip_region:
|
2013-01-23 15:54:41 -05:00
|
|
|
* @self: a #MetaBackgroundGroup
|
2013-08-27 10:30:39 -04:00
|
|
|
* @region: (allow-none): the parts of the background to paint
|
2013-01-23 15:54:41 -05:00
|
|
|
*
|
|
|
|
* Sets the area of the backgrounds that is unobscured by overlapping windows.
|
|
|
|
* This is used to optimize and only paint the visible portions.
|
|
|
|
*/
|
|
|
|
void
|
2013-08-27 10:30:39 -04:00
|
|
|
meta_background_group_set_clip_region (MetaBackgroundGroup *self,
|
|
|
|
cairo_region_t *region)
|
2013-01-23 15:54:41 -05:00
|
|
|
{
|
2013-11-18 22:16:52 -05:00
|
|
|
ClutterActor *child;
|
|
|
|
for (child = clutter_actor_get_first_child (self);
|
|
|
|
child != NULL;
|
|
|
|
child = clutter_actor_get_next_sibling (child))
|
2013-01-23 15:54:41 -05:00
|
|
|
{
|
2013-11-18 22:16:52 -05:00
|
|
|
if (META_IS_BACKGROUND_ACTOR (child))
|
2013-01-23 15:54:41 -05:00
|
|
|
{
|
2013-11-18 22:16:52 -05:00
|
|
|
meta_background_actor_set_clip_region (META_BACKGROUND_ACTOR (child), region);
|
2013-01-23 15:54:41 -05:00
|
|
|
}
|
2013-11-18 22:16:52 -05:00
|
|
|
else if (META_IS_BACKGROUND_GROUP (child))
|
2013-01-23 15:54:41 -05:00
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
|
2013-11-18 22:16:52 -05:00
|
|
|
if (!meta_actor_is_untransformed (child, &x, &y))
|
2013-01-23 15:54:41 -05:00
|
|
|
continue;
|
|
|
|
|
|
|
|
cairo_region_translate (region, -x, -y);
|
2013-11-18 22:16:52 -05:00
|
|
|
meta_background_group_set_clip_region (META_BACKGROUND_GROUP (child), region);
|
2013-01-23 15:54:41 -05:00
|
|
|
cairo_region_translate (region, x, y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ClutterActor *
|
|
|
|
meta_background_group_new (void)
|
|
|
|
{
|
|
|
|
MetaBackgroundGroup *background_group;
|
|
|
|
|
|
|
|
background_group = g_object_new (META_TYPE_BACKGROUND_GROUP, NULL);
|
|
|
|
|
|
|
|
return CLUTTER_ACTOR (background_group);
|
|
|
|
}
|