1 /*
2  * %kadu copyright begin%
3  * Copyright 2009, 2011 Piotr Galiszewski (piotr.galiszewski@kadu.im)
4  * Copyright 2010, 2011, 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
5  * %kadu copyright end%
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include "misc/misc.h"
22 
23 #include "compositing-aware-object.h"
24 
25 KADU_AWARE_CLASS(CompositingAwareObject)
26 
27 bool CompositingAwareObject::CompositingEnabled = false;
28 
compositingStateChanged()29 void CompositingAwareObject::compositingStateChanged()
30 {
31 	CompositingEnabled = !CompositingEnabled;
32 
33 	if (CompositingEnabled)
34 	{
35 		foreach (CompositingAwareObject *object, Objects)
36 			object->compositingEnabled();
37 	}
38 	else
39 	{
40 		foreach (CompositingAwareObject *object, Objects)
41 			object->compositingDisabled();
42 	}
43 }
44 
triggerCompositingStateChanged()45 void CompositingAwareObject::triggerCompositingStateChanged()
46 {
47 	if (CompositingEnabled)
48 		compositingEnabled();
49 	else
50 		compositingDisabled();
51 }
52 
isCompositingEnabled() const53 bool CompositingAwareObject::isCompositingEnabled() const
54 {
55 	return CompositingEnabled;
56 }
57