summaryrefslogtreecommitdiff
path: root/src/object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/object.cpp')
-rw-r--r--src/object.cpp47
1 files changed, 17 insertions, 30 deletions
diff --git a/src/object.cpp b/src/object.cpp
index 64b4d49..b310e17 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -23,9 +23,13 @@
* Author: David Reveman <davidr@novell.com>
*/
+#include <compiz.h>
+
#include <algorithm>
+#include <boost/bind.hpp>
#include <compiz-core.h>
+#include <compcore.h>
#include "privateobject.h"
PrivateObject::PrivateObject () :
@@ -36,7 +40,7 @@ PrivateObject::PrivateObject () :
}
-CompObject::CompObject (CompObjectType type, const char* typeName,
+CompObject::CompObject (CompObject::Type type, const char* typeName,
CompObject::indices *iList) :
privates (0)
{
@@ -82,7 +86,7 @@ CompObject::typeName ()
return priv->typeName;
}
-CompObjectType
+CompObject::Type
CompObject::type ()
{
return priv->type;
@@ -99,9 +103,8 @@ CompObject::addChild (CompObject *object)
}
bool
-CompObject::forEachChild (ObjectCallBackProc proc,
- void *closure,
- CompObjectType type)
+CompObject::forEachChild (CompObject::CallBack proc,
+ CompObject::Type type)
{
bool rv = true;
@@ -110,33 +113,26 @@ CompObject::forEachChild (ObjectCallBackProc proc,
{
if (type > 0 && (*it)->type () != type)
continue;
- rv &= (*proc) ((*it), closure);
+ rv &= proc ((*it));
}
return rv;
}
-typedef struct _ResizeInfo {
- CompObjectType type;
- unsigned int size;
-} ResizeInfo;
-
static bool
-resizePrivates (CompObject *o, void * closure)
+resizePrivates (CompObject *o, CompObject::Type type, unsigned int size)
{
- ResizeInfo *info = static_cast<ResizeInfo *> (closure);
-
- if (o->type () == info->type)
+ if (o->type () == type)
{
- o->privates.resize (info->size);
+ o->privates.resize (size);
}
- o->forEachChild (resizePrivates, info);
+ o->forEachChild (boost::bind (resizePrivates, _1, type, size));
return true;
}
int
-CompObject::allocatePrivateIndex (CompObjectType type,
+CompObject::allocatePrivateIndex (CompObject::Type type,
CompObject::indices *iList)
{
if (!iList)
@@ -154,18 +150,13 @@ CompObject::allocatePrivateIndex (CompObjectType type,
iList->resize (i + 1);
iList->at (i) = true;
- ResizeInfo info;
- info.type = type;
- info.size = i + 1;
-
-
- resizePrivates (core, static_cast<void *> (&info));
+ resizePrivates (core, type, i + 1);
return i;
}
void
-CompObject::freePrivateIndex (CompObjectType type,
+CompObject::freePrivateIndex (CompObject::Type type,
CompObject::indices *iList,
int idx)
{
@@ -181,10 +172,6 @@ CompObject::freePrivateIndex (CompObjectType type,
unsigned int i = iList->size () - 1;
iList->resize (i);
- ResizeInfo info;
- info.type = type;
- info.size = i;
-
- resizePrivates (core, static_cast<void *> (&info));
+ resizePrivates (core, type, i);
}