summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2008-09-16 01:56:31 +0200
committerDennis Kasprzyk <onestone@compiz-fusion.org>2008-09-16 01:56:31 +0200
commit24111a340996d6ab19b365909aa96c91672b75d1 (patch)
treefc5b642f7aa1c9f3a770c7db4cab510ad9c1e9ad /src
parentd5acffa9795add9ebc9c6e6920a5e80581584863 (diff)
downloadcompiz-with-glib-mainloop-24111a340996d6ab19b365909aa96c91672b75d1.tar.gz
compiz-with-glib-mainloop-24111a340996d6ab19b365909aa96c91672b75d1.tar.bz2
Drop never finished object handling.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/event.cpp28
-rw-r--r--src/match.cpp2
-rw-r--r--src/object.cpp194
-rw-r--r--src/plugin.cpp254
-rw-r--r--src/privates.cpp47
-rw-r--r--src/screen.cpp93
-rw-r--r--src/window.cpp25
8 files changed, 213 insertions, 432 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5c405c8..1bcfe44 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,7 @@ compiz_SOURCES = \
option.cpp \
string.cpp \
match.cpp \
- object.cpp \
+ privates.cpp \
event.cpp \
plugin.cpp \
session.cpp \
diff --git a/src/event.cpp b/src/event.cpp
index 6a6a7b3..126f22b 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -554,7 +554,7 @@ triggerAllEdgeEnterBindings (CompAction::State state,
{
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options = p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerEdgeEnterBindings (options, state, delayState, edge,
arguments))
{
@@ -637,7 +637,7 @@ PrivateScreen::handleActionEvent (XEvent *event)
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options = p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerButtonPressBindings (options, event, o))
return true;
}
@@ -658,7 +658,7 @@ PrivateScreen::handleActionEvent (XEvent *event)
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options = p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerButtonReleaseBindings (options, event, o))
return true;
}
@@ -679,7 +679,7 @@ PrivateScreen::handleActionEvent (XEvent *event)
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options = p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerKeyPressBindings (options, event, o))
return true;
}
@@ -700,7 +700,7 @@ PrivateScreen::handleActionEvent (XEvent *event)
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options = p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerKeyReleaseBindings (options, event, o))
return true;
}
@@ -747,8 +747,7 @@ PrivateScreen::handleActionEvent (XEvent *event)
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options =
- p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerEdgeLeaveBindings (options, state, edge, o))
return true;
}
@@ -829,8 +828,7 @@ PrivateScreen::handleActionEvent (XEvent *event)
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options =
- p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerEdgeLeaveBindings (options, state, edge, o))
return true;
}
@@ -899,8 +897,7 @@ PrivateScreen::handleActionEvent (XEvent *event)
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options =
- p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerStateNotifyBindings (options, stateEvent, o))
return true;
}
@@ -917,8 +914,7 @@ PrivateScreen::handleActionEvent (XEvent *event)
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options =
- p->vTable->getObjectOptions (screen);
+ CompOption::Vector &options = p->vTable->getOptions ();
if (triggerBellNotifyBindings (options, o))
return true;
}
@@ -1352,12 +1348,12 @@ CompScreen::handleEvent (XEvent *event)
value.set ((int) (event->xclient.data.l[0] /
priv->size.width ()));
- setOptionForPlugin (this, "core", "hsize", value);
+ setOptionForPlugin ("core", "hsize", value);
value.set ((int) (event->xclient.data.l[1] /
priv->size.height ()));
- setOptionForPlugin (this, "core", "vsize", value);
+ setOptionForPlugin ("core", "vsize", value);
}
}
else if (event->xclient.message_type == Atoms::moveResizeWindow)
@@ -1461,7 +1457,7 @@ CompScreen::handleEvent (XEvent *event)
value.set ((int) event->xclient.data.l[0]);
- setOptionForPlugin (this, "core", "number_of_desktops", value);
+ setOptionForPlugin ("core", "number_of_desktops", value);
}
}
else if (event->xclient.message_type == Atoms::currentDesktop)
diff --git a/src/match.cpp b/src/match.cpp
index 45c4ef3..af02d2c 100644
--- a/src/match.cpp
+++ b/src/match.cpp
@@ -138,7 +138,7 @@ CompScreen::matchExpHandlerChanged ()
foreach (CompPlugin *p, CompPlugin::getPlugins ())
{
- CompOption::Vector &options = p->vTable->getObjectOptions (this);
+ CompOption::Vector &options = p->vTable->getOptions ();
matchUpdateMatchOptions (options);
}
}
diff --git a/src/object.cpp b/src/object.cpp
deleted file mode 100644
index ca67da9..0000000
--- a/src/object.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright © 2007 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#include <compiz.h>
-
-#include <algorithm>
-#include <boost/bind.hpp>
-
-#include <compiz-core.h>
-#include "privateobject.h"
-
-PrivateObject::PrivateObject () :
- typeName (0),
- parent (NULL),
- children (0)
-{
-}
-
-
-CompObject::CompObject (CompObject::Type type, const char* typeName,
- CompObject::indices *iList) :
- privates (0)
-{
- priv = new PrivateObject ();
- assert (priv);
-
- priv->type = type;
- priv->typeName = typeName;
-
- if (iList && iList->size() > 0)
- privates.resize (iList->size ());
-}
-
-CompObject::~CompObject ()
-{
- std::list<CompObject *>::iterator it;
-
- while (!priv->children.empty ())
- {
- CompObject *o = priv->children.front ();
- priv->children.pop_front ();
- o->priv->parent = NULL;
- delete o;
- }
- if (priv->parent)
- {
- it = std::find (priv->parent->priv->children.begin (),
- priv->parent->priv->children.end (),
- this);
-
- if (it != priv->parent->priv->children.end ())
- {
- priv->parent->priv->children.erase (it);
- }
- }
- delete priv;
-}
-
-const char *
-CompObject::objectTypeName ()
-{
- return priv->typeName;
-}
-
-CompObject::Type
-CompObject::objectType ()
-{
- return priv->type;
-}
-
-void
-CompObject::addChild (CompObject *object)
-{
- if (!object)
- return;
- object->priv->parent = this;
- priv->children.push_back (object);
- screen->objectAdd (this, object);
-}
-
-void
-CompObject::removeFromParent ()
-{
- std::list<CompObject *>::iterator it;
-
- if (priv->parent)
- {
- it = std::find (priv->parent->priv->children.begin (),
- priv->parent->priv->children.end (),
- this);
-
- if (it != priv->parent->priv->children.end ())
- {
- priv->parent->priv->children.erase (it);
- screen->objectRemove (priv->parent, this);
- }
- }
-}
-
-bool
-CompObject::forEachChild (CompObject::CallBack proc,
- CompObject::Type type)
-{
- bool rv = true;
-
- std::list<CompObject *>::iterator it;
- for (it = priv->children.begin (); it != priv->children.end (); it++)
- {
- if (type > 0 && (*it)->objectType () != type)
- continue;
- rv &= proc ((*it));
- }
-
- return rv;
-}
-
-static bool
-resizePrivates (CompObject *o, CompObject::Type type, unsigned int size)
-{
- if (o->objectType () == type)
- {
- o->privates.resize (size);
- }
- o->forEachChild (boost::bind (resizePrivates, _1, type, size));
-
- return true;
-}
-
-int
-CompObject::allocatePrivateIndex (CompObject::Type type,
- CompObject::indices *iList)
-{
- if (!iList)
- return -1;
-
- for (unsigned int i = 0; i < iList->size(); i++)
- {
- if (!iList->at (i))
- {
- iList->at (i) = true;
- return i;
- }
- }
- unsigned int i = iList->size ();
- iList->resize (i + 1);
- iList->at (i) = true;
-
- resizePrivates (screen, type, i + 1);
-
- return i;
-}
-
-void
-CompObject::freePrivateIndex (CompObject::Type type,
- CompObject::indices *iList,
- int idx)
-{
- if (!iList || idx < 0 || idx >= (int) iList->size())
- return;
-
- if (idx < (int) iList->size () - 1)
- {
- iList->at(idx) = false;
- return;
- }
-
- unsigned int i = iList->size () - 1;
- iList->resize (i);
-
- resizePrivates (screen, type, i);
-}
-
diff --git a/src/plugin.cpp b/src/plugin.cpp
index 60a0d4a..b4ad02f 100644
--- a/src/plugin.cpp
+++ b/src/plugin.cpp
@@ -34,7 +34,7 @@
#define foreach BOOST_FOREACH
#include <compiz-core.h>
-#include <compobject.h>
+#include "privatescreen.h"
CompPlugin::Map pluginsMap;
CompPlugin::List plugins;
@@ -43,25 +43,18 @@ class CorePluginVTable : public CompPlugin::VTable
{
public:
- const char *
- name () { return "core"; };
+ const char * name () { return "core"; };
- CompMetadata *
- getMetadata ();
+ CompMetadata * getMetadata ();
- virtual bool
- init ();
+ bool init ();
- virtual void
- fini ();
+ void fini ();
- CompOption::Vector &
- getObjectOptions (CompObject *object);
+ CompOption::Vector & getOptions ();
- bool
- setObjectOption (CompObject *object,
- const char *name,
- CompOption::Value &value);
+ bool setOption (const char *name,
+ CompOption::Value &value);
};
bool
@@ -82,27 +75,16 @@ CorePluginVTable::getMetadata ()
}
CompOption::Vector &
-CorePluginVTable::getObjectOptions (CompObject *object)
+CorePluginVTable::getOptions ()
{
- static GetPluginObjectOptionsProc dispTab[] = {
- (GetPluginObjectOptionsProc) CompScreen::getOptions
- };
-
- RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab),
- noOptions, (object));
+ return screen->getOptions ();
}
bool
-CorePluginVTable::setObjectOption (CompObject *object,
- const char *name,
- CompOption::Value &value)
+CorePluginVTable::setOption (const char *name,
+ CompOption::Value &value)
{
- static SetPluginObjectOptionProc dispTab[] = {
- (SetPluginObjectOptionProc) CompScreen::setOption
- };
-
- RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab), false,
- (object, name, value));
+ return screen->setOption (name, value);
}
CorePluginVTable coreVTable;
@@ -273,148 +255,105 @@ LoadPluginProc loaderLoadPlugin = dlloaderLoadPlugin;
UnloadPluginProc loaderUnloadPlugin = dlloaderUnloadPlugin;
ListPluginsProc loaderListPlugins = dlloaderListPlugins;
-struct InitObjectContext {
- CompPlugin *plugin;
- CompObject *object;
-};
-
-static bool
-initObjectTree (CompObject *object,
- InitObjectContext *pCtx);
-
-static bool
-finiObjectTree (CompObject *object,
- InitObjectContext *pCtx);
static bool
-initObjectTree (CompObject *object,
- InitObjectContext *pCtx)
+initPlugin (CompPlugin *p)
{
- CompPlugin *p = pCtx->plugin;
- InitObjectContext ctx;
-
- pCtx->object = object;
-
-
- if (!p->vTable->initObject (object))
- {
- compLogMessage (p->vTable->name (), CompLogLevelError,
- "InitObject failed");
- return false;
- }
-
- ctx.plugin = pCtx->plugin;
- ctx.object = NULL;
- if (!object->forEachChild (boost::bind (initObjectTree, _1, &ctx)))
+ if (!p->vTable->init ())
{
- object->forEachChild (boost::bind (finiObjectTree, _1, &ctx));
-
+ compLogMessage ("core", CompLogLevelError,
+ "InitPlugin '%s' failed", p->vTable->name ());
return false;
}
- if (!screen->initPluginForObject (p, object))
+ if (screen)
{
- object->forEachChild (boost::bind (finiObjectTree, _1, &ctx));
- p->vTable->finiObject (object);
-
- return false;
+ if (!p->vTable->initScreen (screen))
+ {
+ compLogMessage (p->vTable->name (), CompLogLevelError,
+ "initScreen failed");
+ p->vTable->fini ();
+ return false;
+ }
+ if (!screen->initPluginForScreen (p))
+ {
+ p->vTable->fini ();
+ return false;
+ }
}
return true;
}
-static bool
-finiObjectTree (CompObject *object,
- InitObjectContext *pCtx)
+static void
+finiPlugin (CompPlugin *p)
{
- CompPlugin *p = pCtx->plugin;
- InitObjectContext ctx;
- /* pCtx->object is set to the object that failed to be initialized */
- if (pCtx->object == object)
- return false;
-
- ctx.plugin = p;
- ctx.object = NULL;
-
- object->forEachChild (boost::bind (finiObjectTree, _1, &ctx));
-
- p->vTable->finiObject (object);
-
- screen->finiPluginForObject (p, object);
+ if (screen)
+ {
+ screen->finiPluginForScreen (p);
+ p->vTable->finiScreen (screen);
+ }
- return true;
+ p->vTable->fini ();
}
-static bool
-initPlugin (CompPlugin *p)
+bool
+CompScreen::initPluginForScreen (CompPlugin *p)
{
- InitObjectContext ctx;
+ WRAPABLE_HND_FUNC_RETURN(2, bool, initPluginForScreen, p)
- if (!p->vTable->init ())
+ bool status = true;
+ CompWindowList::iterator it, fail;
+ CompWindow *w;
+
+ it = fail = priv->windows.begin ();
+ for (;it != priv->windows.end (); it++)
{
- compLogMessage ("core", CompLogLevelError,
- "InitPlugin '%s' failed", p->vTable->name ());
- return false;
+ w = *it;
+ if (!p->vTable->initWindow (w))
+ {
+ compLogMessage (p->vTable->name (), CompLogLevelError,
+ "initWindow failed");
+ fail = it;
+ status = false;
+ }
}
- ctx.plugin = p;
- ctx.object = NULL;
-
- if (!initObjectTree (screen, &ctx))
+ it = priv->windows.begin ();
+ for (;it != fail; it++)
{
- p->vTable->fini ();
- return false;
+ w = *it;
+ p->vTable->finiWindow (w);
}
- return true;
+ return status;
}
-static void
-finiPlugin (CompPlugin *p)
+void
+CompScreen::finiPluginForScreen (CompPlugin *p)
{
- InitObjectContext ctx;
-
- ctx.plugin = p;
- ctx.object = NULL;
+ WRAPABLE_HND_FUNC(3, finiPluginForScreen, p)
- finiObjectTree (screen, &ctx);
-
- p->vTable->fini ();
+ foreach (CompWindow *w, priv->windows)
+ p->vTable->finiWindow (w);
}
bool
-CompPlugin::objectInitPlugins (CompObject *o)
+CompPlugin::screenInitPlugins (CompScreen *s)
{
- InitObjectContext ctx;
-
CompPlugin::List::reverse_iterator rit = plugins.rbegin ();
- ctx.object = NULL;
+ CompPlugin *p = NULL;
while (rit != plugins.rend ())
{
+ p = (*rit);
- ctx.plugin = (*rit);
-
- if (!initObjectTree (o, &ctx))
- {
- if (rit == plugins.rbegin ())
- return false;
- --rit;
- for (; rit != plugins.rbegin (); --rit)
- {
- ctx.plugin = (*rit);
-
- finiObjectTree (o, &ctx);
- }
-
- ctx.plugin = (*rit);
-
- finiObjectTree (o, &ctx);
- return false;
- }
+ if (p->vTable->initScreen (s))
+ s->initPluginForScreen (p);
+
rit++;
}
@@ -422,20 +361,39 @@ CompPlugin::objectInitPlugins (CompObject *o)
}
void
-CompPlugin::objectFiniPlugins (CompObject *o)
+CompPlugin::screenFiniPlugins (CompScreen *s)
{
- InitObjectContext ctx;
+ foreach (CompPlugin *p, plugins)
+ {
+ s->finiPluginForScreen (p);
+ p->vTable->finiScreen (s);
+ }
+
+}
- ctx.object = NULL;
+bool
+CompPlugin::windowInitPlugins (CompWindow *w)
+{
+ bool status = true;
foreach (CompPlugin *p, plugins)
{
- ctx.plugin = p;
+ p->vTable->finiWindow (w);
+ }
+
+ return status;
+}
- finiObjectTree (o, &ctx);
+void
+CompPlugin::windowFiniPlugins (CompWindow *w)
+{
+ foreach (CompPlugin *p, plugins)
+ {
+ p->vTable->finiWindow (w);
}
}
+
CompPlugin *
CompPlugin::find (const char *name)
{
@@ -667,26 +625,36 @@ CompPlugin::VTable::getMetadata ()
bool
-CompPlugin::VTable::initObject (CompObject *object)
+CompPlugin::VTable::initScreen (CompScreen *)
+{
+ return true;
+}
+
+void
+CompPlugin::VTable::finiScreen (CompScreen *)
+{
+}
+
+bool
+CompPlugin::VTable::initWindow (CompWindow *)
{
return true;
}
void
-CompPlugin::VTable::finiObject (CompObject *object)
+CompPlugin::VTable::finiWindow (CompWindow *)
{
}
CompOption::Vector &
-CompPlugin::VTable::getObjectOptions (CompObject *object)
+CompPlugin::VTable::getOptions ()
{
return noOptions;
}
bool
-CompPlugin::VTable::setObjectOption (CompObject *object,
- const char *name,
- CompOption::Value &value)
+CompPlugin::VTable::setOption (const char *name,
+ CompOption::Value &value)
{
return false;
}
diff --git a/src/privates.cpp b/src/privates.cpp
new file mode 100644
index 0000000..1ca0569
--- /dev/null
+++ b/src/privates.cpp
@@ -0,0 +1,47 @@
+
+#include <core/privates.h>
+
+CompPrivateStorage::CompPrivateStorage (CompPrivateStorage::Indices *iList) :
+ privates (0)
+{
+ if (iList->size() > 0)
+ privates.resize (iList->size ());
+}
+
+int
+CompPrivateStorage::allocatePrivateIndex (CompPrivateStorage::Indices *iList)
+{
+ if (!iList)
+ return -1;
+
+ for (unsigned int i = 0; i < iList->size(); i++)
+ {
+ if (!iList->at (i))
+ {
+ iList->at (i) = true;
+ return i;
+ }
+ }
+ unsigned int i = iList->size ();
+ iList->resize (i + 1);
+ iList->at (i) = true;
+
+ return i;
+}
+
+void
+CompPrivateStorage::freePrivateIndex (CompPrivateStorage::Indices *iList,
+ int idx)
+{
+ if (!iList || idx < 0 || idx >= (int) iList->size())
+ return;
+
+ if (idx < (int) iList->size () - 1)
+ {
+ iList->at(idx) = false;
+ return;
+ }
+
+ unsigned int i = iList->size () - 1;
+ iList->resize (i);
+}
diff --git a/src/screen.cpp b/src/screen.cpp
index bbfe15a..f0cddfe 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -91,20 +91,23 @@ CompScreen *screen;
#define NUM_OPTIONS(s) (sizeof ((s)->priv->opt) / sizeof (CompOption))
-CompObject::indices screenPrivateIndices (0);
+CompPrivateStorage::Indices screenPrivateIndices (0);
int
CompScreen::allocPrivateIndex ()
{
- return CompObject::allocatePrivateIndex (COMP_OBJECT_TYPE_SCREEN,
- &screenPrivateIndices);
+ int i = CompPrivateStorage::allocatePrivateIndex (&screenPrivateIndices);
+ if (screenPrivateIndices.size () != screen->privates.size ())
+ screen->privates.resize (screenPrivateIndices.size ());
+ return i;
}
void
CompScreen::freePrivateIndex (int index)
{
- CompObject::freePrivateIndex (COMP_OBJECT_TYPE_SCREEN,
- &screenPrivateIndices, index);
+ CompPrivateStorage::freePrivateIndex (&screenPrivateIndices, index);
+ if (screenPrivateIndices.size () != screen->privates.size ())
+ screen->privates.resize (screenPrivateIndices.size ());
}
@@ -436,45 +439,23 @@ CompScreen::fileWatchAdded (CompFileWatch *watch)
void
CompScreen::fileWatchRemoved (CompFileWatch *watch)
WRAPABLE_HND_FUNC(1, fileWatchRemoved, watch)
-
-bool
-CompScreen::initPluginForObject (CompPlugin *plugin, CompObject *object)
-{
- WRAPABLE_HND_FUNC_RETURN(2, bool, initPluginForObject, plugin, object)
- return true;
-}
-
-void
-CompScreen::finiPluginForObject (CompPlugin *plugin, CompObject *object)
- WRAPABLE_HND_FUNC(3, finiPluginForObject, plugin, object)
-
bool
-CompScreen::setOptionForPlugin (CompObject *object,
- const char *plugin,
+CompScreen::setOptionForPlugin (const char *plugin,
const char *name,
CompOption::Value &value)
{
WRAPABLE_HND_FUNC_RETURN(4, bool, setOptionForPlugin,
- object, plugin, name, value)
+ plugin, name, value)
CompPlugin *p = CompPlugin::find (plugin);
if (p)
- return p->vTable->setObjectOption (object, name, value);
+ return p->vTable->setOption (name, value);
return false;
}
void
-CompScreen::objectAdd (CompObject *parent, CompObject *object)
- WRAPABLE_HND_FUNC(5, objectAdd, parent, object)
-
-
-void
-CompScreen::objectRemove (CompObject *parent, CompObject *object)
- WRAPABLE_HND_FUNC(6, objectRemove, parent, object)
-
-void
CompScreen::sessionEvent (CompSession::Event event,
CompOption::Vector &arguments)
WRAPABLE_HND_FUNC(7, sessionEvent, event, arguments)
@@ -488,28 +469,19 @@ ScreenInterface::fileWatchRemoved (CompFileWatch *watch)
WRAPABLE_DEF (fileWatchRemoved, watch)
bool
-ScreenInterface::initPluginForObject (CompPlugin *plugin, CompObject *object)
- WRAPABLE_DEF (initPluginForObject, plugin, object)
+ScreenInterface::initPluginForScreen (CompPlugin *plugin)
+ WRAPABLE_DEF (initPluginForScreen, plugin)
void
-ScreenInterface::finiPluginForObject (CompPlugin *plugin, CompObject *object)
- WRAPABLE_DEF (finiPluginForObject, plugin, object)
+ScreenInterface::finiPluginForScreen (CompPlugin *plugin)
+ WRAPABLE_DEF (finiPluginForScreen, plugin)
bool
-ScreenInterface::setOptionForPlugin (CompObject *object,
- const char *plugin,
+ScreenInterface::setOptionForPlugin (const char *plugin,
const char *name,
CompOption::Value &value)
- WRAPABLE_DEF (setOptionForPlugin, object, plugin, name, value)
-
-void
-ScreenInterface::objectAdd (CompObject *parent, CompObject *object)
- WRAPABLE_DEF (objectAdd, parent, object)
-
-void
-ScreenInterface::objectRemove (CompObject *parent, CompObject *object)
- WRAPABLE_DEF (objectRemove, parent, object)
+ WRAPABLE_DEF (setOptionForPlugin, plugin, name, value)
void
ScreenInterface::sessionEvent (CompSession::Event event,
@@ -604,21 +576,6 @@ const CompMetadata::OptionInfo coreOptionInfo[COMP_OPTION_NUM] = {
{ "focus_prevention_match", "match", 0, 0, 0 }
};
-CompOption::Vector &
-CompScreen::getOptions (CompObject *object)
-{
- return screen->priv->opt;
-}
-
-bool
-CompScreen::setOption (CompObject *object,
- const char *name,
- CompOption::Value &value)
-{
- return screen->setOption (name, value);
-}
-
-
static const int maskTable[] = {
ShiftMask, LockMask, ControlMask, Mod1Mask,
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
@@ -816,6 +773,12 @@ PrivateScreen::handlePingTimeout ()
return true;
}
+CompOption::Vector &
+CompScreen::getOptions ()
+{
+ return priv->opt;
+}
+
bool
CompScreen::setOption (const char *name,
CompOption::Value &value)
@@ -1194,7 +1157,7 @@ PrivateScreen::updatePlugins ()
CompPlugin::unload (pp);
}
- screen->setOptionForPlugin (screen, "core", o->name ().c_str (), plugin);
+ screen->setOptionForPlugin ("core", o->name ().c_str (), plugin);
}
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */
@@ -2128,7 +2091,7 @@ PrivateScreen::detectOutputDevices ()
name = opt[COMP_OPTION_OUTPUTS].name ();
opt[COMP_OPTION_DETECT_OUTPUTS].value ().set (false);
- screen->setOptionForPlugin (screen, "core", name.c_str (), value);
+ screen->setOptionForPlugin ("core", name.c_str (), value);
opt[COMP_OPTION_DETECT_OUTPUTS].value ().set (true);
}
@@ -4330,7 +4293,7 @@ CompScreen::screenInfo ()
}
CompScreen::CompScreen ():
- CompObject (COMP_OBJECT_TYPE_SCREEN, "screen", &screenPrivateIndices)
+ CompPrivateStorage (&screenPrivateIndices)
{
priv = new PrivateScreen (this);
assert (priv);
@@ -4658,7 +4621,7 @@ CompScreen::init (const char *name)
priv->getDesktopHints ();
/* TODO: bailout properly when objectInitPlugins fails */
- assert (CompPlugin::objectInitPlugins (this));
+ assert (CompPlugin::screenInitPlugins (this));
XQueryTree (dpy, priv->root,
&rootReturn, &parentReturn,
@@ -4760,7 +4723,7 @@ CompScreen::~CompScreen ()
while (!priv->windows.empty ())
delete priv->windows.front ();
- CompPlugin::objectFiniPlugins (this);
+ CompPlugin::screenFiniPlugins (this);
XUngrabKey (priv->dpy, AnyKey, AnyModifier, priv->root);
diff --git a/src/window.cpp b/src/window.cpp
index ad3f8fd..b9b0f8c 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -47,20 +47,25 @@
#include "privatescreen.h"
-CompObject::indices windowPrivateIndices (0);
+CompPrivateStorage::Indices windowPrivateIndices (0);
int
CompWindow::allocPrivateIndex ()
{
- return CompObject::allocatePrivateIndex (COMP_OBJECT_TYPE_WINDOW,
- &windowPrivateIndices);
+ int i = CompPrivateStorage::allocatePrivateIndex (&windowPrivateIndices);
+ foreach (CompWindow *w, ::screen->windows ())
+ if (windowPrivateIndices.size () != w->privates.size ())
+ w->privates.resize (windowPrivateIndices.size ());
+ return i;
}
void
CompWindow::freePrivateIndex (int index)
{
- CompObject::freePrivateIndex (COMP_OBJECT_TYPE_WINDOW,
- &windowPrivateIndices, index);
+ CompPrivateStorage::freePrivateIndex (&windowPrivateIndices, index);
+ foreach (CompWindow *w, ::screen->windows ())
+ if (windowPrivateIndices.size () != w->privates.size ())
+ w->privates.resize (windowPrivateIndices.size ());
}
bool
@@ -4389,7 +4394,7 @@ CompWindow::invisible ()
CompWindow::CompWindow (CompScreen *screen,
Window id,
Window aboveId) :
- CompObject (COMP_OBJECT_TYPE_WINDOW, "window", &windowPrivateIndices)
+ CompPrivateStorage (&windowPrivateIndices)
{
priv = new PrivateWindow (this, screen);
assert (priv);
@@ -4578,9 +4583,7 @@ CompWindow::CompWindow (CompScreen *screen,
}
/* TODO: bailout properly when objectInitPlugins fails */
- assert (CompPlugin::objectInitPlugins (this));
-
- screen->addChild (this);
+ assert (CompPlugin::windowInitPlugins (this));
recalcActions ();
updateIconGeometry ();
@@ -4639,9 +4642,7 @@ CompWindow::~CompWindow ()
if (priv->destroyed)
priv->screen->updateClientList ();
- removeFromParent ();
-
- CompPlugin::objectFiniPlugins (this);
+ CompPlugin::windowFiniPlugins (this);
delete priv;
}