summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <SmSpillaz@gmail.com>2010-05-23 17:30:00 +0800
committerSam Spilsbury <SmSpillaz@gmail.com>2010-05-23 17:30:00 +0800
commit79153214e2ba5898b6dd943d77bac6216a5d078d (patch)
tree191246086005f625e26b6215d34c805adad7ebce
parent2269c8c9b2a69884c164c3a24f4abaab087caed9 (diff)
downloadzcomp-79153214e2ba5898b6dd943d77bac6216a5d078d.tar.gz
zcomp-79153214e2ba5898b6dd943d77bac6216a5d078d.tar.bz2
Don't require opengl or composite, but load after them if available
-rw-r--r--plugins/compiztoolbox/compiztoolbox.xml.in4
-rw-r--r--plugins/compiztoolbox/src/compiztoolbox.cpp37
2 files changed, 30 insertions, 11 deletions
diff --git a/plugins/compiztoolbox/compiztoolbox.xml.in b/plugins/compiztoolbox/compiztoolbox.xml.in
index 9384e90..03580dd 100644
--- a/plugins/compiztoolbox/compiztoolbox.xml.in
+++ b/plugins/compiztoolbox/compiztoolbox.xml.in
@@ -4,10 +4,10 @@
<_long>Commonly used routines by plugins separated into a separate library</_long>
<category>Utility</category>
<deps>
- <requirement>
+ <relation type="after">
<plugin>composite</plugin>
<plugin>opengl</plugin>
- </requirement>
+ </relation>
</deps>
</plugin>
</compiz>
diff --git a/plugins/compiztoolbox/src/compiztoolbox.cpp b/plugins/compiztoolbox/src/compiztoolbox.cpp
index 976d909..7ff6995 100644
--- a/plugins/compiztoolbox/src/compiztoolbox.cpp
+++ b/plugins/compiztoolbox/src/compiztoolbox.cpp
@@ -28,6 +28,8 @@
#include <compiztoolbox/compiztoolbox.h>
#include "compiztoolbox_options.h"
+bool openGLAvailable;
+
class CompizToolboxScreen :
public PluginClassHandler <CompizToolboxScreen, CompScreen>,
public CompiztoolboxOptions
@@ -521,7 +523,8 @@ BaseSwitchWindow::paintThumb (const GLWindowPaintAttrib &attrib,
int width2,
int height2)
{
-
+ if (!openGLAvailable)
+ return;
GLWindowPaintAttrib sAttrib (attrib);
IconMode iconMode;
@@ -682,6 +685,9 @@ BaseSwitchWindow::paintThumb (const GLWindowPaintAttrib &attrib,
bool
BaseSwitchWindow::damageRect (bool initial, const CompRect &rect)
{
+ if (!openGLAvailable)
+ return true;
+
if (baseScreen->grabIndex)
{
CompWindow *popup;
@@ -784,8 +790,6 @@ BaseSwitchScreen::handleEvent (XEvent *event)
}
BaseSwitchScreen::BaseSwitchScreen (CompScreen *screen) :
- cScreen (CompositeScreen::get (screen)),
- gScreen (GLScreen::get (screen)),
popupWindow (None),
selectedWindow (NULL),
lastActiveNum (0),
@@ -794,6 +798,13 @@ BaseSwitchScreen::BaseSwitchScreen (CompScreen *screen) :
selection (CurrentViewport),
ignoreSwitcher (false)
{
+ if (openGLAvailable)
+ {
+ cScreen = CompositeScreen::get (screen);
+ gScreen = GLScreen::get (screen);
+ }
+
+
selectWinAtom =
XInternAtom (::screen->dpy (), DECOR_SWITCH_WINDOW_ATOM_NAME, 0);
selectFgColorAtom =
@@ -807,11 +818,15 @@ BaseSwitchScreen::BaseSwitchScreen (CompScreen *screen) :
BaseSwitchWindow::BaseSwitchWindow (BaseSwitchScreen *ss, CompWindow *w) :
baseScreen (ss),
- gWindow (GLWindow::get (w)),
- cWindow (CompositeWindow::get (w)),
- gScreen (GLScreen::get (::screen)),
window (w)
{
+ if (openGLAvailable)
+ {
+ gWindow = GLWindow::get (w);
+ cWindow = CompositeWindow::get (w);
+ gScreen = GLScreen::get (screen);
+ }
+
}
CompizToolboxScreen::CompizToolboxScreen (CompScreen *screen) :
@@ -822,11 +837,15 @@ CompizToolboxScreen::CompizToolboxScreen (CompScreen *screen) :
bool
CompizToolboxPluginVTable::init ()
{
- if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
- !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
- !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
+ openGLAvailable = true;
+
+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
+ if (!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
+ !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
+ openGLAvailable = false;
+
CompPrivate p;
p.uval = COMPIZ_COMPOSITE_ABI;
screen->storeValue ("compiztoolbox_ABI", p);