summaryrefslogtreecommitdiff
path: root/plugins/water
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2009-03-15 23:41:00 +0100
committerDennis kasprzyk <onestone@compiz-fusion.org>2009-03-15 23:41:00 +0100
commit582a0c71bab4bf6f6020f44fcf6860df29111c25 (patch)
treec6802da1deddcab1f1db7a4a34fa76a699efa772 /plugins/water
parentcbc615b856236f4a48cdceb34a7ed4e97818de02 (diff)
downloadcompiz-with-glib-mainloop-582a0c71bab4bf6f6020f44fcf6860df29111c25.tar.gz
compiz-with-glib-mainloop-582a0c71bab4bf6f6020f44fcf6860df29111c25.tar.bz2
Track core changes.
Use bcop.
Diffstat (limited to 'plugins/water')
-rw-r--r--plugins/water/src/water.cpp82
-rw-r--r--plugins/water/src/water.h21
-rw-r--r--plugins/water/water.xml.in2
3 files changed, 29 insertions, 76 deletions
diff --git a/plugins/water/src/water.cpp b/plugins/water/src/water.cpp
index 3c506ea..19b8330 100644
--- a/plugins/water/src/water.cpp
+++ b/plugins/water/src/water.cpp
@@ -25,7 +25,7 @@
#include "water.h"
-COMPIZ_PLUGIN_20081216 (water, WaterPluginVTable)
+COMPIZ_PLUGIN_20090315 (water, WaterPluginVTable)
static int waterLastPointerX = 0;
static int waterLastPointerY = 0;
@@ -1101,7 +1101,7 @@ waterToggleRain (CompAction *action,
{
int delay;
- delay = ws->opt[WATER_OPTION_RAIN_DELAY].value ().i ();
+ delay = ws->optionGetRainDelay ();
ws->rainTimer.start (delay, (float) delay * 1.2);
}
else
@@ -1249,64 +1249,29 @@ WaterScreen::handleEvent (XEvent *event)
screen->handleEvent (event);
}
-CompOption::Vector &
-WaterScreen::getOptions ()
-{
- return opt;
-}
-
-bool
-WaterScreen::setOption (const char *name,
- CompOption::Value &value)
+void
+WaterScreen::optionChange (WaterOptions::Options num)
{
- CompOption *o;
- unsigned int index;
-
- o = CompOption::findOption (opt, name, &index);
- if (!o)
- return false;
-
- switch (index) {
- case WATER_OPTION_OFFSET_SCALE:
- if (o->set (value))
- {
- offsetScale = o->value ().f () * 50.0f;
- return true;
- }
+ switch (num) {
+ case WaterOptions::OffsetScale:
+ offsetScale = optionGetOffsetScale () * 50.0f;
break;
- case WATER_OPTION_RAIN_DELAY:
- if (o->set (value))
+ case WaterOptions::RainDelay:
+ if (rainTimer.active ())
{
- if (rainTimer.active ())
- {
- rainTimer.setTimes (value.i (), (float)value.i () * 1.2);
- }
- return true;
+ rainTimer.setTimes (optionGetRainDelay (),
+ (float)optionGetRainDelay () * 1.2);
}
break;
default:
- return CompOption::setOption (*o, value);
+ break;
}
-
- return false;
}
-static const CompMetadata::OptionInfo waterOptionInfo[] = {
- { "initiate_key", "key", 0, waterInitiate, waterTerminate },
- { "toggle_rain_key", "key", 0, waterToggleRain, 0 },
- { "toggle_wiper_key", "key", 0, waterToggleWiper, 0 },
- { "offset_scale", "float", "<min>0</min>", 0, 0 },
- { "rain_delay", "int", "<min>1</min>", 0, 0 },
- { "title_wave", "bell", 0, waterTitleWave, 0 },
- { "point", "action", 0, waterPoint, 0 },
- { "line", "action", 0, waterLine, 0 }
-};
-
WaterScreen::WaterScreen (CompScreen *screen) :
PluginClassHandler<WaterScreen,CompScreen> (screen),
cScreen (CompositeScreen::get (screen)),
gScreen (GLScreen::get (screen)),
- opt(WATER_OPTION_NUM),
grabIndex (0),
width (0),
height (0),
@@ -1333,14 +1298,7 @@ WaterScreen::WaterScreen (CompScreen *screen) :
bumpMapFunctions ()
{
- if (!waterVTable->getMetadata ()->initOptions (waterOptionInfo,
- WATER_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
-
- offsetScale = opt[WATER_OPTION_OFFSET_SCALE].value ().f () * 50.0f;
+ offsetScale = optionGetOffsetScale () * 50.0f;
memset (texture, 0, sizeof (GLuint) * TEXTURE_NUM);
@@ -1349,6 +1307,17 @@ WaterScreen::WaterScreen (CompScreen *screen) :
waterReset ();
+ optionSetOffsetScaleNotify (boost::bind (&WaterScreen::optionChange, this, _2));
+ optionSetRainDelayNotify (boost::bind (&WaterScreen::optionChange, this, _2));
+
+ optionSetInitiateKeyInitiate (waterInitiate);
+ optionSetInitiateKeyTerminate (waterTerminate);
+ optionSetToggleRainKeyInitiate (waterToggleRain);
+ optionSetToggleWiperKeyInitiate (waterToggleWiper);
+ optionSetTitleWaveInitiate (waterTitleWave);
+ optionSetPointInitiate (waterPoint);
+ optionSetLineInitiate (waterLine);
+
ScreenInterface::setHandler (screen, false);
CompositeScreenInterface::setHandler (cScreen, false);
}
@@ -1384,9 +1353,6 @@ WaterPluginVTable::init ()
!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
return false;
- getMetadata ()->addFromOptionInfo (waterOptionInfo, WATER_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/water/src/water.h b/plugins/water/src/water.h
index fb393db..4172034 100644
--- a/plugins/water/src/water.h
+++ b/plugins/water/src/water.h
@@ -37,15 +37,7 @@
#include <composite/composite.h>
#include <opengl/opengl.h>
-#define WATER_OPTION_INITIATE_KEY 0
-#define WATER_OPTION_TOGGLE_RAIN_KEY 1
-#define WATER_OPTION_TOGGLE_WIPER_KEY 2
-#define WATER_OPTION_OFFSET_SCALE 3
-#define WATER_OPTION_RAIN_DELAY 4
-#define WATER_OPTION_TITLE_WAVE 5
-#define WATER_OPTION_POINT 6
-#define WATER_OPTION_LINE 7
-#define WATER_OPTION_NUM 8
+#include "water_options.h"
#define WATER_SCREEN(s) \
WaterScreen *ws = WaterScreen::get (s)
@@ -77,15 +69,15 @@ struct WaterFunction {
class WaterScreen :
public ScreenInterface,
public CompositeScreenInterface,
- public PluginClassHandler<WaterScreen,CompScreen>
+ public PluginClassHandler<WaterScreen,CompScreen>,
+ public WaterOptions
{
public:
WaterScreen (CompScreen *screen);
~WaterScreen ();
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
+ void optionChange (WaterOptions::Options num);
void handleEvent (XEvent *);
@@ -122,8 +114,6 @@ class WaterScreen :
CompositeScreen *cScreen;
GLScreen *gScreen;
-
- CompOption::Vector opt;
float offsetScale;
@@ -187,7 +177,4 @@ class WaterPluginVTable :
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (WaterScreen);
-
};
diff --git a/plugins/water/water.xml.in b/plugins/water/water.xml.in
index af41bc9..12e0a31 100644
--- a/plugins/water/water.xml.in
+++ b/plugins/water/water.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="water">
+ <plugin name="water" useBcop="true">
<_short>Water Effect</_short>
<_long>Adds water effects to different desktop actions</_long>
<deps>