summaryrefslogtreecommitdiff
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
parentcbc615b856236f4a48cdceb34a7ed4e97818de02 (diff)
downloadcompiz-with-glib-mainloop-582a0c71bab4bf6f6020f44fcf6860df29111c25.tar.gz
compiz-with-glib-mainloop-582a0c71bab4bf6f6020f44fcf6860df29111c25.tar.bz2
Track core changes.
Use bcop.
-rw-r--r--plugins/blur/blur.xml.in2
-rw-r--r--plugins/blur/src/blur.cpp233
-rw-r--r--plugins/blur/src/blur.h33
-rw-r--r--plugins/commands/commands.xml.in2
-rw-r--r--plugins/commands/src/commands.cpp133
-rw-r--r--plugins/commands/src/commands.h61
-rw-r--r--plugins/copytex/src/copytex.cpp5
-rw-r--r--plugins/decor/decor.xml.in2
-rw-r--r--plugins/decor/src/decor.cpp120
-rw-r--r--plugins/decor/src/decor.h21
-rw-r--r--plugins/fade/fade.xml.in2
-rw-r--r--plugins/fade/src/fade.cpp109
-rw-r--r--plugins/fade/src/fade.h25
-rw-r--r--plugins/gnomecompat/gnomecompat.xml.in2
-rw-r--r--plugins/gnomecompat/src/gnomecompat.cpp57
-rw-r--r--plugins/gnomecompat/src/gnomecompat.h20
-rw-r--r--plugins/imgpng/src/imgpng.cpp5
-rw-r--r--plugins/ini/src/ini.cpp4
-rw-r--r--plugins/inotify/src/inotify.cpp4
-rw-r--r--plugins/move/move.xml.in2
-rw-r--r--plugins/move/src/move.cpp116
-rw-r--r--plugins/move/src/move.h23
-rw-r--r--plugins/place/place.xml.in2
-rw-r--r--plugins/place/src/place.cpp165
-rw-r--r--plugins/place/src/place.h38
-rw-r--r--plugins/regex/src/regex.cpp4
-rw-r--r--plugins/resize/resize.xml.in2
-rw-r--r--plugins/resize/src/resize.cpp160
-rw-r--r--plugins/resize/src/resize.h32
-rw-r--r--plugins/scale/include/scale/scale.h6
-rw-r--r--plugins/scale/scale.xml.in2
-rw-r--r--plugins/scale/src/privates.h42
-rw-r--r--plugins/scale/src/scale.cpp211
-rw-r--r--plugins/switcher/src/switcher.cpp188
-rw-r--r--plugins/switcher/src/switcher.h43
-rw-r--r--plugins/switcher/switcher.xml.in2
-rw-r--r--plugins/water/src/water.cpp82
-rw-r--r--plugins/water/src/water.h21
-rw-r--r--plugins/water/water.xml.in2
-rw-r--r--plugins/zoom/src/zoom.cpp66
-rw-r--r--plugins/zoom/src/zoom.h21
-rw-r--r--plugins/zoom/zoom.xml.in2
42 files changed, 598 insertions, 1474 deletions
diff --git a/plugins/blur/blur.xml.in b/plugins/blur/blur.xml.in
index 89a235a..6db5181 100644
--- a/plugins/blur/blur.xml.in
+++ b/plugins/blur/blur.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="blur">
+ <plugin name="blur" useBcop="true">
<_short>Blur Windows</_short>
<_long>Blur windows</_long>
<feature>blur</feature>
diff --git a/plugins/blur/src/blur.cpp b/plugins/blur/src/blur.cpp
index 2735773..c13230e 100644
--- a/plugins/blur/src/blur.cpp
+++ b/plugins/blur/src/blur.cpp
@@ -25,7 +25,7 @@
#include <blur.h>
-COMPIZ_PLUGIN_20081216 (blur, BlurPluginVTable)
+COMPIZ_PLUGIN_20090315 (blur, BlurPluginVTable)
/* pascal triangle based kernel generator */
static int
@@ -104,22 +104,21 @@ blurCreateGaussianLinearKernel (int radius,
void
BlurScreen::updateFilterRadius ()
{
-
- switch (opt[BLUR_OPTION_FILTER].value ().i ()) {
- case BLUR_FILTER_4X_BILINEAR:
+ switch (optionGetFilter ()) {
+ case BlurOptions::Filter4xbilinear:
filterRadius = 2;
break;
- case BLUR_FILTER_GAUSSIAN: {
- int radius = opt[BLUR_OPTION_GAUSSIAN_RADIUS].value ().i ();
- float strength = opt[BLUR_OPTION_GAUSSIAN_STRENGTH].value ().f ();
+ case BlurOptions::FilterGaussian: {
+ int radius = optionGetGaussianRadius ();
+ float strength = optionGetGaussianStrength ();
blurCreateGaussianLinearKernel (radius, strength, amp, pos,
&numTexop);
filterRadius = radius;
} break;
- case BLUR_FILTER_MIPMAP: {
- float lod = opt[BLUR_OPTION_MIPMAP_LOD].value ().f ();
+ case BlurOptions::FilterMipmap: {
+ float lod = optionGetMipmapLod ();
filterRadius = powf (2.0f, ceilf (lod));
} break;
@@ -260,7 +259,7 @@ BlurWindow::updateAlphaMatch ()
{
CompMatch *match;
- match = &bScreen->opt[BLUR_OPTION_ALPHA_BLUR_MATCH].value ().match ();
+ match = &bScreen->optionGetAlphaBlurMatch ();
if (match->evaluate (window))
{
if (!state[BLUR_STATE_CLIENT].threshold)
@@ -282,7 +281,7 @@ BlurWindow::updateMatch ()
updateAlphaMatch ();
- match = &bScreen->opt[BLUR_OPTION_FOCUS_BLUR_MATCH].value ().match ();
+ match = &bScreen->optionGetFocusBlurMatch ();
focus = GL::fragmentProgram && match->evaluate (window);
if (focus != focusBlur)
@@ -359,7 +358,7 @@ BlurScreen::preparePaint (int msSinceLastPaint)
if (moreBlur)
{
int steps;
- bool focus = opt[BLUR_OPTION_FOCUS_BLUR].value ().b ();
+ bool focus = optionGetFocusBlur ();
bool focusBlur;
steps = (msSinceLastPaint * 0xffff) / blurTime;
@@ -590,8 +589,8 @@ BlurScreen::getSrcBlurFragmentFunction (GLTexture *texture,
param, param);
- switch (opt[BLUR_OPTION_FILTER].value ().i ()) {
- case BLUR_FILTER_4X_BILINEAR:
+ switch (optionGetFilter ()) {
+ case BlurOptions::Filter4xbilinear:
default:
data.addFetchOp ("output", "offset0", target);
data.addDataOp ("MUL sum, output, 0.25;");
@@ -656,7 +655,7 @@ BlurScreen::getDstBlurFragmentFunction (GLTexture *texture,
static const char *temp[] = { "fCoord", "mask", "sum", "dst" };
int i, j;
char str[1024];
- int saturation = opt[BLUR_OPTION_SATURATION].value ().i ();
+ int saturation = optionGetSaturation ();
int numIndirect;
int numIndirectOp;
int base, end, ITCbase;
@@ -667,8 +666,8 @@ BlurScreen::getDstBlurFragmentFunction (GLTexture *texture,
if (saturation < 100)
data.addTempHeaderOp ("sat");
- switch (opt[BLUR_OPTION_FILTER].value ().i ()) {
- case BLUR_FILTER_4X_BILINEAR: {
+ switch (optionGetFilter ()) {
+ case BlurOptions::Filter4xbilinear: {
static const char *filterTemp[] = {
"t0", "t1", "t2", "t3",
"s0", "s1", "s2", "s3"
@@ -712,7 +711,7 @@ BlurScreen::getDstBlurFragmentFunction (GLTexture *texture,
param + 1);
} break;
- case BLUR_FILTER_GAUSSIAN: {
+ case BlurOptions::FilterGaussian: {
/* try to use only half of the available temporaries to keep
other plugins working */
@@ -809,7 +808,7 @@ BlurScreen::getDstBlurFragmentFunction (GLTexture *texture,
}
} break;
- case BLUR_FILTER_MIPMAP:
+ case BlurOptions::FilterMipmap:
data.addFetchOp ("output", NULL, target);
data.addColorOp ("output", "output");
@@ -1112,8 +1111,7 @@ BlurScreen::fboUpdate (BoxPtr pBox,
int i, y, iTC = 0;
Bool wasCulled = glIsEnabled (GL_CULL_FACE);
- if (GL::maxTextureUnits &&
- opt[BLUR_OPTION_INDEPENDENT_TEX].value ().b ())
+ if (GL::maxTextureUnits && optionGetIndependentTex ())
iTC = MIN ((GL::maxTextureUnits - 1) / 2, numTexop);
if (!program)
@@ -1361,11 +1359,11 @@ BlurWindow::updateDstTexture (const GLMatrix &transform,
int y;
int filter;
- filter = bScreen->opt[BLUR_OPTION_FILTER].value ().i ();
+ filter = bScreen->optionGetFilter ();
bScreen->tmpRegion3 = CompRegion ();
- if (filter == BLUR_FILTER_GAUSSIAN)
+ if (filter == BlurOptions::FilterGaussian)
{
if (state[BLUR_STATE_DECOR].threshold)
@@ -1471,7 +1469,7 @@ BlurWindow::updateDstTexture (const GLMatrix &transform,
bScreen->ty = 1;
}
- if (filter == BLUR_FILTER_GAUSSIAN)
+ if (filter == BlurOptions::FilterGaussian)
{
if (GL::fbo && !bScreen->fbo)
(*GL::genFramebuffers) (1, &bScreen->fbo);
@@ -1508,7 +1506,7 @@ BlurWindow::updateDstTexture (const GLMatrix &transform,
glTexParameteri (bScreen->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri (bScreen->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- if (filter == BLUR_FILTER_MIPMAP)
+ if (filter == BlurOptions::FilterMipmap)
{
if (!GL::fbo)
{
@@ -1556,13 +1554,13 @@ BlurWindow::updateDstTexture (const GLMatrix &transform,
}
switch (filter) {
- case BLUR_FILTER_GAUSSIAN:
+ case BlurOptions::FilterGaussian:
return bScreen->fboUpdate (bScreen->tmpRegion.handle()->rects,
bScreen->tmpRegion.numRects ());
- case BLUR_FILTER_MIPMAP:
+ case BlurOptions::FilterMipmap:
(*GL::generateMipmap) (bScreen->target);
break;
- case BLUR_FILTER_4X_BILINEAR:
+ case BlurOptions::Filter4xbilinear:
break;
}
@@ -1755,8 +1753,8 @@ BlurWindow::glDrawTexture (GLTexture *texture,
GLFragment::Attrib dstFa (fa);
float threshold = (float) this->state[state].threshold;
- switch (bScreen->opt[BLUR_OPTION_FILTER].value ().i ()) {
- case BLUR_FILTER_4X_BILINEAR:
+ switch (bScreen->optionGetFilter ()) {
+ case BlurOptions::Filter4xbilinear:
dx = bScreen->tx / 2.1f;
dy = bScreen->ty / 2.1f;
@@ -1788,8 +1786,8 @@ BlurWindow::glDrawTexture (GLTexture *texture,
dx, dy, 0.0f, 0.0f);
}
break;
- case BLUR_FILTER_GAUSSIAN:
- if (bScreen->opt[BLUR_OPTION_INDEPENDENT_TEX].value ().b ())
+ case BlurOptions::FilterGaussian:
+ if (bScreen->optionGetIndependentTex ())
{
/* leave one free texture unit for fragment position */
iTC = MAX (0, GL::maxTextureUnits -
@@ -1927,7 +1925,7 @@ BlurWindow::glDrawTexture (GLTexture *texture,
}
break;
- case BLUR_FILTER_MIPMAP:
+ case BlurOptions::FilterMipmap:
param = dstFa.allocParameters (2);
unit = dstFa.allocTextureUnits (1);
@@ -1937,7 +1935,7 @@ BlurWindow::glDrawTexture (GLTexture *texture,
if (function)
{
float lod =
- bScreen->opt[BLUR_OPTION_MIPMAP_LOD].value ().f ();
+ bScreen->optionGetMipmapLod ();
dstFa.addFunction (function);
@@ -2030,7 +2028,7 @@ BlurScreen::handleEvent (XEvent *event)
w = screen->findWindow (activeWindow);
if (w)
{
- if (opt[BLUR_OPTION_FOCUS_BLUR].value ().b ())
+ if (optionGetFocusBlur ())
{
CompositeWindow::get (w)->addDamage ();
moreBlur = true;
@@ -2040,7 +2038,7 @@ BlurScreen::handleEvent (XEvent *event)
w = screen->findWindow (screen->activeWindow ());
if (w)
{
- if (opt[BLUR_OPTION_FOCUS_BLUR].value ().b ())
+ if (optionGetFocusBlur ())
{
CompositeWindow::get (w)->addDamage ();
moreBlur = true;
@@ -2139,146 +2137,80 @@ BlurScreen::matchPropertyChanged (CompWindow *w)
screen->matchPropertyChanged (w);
}
-static CompMetadata *blurMetadata;
-
-static const CompMetadata::OptionInfo blurOptionInfo[] = {
- { "pulse", "bell", 0, blurPulse, 0 },
- { "blur_speed", "float", "<min>0.1</min>", 0, 0 },
- { "focus_blur_match", "match", 0, 0, 0 },
- { "focus_blur", "bool", 0, 0, 0 },
- { "alpha_blur_match", "match", 0, 0, 0 },
- { "alpha_blur", "bool", 0, 0, 0 },
- { "filter", "int", RESTOSTRING (0, BLUR_FILTER_LAST), 0, 0 },
- { "gaussian_radius", "int", "<min>1</min><max>15</max>", 0, 0 },
- { "gaussian_strength", "float", "<min>0.0</min><max>1.0</max>", 0, 0 },
- { "mipmap_lod", "float", "<min>0.1</min><max>5.0</max>", 0, 0 },
- { "saturation", "int", "<min>0</min><max>100</max>", 0, 0 },
- { "occlusion", "bool", 0, 0, 0 },
- { "independent_tex", "bool", 0, 0, 0 }
-};
-
-CompOption::Vector &
-BlurScreen::getOptions ()
-{
- return opt;
-}
-
bool
-BlurScreen::setOption (const char *name,
- CompOption::Value &value)
+BlurScreen::setOption (const CompString &name, CompOption::Value &value)
{
- CompOption *o;
unsigned int index;
- o = CompOption::findOption (opt, name, &index);
- if (!o)
+ bool rv = BlurOptions::setOption (name, value);
+
+ if (!rv || !CompOption::findOption (getOptions (), name, &index))
return false;
switch (index) {
- case BLUR_OPTION_BLUR_SPEED:
- if (o->set (value))
- {
- blurTime = 1000.0f / o->value ().f ();
- return true;
- }
+ case BlurOptions::BlurSpeed:
+ blurTime = 1000.0f / optionGetBlurSpeed ();
break;
- case BLUR_OPTION_FOCUS_BLUR_MATCH:
- case BLUR_OPTION_ALPHA_BLUR_MATCH:
- if (o->set (value))
- {
- foreach (CompWindow *w, screen->windows ())
- BlurWindow::get (w)->updateMatch ();
-
- moreBlur = true;
- cScreen->damageScreen ();
+ case BlurOptions::FocusBlurMatch:
+ case BlurOptions::AlphaBlurMatch:
+ foreach (CompWindow *w, screen->windows ())
+ BlurWindow::get (w)->updateMatch ();
- return true;
- }
+ moreBlur = true;
+ cScreen->damageScreen ();
break;
- case BLUR_OPTION_FOCUS_BLUR:
- if (o->set (value))
- {
- moreBlur = true;
- cScreen->damageScreen ();
-
- return true;
- }
+ case BlurOptions::FocusBlur:
+ moreBlur = true;
+ cScreen->damageScreen ();
break;
- case BLUR_OPTION_ALPHA_BLUR:
- if (o->set (value))
- {
- if (GL::fragmentProgram && o->value ().b ())
- alphaBlur = true;
- else
- alphaBlur = false;
-
- cScreen->damageScreen ();
+ case BlurOptions::AlphaBlur:
+ if (GL::fragmentProgram && optionGetAlphaBlur ())
+ alphaBlur = true;
+ else
+ alphaBlur = false;
- return true;
- }
+ cScreen->damageScreen ();
break;
- case BLUR_OPTION_FILTER:
- if (o->set (value))
- {
- blurReset ();
- cScreen->damageScreen ();
- return true;
- }
- break;
- case BLUR_OPTION_GAUSSIAN_RADIUS:
- case BLUR_OPTION_GAUSSIAN_STRENGTH:
- case BLUR_OPTION_INDEPENDENT_TEX:
- if (o->set (value))
- {
- if (opt[BLUR_OPTION_FILTER].value ().i () == BLUR_FILTER_GAUSSIAN)
- {
- blurReset ();
- cScreen->damageScreen ();
- }
- return true;
- }
- break;
- case BLUR_OPTION_MIPMAP_LOD:
- if (o->set (value))
- {
- if (opt[BLUR_OPTION_FILTER].value ().i () == BLUR_FILTER_MIPMAP)
- {
- blurReset ();
- cScreen->damageScreen ();
- }
- return true;
- }
+ case BlurOptions::Filter:
+ blurReset ();
+ cScreen->damageScreen ();
break;
- case BLUR_OPTION_SATURATION:
- if (o->set (value))
+ case BlurOptions::GaussianRadius:
+ case BlurOptions::GaussianStrength:
+ case BlurOptions::IndependentTex:
+ if (optionGetFilter () == BlurOptions::FilterGaussian)
{
blurReset ();
cScreen->damageScreen ();
- return true;
}
break;
- case BLUR_OPTION_BLUR_OCCLUSION:
- if (o->set (value))
+ case BlurOptions::MipmapLod:
+ if (optionGetFilter () == BlurOptions::FilterMipmap)
{
- blurOcclusion = o->value ().b ();
blurReset ();
cScreen->damageScreen ();
- return true;
}
break;
+ case BlurOptions::Saturation:
+ blurReset ();
+ cScreen->damageScreen ();
+ break;
+ case BlurOptions::Occlusion:
+ blurOcclusion = optionGetOcclusion ();
+ blurReset ();
+ cScreen->damageScreen ();
+ break;
default:
- return CompOption::setOption (*o, value);
break;
}
- return false;
+ return rv;
}
BlurScreen::BlurScreen (CompScreen *screen) :
PluginClassHandler<BlurScreen,CompScreen> (screen),
cScreen (CompositeScreen::get (screen)),
gScreen (GLScreen::get (screen)),
- opt(BLUR_OPTION_NUM),
moreBlur (false),
filterRadius (0),
srcBlurFunctions (0),
@@ -2290,20 +2222,14 @@ BlurScreen::BlurScreen (CompScreen *screen) :
fbo (0),
fboStatus (0)
{
- if (!blurVTable->getMetadata ()->initOptions (blurOptionInfo,
- BLUR_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
blurAtom[BLUR_STATE_CLIENT] =
XInternAtom (screen->dpy (), "_COMPIZ_WM_WINDOW_BLUR", 0);
blurAtom[BLUR_STATE_DECOR] =
XInternAtom (screen->dpy (), DECOR_BLUR_ATOM_NAME, 0);
- blurTime = 1000.0f / opt[BLUR_OPTION_BLUR_SPEED].value ().f ();
- blurOcclusion = opt[BLUR_OPTION_BLUR_OCCLUSION].value ().b ();
+ blurTime = 1000.0f / optionGetBlurSpeed ();
+ blurOcclusion = optionGetOcclusion ();
for (int i = 0; i < 2; i++)
texture[i] = 0;
@@ -2315,7 +2241,7 @@ BlurScreen::BlurScreen (CompScreen *screen) :
/* We need GL_ARB_fragment_program for blur */
if (GL::fragmentProgram)
- alphaBlur = opt[BLUR_OPTION_ALPHA_BLUR].value ().b ();
+ alphaBlur = optionGetAlphaBlur ();
else
alphaBlur = false;
@@ -2330,6 +2256,8 @@ BlurScreen::BlurScreen (CompScreen *screen) :
updateFilterRadius ();
+ optionSetPulseInitiate (blurPulse);
+
ScreenInterface::setHandler (screen, true);
CompositeScreenInterface::setHandler (cScreen, true);
GLScreenInterface::setHandler (gScreen, true);
@@ -2395,9 +2323,6 @@ BlurPluginVTable::init ()
!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
return false;
- getMetadata ()->addFromOptionInfo (blurOptionInfo, BLUR_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/blur/src/blur.h b/plugins/blur/src/blur.h
index e7df267..4f31ff6 100644
--- a/plugins/blur/src/blur.h
+++ b/plugins/blur/src/blur.h
@@ -35,12 +35,9 @@
#include <X11/Xatom.h>
#include <GL/glu.h>
-#define BLUR_GAUSSIAN_RADIUS_MAX 15
+#include "blur_options.h"
-#define BLUR_FILTER_4X_BILINEAR 0
-#define BLUR_FILTER_GAUSSIAN 1
-#define BLUR_FILTER_MIPMAP 2
-#define BLUR_FILTER_LAST BLUR_FILTER_MIPMAP
+#define BLUR_GAUSSIAN_RADIUS_MAX 15
struct BlurFunction {
@@ -69,34 +66,19 @@ struct BlurState {
bool clipped;
};
-#define BLUR_OPTION_PULSE 0
-#define BLUR_OPTION_BLUR_SPEED 1
-#define BLUR_OPTION_FOCUS_BLUR_MATCH 2
-#define BLUR_OPTION_FOCUS_BLUR 3
-#define BLUR_OPTION_ALPHA_BLUR_MATCH 4
-#define BLUR_OPTION_ALPHA_BLUR 5
-#define BLUR_OPTION_FILTER 6
-#define BLUR_OPTION_GAUSSIAN_RADIUS 7
-#define BLUR_OPTION_GAUSSIAN_STRENGTH 8
-#define BLUR_OPTION_MIPMAP_LOD 9
-#define BLUR_OPTION_SATURATION 10
-#define BLUR_OPTION_BLUR_OCCLUSION 11
-#define BLUR_OPTION_INDEPENDENT_TEX 12
-#define BLUR_OPTION_NUM 13
-
class BlurScreen :
public ScreenInterface,
public CompositeScreenInterface,
public GLScreenInterface,
- public PluginClassHandler<BlurScreen,CompScreen>
+ public PluginClassHandler<BlurScreen,CompScreen>,
+ public BlurOptions
{
public:
BlurScreen (CompScreen *screen);
~BlurScreen ();
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
+ bool setOption (const CompString &name, CompOption::Value &value);
void handleEvent (XEvent *);
@@ -144,8 +126,6 @@ class BlurScreen :
GLScreen *gScreen;
CompositeScreen *cScreen;
- CompOption::Vector opt;
-
Atom blurAtom[BLUR_STATE_NUM];
bool alphaBlur;
@@ -259,7 +239,4 @@ class BlurPluginVTable :
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (BlurScreen);
-
};
diff --git a/plugins/commands/commands.xml.in b/plugins/commands/commands.xml.in
index 4b9d283..7764516 100644
--- a/plugins/commands/commands.xml.in
+++ b/plugins/commands/commands.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="commands">
+ <plugin name="commands" useBcop="true">
<_short>Commands</_short>
<_long>Assigns bindings to arbitrary commands</_long>
<category>General</category>
diff --git a/plugins/commands/src/commands.cpp b/plugins/commands/src/commands.cpp
index b3869bb..dd9ecd6 100644
--- a/plugins/commands/src/commands.cpp
+++ b/plugins/commands/src/commands.cpp
@@ -25,7 +25,7 @@
#include "commands.h"
-COMPIZ_PLUGIN_20081216 (commands, CommandsPluginVTable);
+COMPIZ_PLUGIN_20090315 (commands, CommandsPluginVTable);
bool
CommandsScreen::runCommand (CompAction *action,
@@ -42,104 +42,56 @@ CommandsScreen::runCommand (CompAction *action,
cs = CommandsScreen::get (screen);
- screen->runCommand (cs->opt[commandOption].value (). s());
+ screen->runCommand (cs->mOptions[commandOption].value (). s());
return true;
}
-#define DISPATCH(opt) boost::bind (CommandsScreen::runCommand, _1, _2, _3, opt)
-
-static const CompMetadata::OptionInfo commandsOptionInfo[] = {
- { "command0", "string", 0, 0, 0 },
- { "command1", "string", 0, 0, 0 },
- { "command2", "string", 0, 0, 0 },
- { "command3", "string", 0, 0, 0 },
- { "command4", "string", 0, 0, 0 },
- { "command5", "string", 0, 0, 0 },
- { "command6", "string", 0, 0, 0 },
- { "command7", "string", 0, 0, 0 },
- { "command8", "string", 0, 0, 0 },
- { "command9", "string", 0, 0, 0 },
- { "command10", "string", 0, 0, 0 },
- { "command11", "string", 0, 0, 0 },
- { "run_command0_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND0), 0 },
- { "run_command1_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND1), 0 },
- { "run_command2_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND2), 0 },
- { "run_command3_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND3), 0 },
- { "run_command4_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND4), 0 },
- { "run_command5_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND5), 0 },
- { "run_command6_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND6), 0 },
- { "run_command7_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND7), 0 },
- { "run_command8_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND8), 0 },
- { "run_command9_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND9), 0 },
- { "run_command10_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND10), 0 },
- { "run_command11_key", "key", 0, DISPATCH (COMMANDS_OPTION_COMMAND11), 0 },
- { "run_command0_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND0), 0 },
- { "run_command1_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND1), 0 },
- { "run_command2_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND2), 0 },
- { "run_command3_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND3), 0 },
- { "run_command4_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND4), 0 },
- { "run_command5_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND5), 0 },
- { "run_command6_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND6), 0 },
- { "run_command7_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND7), 0 },
- { "run_command8_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND8), 0 },
- { "run_command9_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND9), 0 },
- { "run_command10_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND10), 0 },
- { "run_command11_button", "button", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND11), 0 },
- { "run_command0_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND0), 0 },
- { "run_command1_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND1), 0 },
- { "run_command2_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND2), 0 },
- { "run_command3_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND3), 0 },
- { "run_command4_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND4), 0 },
- { "run_command5_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND5), 0 },
- { "run_command6_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND6), 0 },
- { "run_command7_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND7), 0 },
- { "run_command8_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND8), 0 },
- { "run_command9_edge", "edge", 0, DISPATCH (COMMANDS_OPTION_COMMAND9), 0 },
- { "run_command10_edge", "edge", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND10), 0 },
- { "run_command11_edge", "edge", 0,
- DISPATCH (COMMANDS_OPTION_COMMAND11), 0 }
-};
CommandsScreen::CommandsScreen (CompScreen *s) :
PluginClassHandler<CommandsScreen, CompScreen> (s)
{
- if (!commandsVTable->getMetadata ()->initOptions (commandsOptionInfo,
- COMMANDS_OPTION_NUM,
- opt))
- setFailed ();
-}
-
-CompOption::Vector&
-CommandsScreen::getOptions ()
-{
- return opt;
-}
-
-bool
-CommandsScreen::setOption (const char *name,
- CompOption::Value& value)
-{
- CompOption *o;
- o = CompOption::findOption (opt, name, NULL);
- if (!o)
- return false;
+#define DISPATCH(opt) boost::bind (CommandsScreen::runCommand, _1, _2, _3, opt)
- return CompOption::setOption (*o, value);
+ optionSetRunCommand0KeyInitiate (DISPATCH (CommandsOptions::Command0));
+ optionSetRunCommand1KeyInitiate (DISPATCH (CommandsOptions::Command1));
+ optionSetRunCommand2KeyInitiate (DISPATCH (CommandsOptions::Command2));
+ optionSetRunCommand3KeyInitiate (DISPATCH (CommandsOptions::Command3));
+ optionSetRunCommand4KeyInitiate (DISPATCH (CommandsOptions::Command4));
+ optionSetRunCommand5KeyInitiate (DISPATCH (CommandsOptions::Command5));
+ optionSetRunCommand6KeyInitiate (DISPATCH (CommandsOptions::Command6));
+ optionSetRunCommand7KeyInitiate (DISPATCH (CommandsOptions::Command7));
+ optionSetRunCommand8KeyInitiate (DISPATCH (CommandsOptions::Command8));
+ optionSetRunCommand9KeyInitiate (DISPATCH (CommandsOptions::Command9));
+ optionSetRunCommand10KeyInitiate (DISPATCH (CommandsOptions::Command10));
+ optionSetRunCommand11KeyInitiate (DISPATCH (CommandsOptions::Command11));
+
+ optionSetRunCommand0ButtonInitiate (DISPATCH (CommandsOptions::Command0));
+ optionSetRunCommand1ButtonInitiate (DISPATCH (CommandsOptions::Command1));
+ optionSetRunCommand2ButtonInitiate (DISPATCH (CommandsOptions::Command2));
+ optionSetRunCommand3ButtonInitiate (DISPATCH (CommandsOptions::Command3));
+ optionSetRunCommand4ButtonInitiate (DISPATCH (CommandsOptions::Command4));
+ optionSetRunCommand5ButtonInitiate (DISPATCH (CommandsOptions::Command5));
+ optionSetRunCommand6ButtonInitiate (DISPATCH (CommandsOptions::Command6));
+ optionSetRunCommand7ButtonInitiate (DISPATCH (CommandsOptions::Command7));
+ optionSetRunCommand8ButtonInitiate (DISPATCH (CommandsOptions::Command8));
+ optionSetRunCommand9ButtonInitiate (DISPATCH (CommandsOptions::Command9));
+ optionSetRunCommand10ButtonInitiate (DISPATCH (CommandsOptions::Command10));
+ optionSetRunCommand11ButtonInitiate (DISPATCH (CommandsOptions::Command11));
+
+ optionSetRunCommand0EdgeInitiate (DISPATCH (CommandsOptions::Command0));
+ optionSetRunCommand1EdgeInitiate (DISPATCH (CommandsOptions::Command1));
+ optionSetRunCommand2EdgeInitiate (DISPATCH (CommandsOptions::Command2));
+ optionSetRunCommand3EdgeInitiate (DISPATCH (CommandsOptions::Command3));
+ optionSetRunCommand4EdgeInitiate (DISPATCH (CommandsOptions::Command4));
+ optionSetRunCommand5EdgeInitiate (DISPATCH (CommandsOptions::Command5));
+ optionSetRunCommand6EdgeInitiate (DISPATCH (CommandsOptions::Command6));
+ optionSetRunCommand7EdgeInitiate (DISPATCH (CommandsOptions::Command7));
+ optionSetRunCommand8EdgeInitiate (DISPATCH (CommandsOptions::Command8));
+ optionSetRunCommand9EdgeInitiate (DISPATCH (CommandsOptions::Command9));
+ optionSetRunCommand10EdgeInitiate (DISPATCH (CommandsOptions::Command10));
+ optionSetRunCommand11EdgeInitiate (DISPATCH (CommandsOptions::Command11));
}
bool
@@ -148,9 +100,6 @@ CommandsPluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromOptionInfo (commandsOptionInfo, COMMANDS_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/commands/src/commands.h b/plugins/commands/src/commands.h
index de3bec6..1086856 100644
--- a/plugins/commands/src/commands.h
+++ b/plugins/commands/src/commands.h
@@ -26,72 +26,19 @@
#include <core/core.h>
#include <core/pluginclasshandler.h>
-#define COMMANDS_OPTION_COMMAND0 0
-#define COMMANDS_OPTION_COMMAND1 1
-#define COMMANDS_OPTION_COMMAND2 2
-#define COMMANDS_OPTION_COMMAND3 3
-#define COMMANDS_OPTION_COMMAND4 4
-#define COMMANDS_OPTION_COMMAND5 5
-#define COMMANDS_OPTION_COMMAND6 6
-#define COMMANDS_OPTION_COMMAND7 7
-#define COMMANDS_OPTION_COMMAND8 8
-#define COMMANDS_OPTION_COMMAND9 9
-#define COMMANDS_OPTION_COMMAND10 10
-#define COMMANDS_OPTION_COMMAND11 11
-#define COMMANDS_OPTION_RUN_COMMAND0_KEY 12
-#define COMMANDS_OPTION_RUN_COMMAND1_KEY 13
-#define COMMANDS_OPTION_RUN_COMMAND2_KEY 14
-#define COMMANDS_OPTION_RUN_COMMAND3_KEY 15
-#define COMMANDS_OPTION_RUN_COMMAND4_KEY 16
-#define COMMANDS_OPTION_RUN_COMMAND5_KEY 17
-#define COMMANDS_OPTION_RUN_COMMAND6_KEY 18
-#define COMMANDS_OPTION_RUN_COMMAND7_KEY 19
-#define COMMANDS_OPTION_RUN_COMMAND8_KEY 20
-#define COMMANDS_OPTION_RUN_COMMAND9_KEY 21
-#define COMMANDS_OPTION_RUN_COMMAND10_KEY 22
-#define COMMANDS_OPTION_RUN_COMMAND11_KEY 23
-#define COMMANDS_OPTION_RUN_COMMAND0_BUTTON 24
-#define COMMANDS_OPTION_RUN_COMMAND1_BUTTON 25
-#define COMMANDS_OPTION_RUN_COMMAND2_BUTTON 26
-#define COMMANDS_OPTION_RUN_COMMAND3_BUTTON 27
-#define COMMANDS_OPTION_RUN_COMMAND4_BUTTON 28
-#define COMMANDS_OPTION_RUN_COMMAND5_BUTTON 29
-#define COMMANDS_OPTION_RUN_COMMAND6_BUTTON 30
-#define COMMANDS_OPTION_RUN_COMMAND7_BUTTON 31
-#define COMMANDS_OPTION_RUN_COMMAND8_BUTTON 32
-#define COMMANDS_OPTION_RUN_COMMAND9_BUTTON 33
-#define COMMANDS_OPTION_RUN_COMMAND10_BUTTON 34
-#define COMMANDS_OPTION_RUN_COMMAND11_BUTTON 35
-#define COMMANDS_OPTION_RUN_COMMAND0_EDGE 36
-#define COMMANDS_OPTION_RUN_COMMAND1_EDGE 37
-#define COMMANDS_OPTION_RUN_COMMAND2_EDGE 38
-#define COMMANDS_OPTION_RUN_COMMAND3_EDGE 39
-#define COMMANDS_OPTION_RUN_COMMAND4_EDGE 40
-#define COMMANDS_OPTION_RUN_COMMAND5_EDGE 41
-#define COMMANDS_OPTION_RUN_COMMAND6_EDGE 42
-#define COMMANDS_OPTION_RUN_COMMAND7_EDGE 43
-#define COMMANDS_OPTION_RUN_COMMAND8_EDGE 44
-#define COMMANDS_OPTION_RUN_COMMAND9_EDGE 45
-#define COMMANDS_OPTION_RUN_COMMAND10_EDGE 46
-#define COMMANDS_OPTION_RUN_COMMAND11_EDGE 47
-#define COMMANDS_OPTION_NUM 48
+#include "commands_options.h"
class CommandsScreen :
- public PluginClassHandler<CommandsScreen, CompScreen>
+ public PluginClassHandler<CommandsScreen, CompScreen>,
+ public CommandsOptions
{
public:
CommandsScreen (CompScreen *s);
- CompOption::Vector& getOptions ();
- bool setOption (const char *name, CompOption::Value& value);
-
static bool runCommand (CompAction *action,
CompAction::State state,
CompOption::Vector& options,
int commandOption);
-
- private:
- CompOption::Vector opt;
};
class CommandsPluginVTable :
@@ -99,7 +46,5 @@ class CommandsPluginVTable :
{
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (CommandsScreen);
};
diff --git a/plugins/copytex/src/copytex.cpp b/plugins/copytex/src/copytex.cpp
index e4827bd..f3d4ea1 100644
--- a/plugins/copytex/src/copytex.cpp
+++ b/plugins/copytex/src/copytex.cpp
@@ -25,7 +25,7 @@
#include "copytex.h"
#include <math.h>
-COMPIZ_PLUGIN_20081216 (copytex, CopytexPluginVTable)
+COMPIZ_PLUGIN_20090315 (copytex, CopytexPluginVTable)
static GLTexture::Matrix _identity_matrix = {
1.0f, 0.0f,
@@ -335,8 +335,5 @@ CopytexPluginVTable::init ()
!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
return false;
-
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/decor/decor.xml.in b/plugins/decor/decor.xml.in
index 8c4a36a..fafc61a 100644
--- a/plugins/decor/decor.xml.in
+++ b/plugins/decor/decor.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="decor">
+ <plugin name="decor" useBcop="true">
<_short>Window Decoration</_short>
<_long>Window decorations</_long>
<feature>decorations</feature>
diff --git a/plugins/decor/src/decor.cpp b/plugins/decor/src/decor.cpp
index 01edb00..34d762b 100644
--- a/plugins/decor/src/decor.cpp
+++ b/plugins/decor/src/decor.cpp
@@ -40,7 +40,7 @@
#include <X11/Xatom.h>
#include <X11/extensions/shape.h>
-COMPIZ_PLUGIN_20081216 (decor, DecorPluginVTable)
+COMPIZ_PLUGIN_20090315 (decor, DecorPluginVTable)
bool
DecorWindow::glDraw (const GLMatrix &transform,
@@ -149,7 +149,7 @@ DecorTexture::DecorTexture (Pixmap pixmap) :
return;
}
- if (!DecorScreen::get (screen)->opt[DECOR_OPTION_MIPMAP].value ().b ())
+ if (!DecorScreen::get (screen)->optionGetMipmap ())
textures[0]->setMipmap (false);
damage = XDamageCreate (screen->dpy (), pixmap,
@@ -656,7 +656,6 @@ DecorWindow::update (bool allowDecoration)
{
Decoration *old, *decoration = NULL;
bool decorate = false;
- CompMatch *match;
int moveDx, moveDy;
int oldShiftX = 0;
int oldShiftY = 0;
@@ -680,9 +679,7 @@ DecorWindow::update (bool allowDecoration)
if (decorate)
{
- match =
- &dScreen->opt[DECOR_OPTION_DECOR_MATCH].value ().match ();
- if (!match->evaluate (window))
+ if (!dScreen->optionGetDecorationMatch ().evaluate (window))
decorate = false;
}
@@ -711,8 +708,7 @@ DecorWindow::update (bool allowDecoration)
}
else
{
- match = &dScreen->opt[DECOR_OPTION_SHADOW_MATCH].value ().match ();
- if (match->evaluate (window))
+ if (dScreen->optionGetShadowMatch ().evaluate (window))
{
if (window->region ().numRects () == 1 && !window->alpha ())
decoration = dScreen->decor[DECOR_BARE];
@@ -1472,70 +1468,57 @@ DecorWindow::getOutputExtents (CompWindowExtents& output)
output.bottom = e->bottom;
}
}
-
-CompOption::Vector &
-DecorScreen::getOptions ()
-{
- return opt;
-}
bool
-DecorScreen::setOption (const char *name,
+DecorScreen::setOption (const CompString &name,
CompOption::Value &value)
{
CompOption *o;
unsigned int index;
- o = CompOption::findOption (opt, name, &index);
- if (!o)
+ bool rv = DecorOptions::setOption (name, value);
+
+ if (!rv || !CompOption::findOption (getOptions (), name, &index))
return false;
switch (index) {
- case DECOR_OPTION_COMMAND:
- if (o->set(value))
- {
-
+ case DecorOptions::Command:
if (!dmWin)
- screen->runCommand (o->value ().s ());
- return true;
- }
- break;
- case DECOR_OPTION_SHADOW_MATCH:
- {
- CompString matchString;
-
- /*
- Make sure RGBA matching is always present and disable shadows
- for RGBA windows by default if the user didn't specify an
- RGBA match.
- Reasoning for that is that shadows are desired for some RGBA
- windows (e.g. rectangular windows that just happen to have an
- RGBA colormap), while it's absolutely undesired for others
- (especially shaped ones) ... by enforcing no shadows for RGBA
- windows by default, we are flexible to user desires while still
- making sure we don't show ugliness by default
- */
-
- matchString = value.match ().toString ();
- if (matchString.find ("rgba=") == CompString::npos)
+ screen->runCommand (optionGetCommand ());
+ break;
+ case DecorOptions::ShadowMatch:
{
- CompMatch rgbaMatch("rgba=0");
- value.match () &= rgbaMatch;
+ CompString matchString;
+
+ /*
+ Make sure RGBA matching is always present and disable shadows
+ for RGBA windows by default if the user didn't specify an
+ RGBA match.
+ Reasoning for that is that shadows are desired for some RGBA
+ windows (e.g. rectangular windows that just happen to have an
+ RGBA colormap), while it's absolutely undesired for others
+ (especially shaped ones) ... by enforcing no shadows for RGBA
+ windows by default, we are flexible to user desires while still
+ making sure we don't show ugliness by default
+ */
+
+ matchString = optionGetShadowMatch ().toString ();
+ if (matchString.find ("rgba=") == CompString::npos)
+ {
+ CompMatch rgbaMatch("rgba=0");
+ optionGetShadowMatch () &= rgbaMatch;
+ }
}
- }
- /* fall-through intended */
- case DECOR_OPTION_DECOR_MATCH:
- if (o->set(value))
- {
+ /* fall-through intended */
+ case DecorOptions::DecorationMatch:
foreach (CompWindow *w, screen->windows ())
DecorWindow::get (w)->update (true);
- }
- break;
- default:
- return CompOption::setOption (*o, value);
+ break;
+ default:
+ break;
}
- return false;
+ return rv;
}
void
@@ -1615,39 +1598,19 @@ bool
DecorScreen::decoratorStartTimeout ()
{
if (!dmWin)
- screen->runCommand (opt[DECOR_OPTION_COMMAND].value ().s ());
+ screen->runCommand (optionGetCommand ());
return false;
}
-static const CompMetadata::OptionInfo decorOptionInfo[] = {
- { "shadow_radius", "float", "<min>0.0</min><max>48.0</max>", 0, 0 },
- { "shadow_opacity", "float", "<min>0.0</min>", 0, 0 },
- { "shadow_color", "color", 0, 0, 0 },
- { "shadow_x_offset", "int", "<min>-16</min><max>16</max>", 0, 0 },
- { "shadow_y_offset", "int", "<min>-16</min><max>16</max>", 0, 0 },
- { "command", "string", 0, 0, 0 },
- { "mipmap", "bool", 0, 0, 0 },
- { "decoration_match", "match", 0, 0, 0 },
- { "shadow_match", "match", 0, 0, 0 }
-};
-
DecorScreen::DecorScreen (CompScreen *s) :
PluginClassHandler<DecorScreen,CompScreen> (s),
cScreen (CompositeScreen::get (s)),
textures (),
dmWin (None),
dmSupports (0),
- cmActive (false),
- opt (DECOR_OPTION_NUM)
+ cmActive (false)
{
- if (!decorVTable->getMetadata ()->initOptions (decorOptionInfo,
- DECOR_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
-
supportingDmCheckAtom =
XInternAtom (s->dpy (), DECOR_SUPPORTING_DM_CHECK_ATOM_NAME, 0);
winDecorAtom =
@@ -1756,9 +1719,6 @@ DecorPluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromOptionInfo (decorOptionInfo, DECOR_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/decor/src/decor.h b/plugins/decor/src/decor.h
index 928f3c2..28379f4 100644
--- a/plugins/decor/src/decor.h
+++ b/plugins/decor/src/decor.h
@@ -31,16 +31,7 @@
#include <opengl/opengl.h>
#include <core/atoms.h>
-#define DECOR_OPTION_SHADOW_RADIUS 0
-#define DECOR_OPTION_SHADOW_OPACITY 1
-#define DECOR_OPTION_SHADOW_COLOR 2
-#define DECOR_OPTION_SHADOW_OFFSET_X 3
-#define DECOR_OPTION_SHADOW_OFFSET_Y 4
-#define DECOR_OPTION_COMMAND 5
-#define DECOR_OPTION_MIPMAP 6
-#define DECOR_OPTION_DECOR_MATCH 7
-#define DECOR_OPTION_SHADOW_MATCH 8
-#define DECOR_OPTION_NUM 9
+#include "decor_options.h"
#define DECOR_SCREEN(s) DecorScreen *ds = DecorScreen::get(s)
#define DECOR_WINDOW(w) DecorWindow *dw = DecorWindow::get(w)
@@ -114,14 +105,14 @@ class DecorWindow;
class DecorScreen :
public ScreenInterface,
- public PluginClassHandler<DecorScreen,CompScreen>
+ public PluginClassHandler<DecorScreen,CompScreen>,
+ public DecorOptions
{
public:
DecorScreen (CompScreen *s);
~DecorScreen ();
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
+ bool setOption (const CompString &name, CompOption::Value &value);
void handleEvent (XEvent *event);
void matchPropertyChanged (CompWindow *);
@@ -158,8 +149,6 @@ class DecorScreen :
std::map<Window, DecorWindow *> frames;
- CompOption::Vector opt;
-
CompTimer decoratorStart;
};
@@ -240,7 +229,5 @@ class DecorPluginVTable :
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (DecorScreen);
};
diff --git a/plugins/fade/fade.xml.in b/plugins/fade/fade.xml.in
index 42bb8fd..550b718 100644
--- a/plugins/fade/fade.xml.in
+++ b/plugins/fade/fade.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="fade">
+ <plugin name="fade" useBcop="true">
<_short>Fading Windows</_short>
<_long>Fade in windows when mapped and fade out windows when unmapped</_long>
<deps>
diff --git a/plugins/fade/src/fade.cpp b/plugins/fade/src/fade.cpp
index 4c1824d..1426a75 100644
--- a/plugins/fade/src/fade.cpp
+++ b/plugins/fade/src/fade.cpp
@@ -26,7 +26,7 @@
#include "fade.h"
#include <core/atoms.h>
-COMPIZ_PLUGIN_20081216 (fade, FadePluginVTable);
+COMPIZ_PLUGIN_20090315 (fade, FadePluginVTable);
void
FadeScreen::handleEvent (XEvent *event)
@@ -47,9 +47,9 @@ FadeScreen::handleEvent (XEvent *event)
if (w)
{
- if (opt[FADE_OPTION_VISUAL_BELL].value ().b ())
+ if (optionGetVisualBell ())
{
- if (opt[FADE_OPTION_FULLSCREEN_VISUAL_BELL].value ().b ())
+ if (optionGetFullscreenVisualBell ())
{
foreach (CompWindow *w, screen->windows ())
{
@@ -93,7 +93,7 @@ void
FadeScreen::preparePaint (int msSinceLastPaint)
{
int steps = MAX (12, (msSinceLastPaint * OPAQUE) / fadeTime);
- unsigned int mode = opt[FADE_OPTION_FADE_MODE].value ().i ();
+ unsigned int mode = optionGetFadeMode ();
foreach (CompWindow *w, screen->windows ())
FadeWindow::get (w)->paintStep (mode, msSinceLastPaint, steps);
@@ -147,12 +147,12 @@ FadeWindow::paintStep (unsigned int mode,
int msSinceLastPaint,
int step)
{
- if (mode == FADE_MODE_CONSTANTSPEED)
+ if (mode == FadeOptions::FadeModeConstantSpeed)
{
steps = step;
fadeTime = 0;
}
- else if (mode == FADE_MODE_CONSTANTTIME)
+ else if (mode == FadeOptions::FadeModeConstantTime)
{
if (fadeTime)
{
@@ -198,18 +198,18 @@ FadeWindow::glPaint (const GLWindowPaintAttrib& attrib,
GLWindowPaintAttrib fAttrib (attrib);
int mode;
- mode = fScreen->opt[FADE_OPTION_FADE_MODE].value ().i ();
+ mode = fScreen->optionGetFadeMode ();
if (!window->alive () &&
- fScreen->opt[FADE_OPTION_DIM_UNRESPONSIVE].value ().b ())
+ fScreen->optionGetDimUnresponsive ())
{
GLuint value;
- value = fScreen->opt[FADE_OPTION_UNRESPONSIVE_BRIGHTNESS].value ().i ();
+ value = fScreen->optionGetUnresponsiveBrightness ();
if (value != 100)
fAttrib.brightness = fAttrib.brightness * value / 100;
- value = fScreen->opt[FADE_OPTION_UNRESPONSIVE_SATURATION].value ().i ();
+ value = fScreen->optionGetUnresponsiveSaturation ();
if (value != 100 && GL::canDoSlightlySaturated)
fAttrib.saturation = fAttrib.saturation * value / 100;
}
@@ -219,13 +219,13 @@ FadeWindow::glPaint (const GLWindowPaintAttrib& attrib,
fAttrib.saturation = 0;
}
- if (mode == FADE_MODE_CONSTANTTIME)
+ if (mode == FadeOptions::FadeModeConstantTime)
{
if (fAttrib.opacity != targetOpacity ||
fAttrib.brightness != targetBrightness ||
fAttrib.saturation != targetSaturation)
{
- fadeTime = fScreen->opt[FADE_OPTION_FADE_TIME].value ().i ();
+ fadeTime = fScreen->optionGetFadeTime ();
steps = 1;
opacityDiff = fAttrib.opacity - opacity;
@@ -244,7 +244,7 @@ FadeWindow::glPaint (const GLWindowPaintAttrib& attrib,
GLint newBrightness = BRIGHT;
GLint newSaturation = COLOR;
- if (mode == FADE_MODE_CONSTANTSPEED)
+ if (mode == FadeOptions::FadeModeConstantSpeed)
{
newOpacity = opacity;
if (fAttrib.opacity > opacity)
@@ -268,10 +268,9 @@ FadeWindow::glPaint (const GLWindowPaintAttrib& attrib,
saturation = MAX (saturation - (steps / 6),
fAttrib.saturation);
}
- else if (mode == FADE_MODE_CONSTANTTIME)
+ else if (mode == FadeOptions::FadeModeConstantTime)
{
- int opt = FADE_OPTION_FADE_TIME;
- int totalFadeTime = fScreen->opt[opt].value ().i ();
+ int totalFadeTime = fScreen->optionGetFadeTime ();
if (totalFadeTime == 0)
totalFadeTime = fadeTime;
@@ -312,83 +311,45 @@ FadeWindow::glPaint (const GLWindowPaintAttrib& attrib,
return gWindow->glPaint (fAttrib, transform, region, mask);
}
-static const CompMetadata::OptionInfo fadeOptionInfo[] = {
- { "fade_mode", "int", RESTOSTRING (0, FADE_MODE_MAX), 0, 0 },
- { "fade_speed", "float", "<min>0.1</min>", 0, 0 },
- { "fade_time", "int", "<min>1</min>", 0, 0 },
- { "window_match", "match", "<helper>true</helper>", 0, 0 },
- { "visual_bell", "bool", 0, 0, 0 },
- { "fullscreen_visual_bell", "bool", 0, 0, 0 },
- { "minimize_open_close", "bool", 0, 0, 0 },
- { "dim_unresponsive", "bool", 0, 0, 0 },
- { "unresponsive_brightness", "int", "<min>0</min><max>100</max>", 0, 0 },
- { "unresponsive_saturation", "int", "<min>0</min><max>100</max>", 0, 0 }
-};
-
FadeScreen::FadeScreen (CompScreen *s) :
PluginClassHandler<FadeScreen, CompScreen> (s),
cScreen (CompositeScreen::get (s)),
displayModals (0)
{
- if (!fadeVTable->getMetadata ()->initOptions (fadeOptionInfo,
- FADE_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
-
- fadeTime = 1000.0f / opt[FADE_OPTION_FADE_SPEED].value ().f ();
+ fadeTime = 1000.0f / optionGetFadeSpeed ();
ScreenInterface::setHandler (screen);
CompositeScreenInterface::setHandler (cScreen);
}
-CompOption::Vector&
-FadeScreen::getOptions ()
-{
- return opt;
-}
-
bool
-FadeScreen::setOption (const char *name,
- CompOption::Value& value)
+FadeScreen::setOption (const CompString &name,
+ CompOption::Value &value)
{
CompOption *o;
unsigned int index;
- o = CompOption::findOption (opt, name, &index);
- if (!o)
+ bool rv = FadeOptions::setOption (name, value);
+
+ if (!rv || !CompOption::findOption (getOptions (), name, &index))
return false;
switch (index) {
- case FADE_OPTION_FADE_SPEED:
- if (o->set (value))
- {
- fadeTime = 1000.0f / o->value ().f ();
- return true;
- }
- break;
- case FADE_OPTION_WINDOW_MATCH:
- if (o->set (value))
- {
+ case FadeOptions::FadeSpeed:
+ fadeTime = 1000.0f / optionGetFadeSpeed ();
+ break;
+ case FadeOptions::WindowMatch:
cScreen->damageScreen ();
- return true;
- }
- break;
- case FADE_OPTION_DIM_UNRESPONSIVE:
- if (o->set (value))
- {
+ break;
+ case FadeOptions::DimUnresponsive:
foreach (CompWindow *w, screen->windows ())
- w->windowNotifySetEnabled (FadeWindow::get (w), value.b ());
- return true;
- }
- break;
- default:
- return CompOption::setOption (*o, value);
- break;
+ w->windowNotifySetEnabled (FadeWindow::get (w), optionGetDimUnresponsive ());
+ break;
+ default:
+ break;
}
- return false;
+ return rv;
}
FadeWindow::FadeWindow (CompWindow *w) :
@@ -416,7 +377,7 @@ FadeWindow::FadeWindow (CompWindow *w) :
WindowInterface::setHandler (window, false);
GLWindowInterface::setHandler (gWindow);
- if (fScreen->opt[FADE_OPTION_DIM_UNRESPONSIVE].value ().b ())
+ if (fScreen->optionGetDimUnresponsive ())
window->windowNotifySetEnabled (this, true);
}
@@ -434,9 +395,5 @@ FadePluginVTable::init ()
{
return false;
}
-
- getMetadata ()->addFromOptionInfo (fadeOptionInfo, FADE_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/fade/src/fade.h b/plugins/fade/src/fade.h
index 196531a..0a0c1a9 100644
--- a/plugins/fade/src/fade.h
+++ b/plugins/fade/src/fade.h
@@ -28,31 +28,18 @@
#include <composite/composite.h>
#include <opengl/opengl.h>
-#define FADE_OPTION_FADE_MODE 0
-#define FADE_OPTION_FADE_SPEED 1
-#define FADE_OPTION_FADE_TIME 2
-#define FADE_OPTION_WINDOW_MATCH 3
-#define FADE_OPTION_VISUAL_BELL 4
-#define FADE_OPTION_FULLSCREEN_VISUAL_BELL 5
-#define FADE_OPTION_DIM_UNRESPONSIVE 6
-#define FADE_OPTION_UNRESPONSIVE_BRIGHTNESS 7
-#define FADE_OPTION_UNRESPONSIVE_SATURATION 8
-#define FADE_OPTION_NUM 9
-
-#define FADE_MODE_CONSTANTSPEED 0
-#define FADE_MODE_CONSTANTTIME 1
-#define FADE_MODE_MAX FADE_MODE_CONSTANTTIME
+#include "fade_options.h"
class FadeScreen :
public ScreenInterface,
public CompositeScreenInterface,
- public PluginClassHandler<FadeScreen, CompScreen>
+ public PluginClassHandler<FadeScreen, CompScreen>,
+ public FadeOptions
{
public:
FadeScreen (CompScreen *s);
- CompOption::Vector & getOptions ();
- bool setOption (const char *, CompOption::Value &);
+ bool setOption (const CompString &, CompOption::Value &);
void handleEvent (XEvent *);
void preparePaint (int);
@@ -60,8 +47,6 @@ class FadeScreen :
int displayModals;
int fadeTime;
- CompOption::Vector opt;
-
CompositeScreen *cScreen;
};
@@ -114,6 +99,4 @@ class FadePluginVTable :
{
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (FadeScreen);
};
diff --git a/plugins/gnomecompat/gnomecompat.xml.in b/plugins/gnomecompat/gnomecompat.xml.in
index 122bf83..c67021c 100644
--- a/plugins/gnomecompat/gnomecompat.xml.in
+++ b/plugins/gnomecompat/gnomecompat.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="gnomecompat">
+ <plugin name="gnomecompat" useBcop="true">
<_short>Gnome Compatibility</_short>
<_long>Options that keep Compiz compatible to the Gnome desktop environment</_long>
<category>General</category>
diff --git a/plugins/gnomecompat/src/gnomecompat.cpp b/plugins/gnomecompat/src/gnomecompat.cpp
index 9912a81..b8b35d5 100644
--- a/plugins/gnomecompat/src/gnomecompat.cpp
+++ b/plugins/gnomecompat/src/gnomecompat.cpp
@@ -25,13 +25,13 @@
#include "gnomecompat.h"
-COMPIZ_PLUGIN_20081216 (gnomecompat, GnomeCompatPluginVTable);
+COMPIZ_PLUGIN_20090315 (gnomecompat, GnomeCompatPluginVTable);
static bool
runCommand (CompAction *action,
CompAction::State state,
CompOption::Vector& options,
- unsigned int commandOption)
+ CompOption *commandOption)
{
Window xid;
@@ -41,7 +41,7 @@ runCommand (CompAction *action,
if (xid != screen->root ())
return false;
- screen->runCommand (gs->opt[commandOption].value ().s ());
+ screen->runCommand (commandOption->value ().s ());
return true;
}
@@ -102,59 +102,25 @@ showRunDialog (CompAction *action,
return true;
}
-#define COMMAND_BIND(opt) \
- boost::bind (runCommand, _1, _2, _3, opt)
-
-static const CompMetadata::OptionInfo gnomeOptionInfo[] = {
- { "main_menu_key", "key", 0, showMainMenu, 0 },
- { "run_key", "key", 0, showRunDialog, 0 },
- { "command_screenshot", "string", 0, 0, 0 },
- { "run_command_screenshot_key", "key", 0,
- COMMAND_BIND (GNOME_OPTION_SCREENSHOT_CMD), 0 },
- { "command_window_screenshot", "string", 0, 0, 0 },
- { "run_command_window_screenshot_key", "key", 0,
- COMMAND_BIND (GNOME_OPTION_WINDOW_SCREENSHOT_CMD), 0 },
- { "command_terminal", "string", 0, 0, 0 },
- { "run_command_terminal_key", "key", 0,
- COMMAND_BIND (GNOME_OPTION_TERMINAL_CMD), 0 }
-};
-
GnomeCompatScreen::GnomeCompatScreen (CompScreen *s) :
PluginClassHandler<GnomeCompatScreen, CompScreen> (s)
{
- if (!gnomecompatVTable->getMetadata ()->initOptions (gnomeOptionInfo,
- GNOME_OPTION_NUM,
- opt))
- {
- setFailed ();
- return;
- }
-
panelActionAtom =
XInternAtom (screen->dpy (), "_GNOME_PANEL_ACTION", FALSE);
panelMainMenuAtom =
XInternAtom (screen->dpy (), "_GNOME_PANEL_ACTION_MAIN_MENU", FALSE);
panelRunDialogAtom =
XInternAtom (screen->dpy (), "_GNOME_PANEL_ACTION_RUN_DIALOG", FALSE);
-}
-CompOption::Vector&
-GnomeCompatScreen::getOptions ()
-{
- return opt;
-}
-
-bool
-GnomeCompatScreen::setOption (const char *name,
- CompOption::Value& value)
-{
- CompOption *o;
+#define COMMAND_BIND(opt) \
+ boost::bind (runCommand, _1, _2, _3, &mOptions[opt])
- o = CompOption::findOption (opt, name, NULL);
- if (!o)
- return false;
+ optionSetMainMenuKeyInitiate (showMainMenu);
+ optionSetRunKeyInitiate (showRunDialog);
+ optionSetRunCommandScreenshotKeyInitiate (COMMAND_BIND (GnomecompatOptions::CommandScreenshot));
+ optionSetRunCommandWindowScreenshotKeyInitiate (COMMAND_BIND (GnomecompatOptions::CommandWindowScreenshot));
+ optionSetRunCommandTerminalKeyInitiate (COMMAND_BIND (GnomecompatOptions::CommandTerminal));
- return CompOption::setOption (*o, value);
}
bool
@@ -163,8 +129,5 @@ GnomeCompatPluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromOptionInfo (gnomeOptionInfo, GNOME_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/gnomecompat/src/gnomecompat.h b/plugins/gnomecompat/src/gnomecompat.h
index 156a8f9..f7fc765 100644
--- a/plugins/gnomecompat/src/gnomecompat.h
+++ b/plugins/gnomecompat/src/gnomecompat.h
@@ -26,32 +26,20 @@
#include <core/core.h>
#include <core/pluginclasshandler.h>
-#define GNOME_OPTION_MAIN_MENU_KEY 0
-#define GNOME_OPTION_RUN_DIALOG_KEY 1
-#define GNOME_OPTION_SCREENSHOT_CMD 2
-#define GNOME_OPTION_RUN_SCREENSHOT_KEY 3
-#define GNOME_OPTION_WINDOW_SCREENSHOT_CMD 4
-#define GNOME_OPTION_RUN_WINDOW_SCREENSHOT_KEY 5
-#define GNOME_OPTION_TERMINAL_CMD 6
-#define GNOME_OPTION_RUN_TERMINAL_KEY 7
-#define GNOME_OPTION_NUM 8
+#include "gnomecompat_options.h"
class GnomeCompatScreen :
- public PluginClassHandler<GnomeCompatScreen, CompScreen>
+ public PluginClassHandler<GnomeCompatScreen, CompScreen>,
+ public GnomecompatOptions
{
public:
GnomeCompatScreen (CompScreen *s);
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value& value);
-
void panelAction (CompOption::Vector& options, Atom action);
Atom panelActionAtom;
Atom panelMainMenuAtom;
Atom panelRunDialogAtom;
-
- CompOption::Vector opt;
};
#define GNOME_SCREEN(s) \
@@ -62,6 +50,4 @@ class GnomeCompatPluginVTable :
{
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (GnomeCompatScreen);
};
diff --git a/plugins/imgpng/src/imgpng.cpp b/plugins/imgpng/src/imgpng.cpp
index d0dc8af..b7826e5 100644
--- a/plugins/imgpng/src/imgpng.cpp
+++ b/plugins/imgpng/src/imgpng.cpp
@@ -25,7 +25,7 @@
#include "imgpng.h"
-COMPIZ_PLUGIN_20081216 (imgpng, PngPluginVTable)
+COMPIZ_PLUGIN_20090315 (imgpng, PngPluginVTable)
PngScreen::PngScreen (CompScreen *screen) :
PluginClassHandler<PngScreen, CompScreen> (screen)
@@ -353,9 +353,6 @@ PngPluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
-
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/ini/src/ini.cpp b/plugins/ini/src/ini.cpp
index 4d7f010..0c8c3e0 100644
--- a/plugins/ini/src/ini.cpp
+++ b/plugins/ini/src/ini.cpp
@@ -30,7 +30,7 @@
#include <errno.h>
#include <boost/lexical_cast.hpp>
-COMPIZ_PLUGIN_20081216 (ini, IniPluginVTable)
+COMPIZ_PLUGIN_20090315 (ini, IniPluginVTable)
IniFile::IniFile (CompPlugin *p) :
plugin (p)
@@ -598,8 +598,6 @@ IniPluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/inotify/src/inotify.cpp b/plugins/inotify/src/inotify.cpp
index 16a9ee7..f452a3f 100644
--- a/plugins/inotify/src/inotify.cpp
+++ b/plugins/inotify/src/inotify.cpp
@@ -25,7 +25,7 @@
#include "inotify.h"
-COMPIZ_PLUGIN_20081216 (inotify, InotifyPluginVTable)
+COMPIZ_PLUGIN_20090315 (inotify, InotifyPluginVTable)
InotifyScreen::InotifyScreen (CompScreen *screen) :
PluginClassHandler<InotifyScreen, CompScreen> (screen)
@@ -164,8 +164,6 @@ InotifyPluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/move/move.xml.in b/plugins/move/move.xml.in
index e3a6eb7..2153366 100644
--- a/plugins/move/move.xml.in
+++ b/plugins/move/move.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="move">
+ <plugin name="move" useBcop="true">
<_short>Move Window</_short>
<_long>Move window</_long>
<deps>
diff --git a/plugins/move/src/move.cpp b/plugins/move/src/move.cpp
index d41946e..87cd059 100644
--- a/plugins/move/src/move.cpp
+++ b/plugins/move/src/move.cpp
@@ -32,7 +32,7 @@
#include <core/atoms.h>
#include "move.h"
-COMPIZ_PLUGIN_20081216 (move, MovePluginVTable)
+COMPIZ_PLUGIN_20090315 (move, MovePluginVTable)
static bool
moveInitiate (CompAction *action,
@@ -321,7 +321,7 @@ moveHandleMotionEvent (CompScreen *s,
workArea = s->getWorkareaForOutput (w->outputDevice ());
- if (ms->opt[MOVE_OPTION_CONSTRAIN_Y].value ().b ())
+ if (ms->optionGetConstrainY ())
{
if (!ms->region)
ms->region = moveGetYConstrainRegion (s);
@@ -377,7 +377,7 @@ moveHandleMotionEvent (CompScreen *s,
}
}
- if (ms->opt[MOVE_OPTION_SNAPOFF_MAXIMIZED].value ().b ())
+ if (ms->optionGetSnapoffMaximized ())
{
if (w->state () & CompWindowStateMaximizedVertMask)
{
@@ -466,7 +466,7 @@ moveHandleMotionEvent (CompScreen *s,
w->move (wX + dx - w->geometry ().x (),
wY + dy - w->geometry ().y (), false);
- if (ms->opt[MOVE_OPTION_LAZY_POSITIONING].value ().b () &&
+ if (ms->optionGetLazyPositioning () &&
MoveScreen::get (screen)->hasCompositing)
{
/* FIXME: This form of lazy positioning is broken and should
@@ -499,10 +499,8 @@ MoveScreen::handleEvent (XEvent *event)
if (releaseButton == -1 ||
releaseButton == (int) event->xbutton.button)
{
- CompAction *action;
-
- action = &opt[MOVE_OPTION_INITIATE_BUTTON].value ().action ();
- moveTerminate (action, CompAction::StateTermButton,
+ moveTerminate (&optionGetInitiateButton (),
+ CompAction::StateTermButton,
noOptions);
}
}
@@ -554,16 +552,13 @@ MoveScreen::handleEvent (XEvent *event)
{
CompOption::Vector o;
int xRoot, yRoot;
- int option;
o.push_back (CompOption ("window", CompOption::TypeInt));
o[0].value ().set ((int) event->xclient.window);
if (event->xclient.data.l[2] == WmMoveResizeMoveKeyboard)
{
- option = MOVE_OPTION_INITIATE_KEY;
-
- moveInitiate (&opt[option].value ().action (),
+ moveInitiate (&optionGetInitiateKey (),
CompAction::StateInitKey, o);
}
else
@@ -572,8 +567,6 @@ MoveScreen::handleEvent (XEvent *event)
Window root, child;
int i;
- option = MOVE_OPTION_INITIATE_BUTTON;
-
XQueryPointer (screen->dpy (), screen->root (),
&root, &child, &xRoot, &yRoot,
&i, &i, &mods);
@@ -594,7 +587,7 @@ MoveScreen::handleEvent (XEvent *event)
o[4].value ().set ((int) (event->xclient.data.l[3] ?
event->xclient.data.l[3] : -1));
- moveInitiate (&opt[option].value ().action (),
+ moveInitiate (&optionGetInitiateButton (),
CompAction::StateInitButton, o);
moveHandleMotionEvent (screen, xRoot, yRoot);
@@ -606,13 +599,9 @@ MoveScreen::handleEvent (XEvent *event)
{
if (ms->w->id () == event->xclient.window)
{
- int option;
-
- option = MOVE_OPTION_INITIATE_BUTTON;
- moveTerminate (&opt[option].value ().action (),
+ moveTerminate (&optionGetInitiateButton (),
CompAction::StateCancel, noOptions);
- option = MOVE_OPTION_INITIATE_KEY;
- moveTerminate (&opt[option].value ().action (),
+ moveTerminate (&optionGetInitiateKey (),
CompAction::StateCancel, noOptions);
}
@@ -622,27 +611,15 @@ MoveScreen::handleEvent (XEvent *event)
case DestroyNotify:
if (w && w->id () == event->xdestroywindow.window)
{
- int option;
-
- option = MOVE_OPTION_INITIATE_BUTTON;
- moveTerminate (&opt[option].value ().action (),
- 0, noOptions);
- option = MOVE_OPTION_INITIATE_KEY;
- moveTerminate (&opt[option].value ().action (),
- 0, noOptions);
+ moveTerminate (&optionGetInitiateButton (), 0, noOptions);
+ moveTerminate (&optionGetInitiateKey (), 0, noOptions);
}
break;
case UnmapNotify:
if (w && w->id () == event->xunmap.window)
{
- int option;
-
- option = MOVE_OPTION_INITIATE_BUTTON;
- moveTerminate (&opt[option].value ().action (),
- 0, noOptions);
- option = MOVE_OPTION_INITIATE_KEY;
- moveTerminate (&opt[option].value ().action (),
- 0, noOptions);
+ moveTerminate (&optionGetInitiateButton (), 0, noOptions);
+ moveTerminate (&optionGetInitiateKey (), 0, noOptions);
}
default:
break;
@@ -676,47 +653,12 @@ MoveWindow::glPaint (const GLWindowPaintAttrib &attrib,
return status;
}
-CompOption::Vector &
-MoveScreen::getOptions ()
-{
- return opt;
-}
-
-bool
-MoveScreen::setOption (const char *name,
- CompOption::Value &value)
+void
+MoveScreen::updateOpacity ()
{
- CompOption *o;
- unsigned int index;
-
- o = CompOption::findOption (opt, name, &index);
- if (!o)
- return false;
-
- switch (index) {
- case MOVE_OPTION_OPACITY:
- if (o->set (value))
- {
- moveOpacity = (o->value ().i () * OPAQUE) / 100;
- return true;
- }
- break;
- default:
- return CompOption::setOption (*o, value);
- }
-
- return false;
+ moveOpacity = (optionGetOpacity () * OPAQUE) / 100;
}
-static const CompMetadata::OptionInfo moveOptionInfo[] = {
- { "initiate_button", "button", 0, moveInitiate, moveTerminate },
- { "initiate_key", "key", 0, moveInitiate, moveTerminate },
- { "opacity", "int", "<min>0</min><max>100</max>", 0, 0 },
- { "constrain_y", "bool", 0, 0, 0 },
- { "snapoff_maximized", "bool", 0, 0, 0 },
- { "lazy_positioning", "bool", 0, 0, 0 }
-};
-
MoveScreen::MoveScreen (CompScreen *screen) :
PluginClassHandler<MoveScreen,CompScreen> (screen),
w (0),
@@ -724,17 +666,10 @@ MoveScreen::MoveScreen (CompScreen *screen) :
status (RectangleOut),
releaseButton (0),
grab(NULL),
- hasCompositing (false),
- opt(MOVE_OPTION_NUM)
+ hasCompositing (false)
{
- if (!moveVTable->getMetadata ()->initOptions (moveOptionInfo,
- MOVE_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
-
- moveOpacity = (opt[MOVE_OPTION_OPACITY].value ().i () * OPAQUE) / 100;
+
+ updateOpacity ();
for (unsigned int i = 0; i < NUM_KEYS; i++)
key[i] = XKeysymToKeycode (screen->dpy (),
@@ -745,6 +680,14 @@ MoveScreen::MoveScreen (CompScreen *screen) :
hasCompositing =
CompositeScreen::get (screen)->compositingActive ();
+ optionSetOpacityNotify (boost::bind (&MoveScreen::updateOpacity, this));
+
+ optionSetInitiateButtonInitiate (moveInitiate);
+ optionSetInitiateButtonTerminate (moveTerminate);
+
+ optionSetInitiateKeyInitiate (moveInitiate);
+ optionSetInitiateKeyTerminate (moveTerminate);
+
ScreenInterface::setHandler (screen);
}
@@ -760,9 +703,6 @@ MovePluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromOptionInfo (moveOptionInfo, MOVE_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/move/src/move.h b/plugins/move/src/move.h
index 19e518d..8e49e5f 100644
--- a/plugins/move/src/move.h
+++ b/plugins/move/src/move.h
@@ -29,6 +29,8 @@
#include <composite/composite.h>
#include <opengl/opengl.h>
+#include "move_options.h"
+
#define NUM_KEYS (sizeof (mKeys) / sizeof (mKeys[0]))
#define KEY_MOVE_INC 24
@@ -36,14 +38,6 @@
#define SNAP_BACK 20
#define SNAP_OFF 100
-#define MOVE_OPTION_INITIATE_BUTTON 0
-#define MOVE_OPTION_INITIATE_KEY 1
-#define MOVE_OPTION_OPACITY 2
-#define MOVE_OPTION_CONSTRAIN_Y 3
-#define MOVE_OPTION_SNAPOFF_MAXIMIZED 4
-#define MOVE_OPTION_LAZY_POSITIONING 5
-#define MOVE_OPTION_NUM 6
-
struct _MoveKeys {
const char *name;
int dx;
@@ -57,15 +51,15 @@ struct _MoveKeys {
class MoveScreen :
public ScreenInterface,
- public PluginClassHandler<MoveScreen,CompScreen>
+ public PluginClassHandler<MoveScreen,CompScreen>,
+ public MoveOptions
{
public:
MoveScreen (CompScreen *screen);
~MoveScreen ();
-
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
+
+ void updateOpacity ();
void handleEvent (XEvent *);
@@ -92,8 +86,6 @@ class MoveScreen :
int snapBackY;
bool hasCompositing;
-
- CompOption::Vector opt;
};
class MoveWindow :
@@ -132,8 +124,5 @@ class MovePluginVTable :
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (MoveScreen);
-
};
diff --git a/plugins/place/place.xml.in b/plugins/place/place.xml.in
index addd9c6..b97d084 100644
--- a/plugins/place/place.xml.in
+++ b/plugins/place/place.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="place">
+ <plugin name="place" useBcop="true">
<_short>Place Windows</_short>
<_long>Place windows at appropriate positions when mapped</_long>
<options>
diff --git a/plugins/place/src/place.cpp b/plugins/place/src/place.cpp
index 52558e3..c0772d2 100644
--- a/plugins/place/src/place.cpp
+++ b/plugins/place/src/place.cpp
@@ -22,35 +22,13 @@
#include "place.h"
-COMPIZ_PLUGIN_20081216 (place, PlacePluginVTable)
-
-static const CompMetadata::OptionInfo placeOptionInfo[] = {
- { "workarounds", "bool", 0, 0, 0 },
- { "mode", "int", RESTOSTRING (0, PLACE_MODE_LAST), 0, 0 },
- { "multioutput_mode", "int", RESTOSTRING (0, PLACE_MOMODE_LAST), 0, 0 },
- { "force_placement_match", "match", 0, 0, 0 },
- { "position_matches", "list", "<type>match</type>", 0, 0 },
- { "position_x_values", "list", "<type>int</type>", 0, 0 },
- { "position_y_values", "list", "<type>int</type>", 0, 0 },
- { "position_constrain_workarea", "list", "<type>bool</type>", 0, 0 },
- { "viewport_matches", "list", "<type>match</type>", 0, 0 },
- { "viewport_x_values", "list",
- "<type>int</type><min>1</min><max>32</max>", 0, 0 },
- { "viewport_y_values", "list",
- "<type>int</type><min>1</min><max>32</max>", 0, 0 },
-};
+COMPIZ_PLUGIN_20090315 (place, PlacePluginVTable)
PlaceScreen::PlaceScreen (CompScreen *screen) :
- PluginClassHandler<PlaceScreen, CompScreen> (screen),
- opt (PLACE_OPTION_NUM)
+ PluginClassHandler<PlaceScreen, CompScreen> (screen)
{
- if (!placeVTable->getMetadata ()->initOptions (placeOptionInfo,
- PLACE_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
-
+ optionSetPositionMatchesNotify (boost::bind (&PlaceScreen::updateMatches, this, PlaceOptions::PositionMatches));
+ optionSetViewportMatchesNotify (boost::bind (&PlaceScreen::updateMatches, this, PlaceOptions::ViewportMatches));
ScreenInterface::setHandler (screen);
}
@@ -140,34 +118,11 @@ PlaceScreen::handleEvent (XEvent *event)
screen->handleEvent (event);
}
-CompOption::Vector &
-PlaceScreen::getOptions ()
+void
+PlaceScreen::updateMatches (unsigned int opt)
{
- return opt;
-}
-
-bool
-PlaceScreen::setOption (const char *name,
- CompOption::Value &value)
-{
- CompOption *o;
- unsigned int index;
-
- o = CompOption::findOption (opt, name, &index);
- if (!o)
- return false;
-
- if (!CompOption::setOption (*o, value))
- return false;
-
- if (index == PLACE_OPTION_POSITION_MATCHES ||
- index == PLACE_OPTION_VIEWPORT_MATCHES)
- {
- foreach (CompOption::Value &ov, o->value ().list ())
- ov.match ().update ();
- }
-
- return true;
+ foreach (CompOption::Value &ov, mOptions[opt].value ().list ())
+ ov.match ().update ();
}
/* sort functions */
@@ -293,7 +248,7 @@ PlaceWindow::validateResizeRequest (unsigned int &mask,
workarounds are disabled, reason see above */
PLACE_SCREEN (screen);
- if (ps->opt[PLACE_OPTION_WORKAROUND].value ().b () ||
+ if (ps->optionGetWorkarounds () ||
(window->type () & CompWindowTypeNormalMask))
{
/* try to keep the window position intact for USPosition -
@@ -490,20 +445,20 @@ PlaceWindow::doPlacement (CompPoint &pos)
if (strategy == PlaceOnly || strategy == PlaceAndConstrain)
{
- switch (ps->opt[PLACE_OPTION_MODE].value ().i ()) {
- case PLACE_MODE_CASCADE:
+ switch (ps->optionGetMode ()) {
+ case PlaceOptions::ModeCascade:
placeCascade (workArea, pos);
break;
- case PLACE_MODE_CENTERED:
+ case PlaceOptions::ModeCentered:
placeCentered (workArea, pos);
break;
- case PLACE_MODE_RANDOM:
+ case PlaceOptions::ModeRandom:
placeRandom (workArea, pos);
break;
- case PLACE_MODE_MAXIMIZE:
+ case PlaceOptions::ModeMaximize:
sendMaximizationRequest ();
break;
- case PLACE_MODE_SMART:
+ case PlaceOptions::ModeSmart:
placeSmart (workArea, pos);
break;
}
@@ -1055,8 +1010,6 @@ PlaceWindow::cascadeFindNext (const CompWindowList &windows,
PlaceWindow::PlacementStrategy
PlaceWindow::getStrategy ()
{
- int opt;
-
PLACE_SCREEN (screen);
if (window->type () & (CompWindowTypeDockMask |
@@ -1082,11 +1035,10 @@ PlaceWindow::getStrategy ()
if (!(window->actions () & CompWindowActionMoveMask))
return NoPlacement;
- opt = PLACE_OPTION_FORCE_PLACEMENT;
- if (!ps->opt[opt].value ().match ().evaluate (window))
+ if (!ps->optionGetForcePlacementMatch ().evaluate (window))
{
if ((window->type () & CompWindowTypeNormalMask) ||
- ps->opt[PLACE_OPTION_WORKAROUND].value ().b ())
+ ps->optionGetWorkarounds ())
{
/* Only accept USPosition on non-normal windows if workarounds are
* enabled because apps claiming the user set -geometry for a
@@ -1153,42 +1105,42 @@ PlaceWindow::getPlacementOutput (PlacementStrategy strategy,
if (output >= 0)
return screen->outputDevs ()[output];
- switch (ps->opt[PLACE_OPTION_MULTIOUTPUT_MODE].value ().i ()) {
- case PLACE_MOMODE_CURRENT:
- return screen->currentOutputDev ();
- break;
- case PLACE_MOMODE_POINTER:
- {
- Window wDummy;
- int iDummy, xPointer, yPointer;
- unsigned int uiDummy;
-
- /* this means a server roundtrip, which kind of sucks; thus
- this code should be replaced as soon as we have software
- cursor rendering and thus have a cached pointer coordinate */
- if (XQueryPointer (screen->dpy (), screen->root (),
- &wDummy, &wDummy, &xPointer, &yPointer,
- &iDummy, &iDummy, &uiDummy))
+ switch (ps->optionGetMultioutputMode ()) {
+ case PlaceOptions::MultioutputModeUseActiveOutputDevice:
+ return screen->currentOutputDev ();
+ break;
+ case PlaceOptions::MultioutputModeUseOutputDeviceWithPointer:
{
- output = screen->outputDeviceForPoint (xPointer, yPointer);
+ Window wDummy;
+ int iDummy, xPointer, yPointer;
+ unsigned int uiDummy;
+
+ /* this means a server roundtrip, which kind of sucks; thus
+ this code should be replaced as soon as we have software
+ cursor rendering and thus have a cached pointer coordinate */
+ if (XQueryPointer (screen->dpy (), screen->root (),
+ &wDummy, &wDummy, &xPointer, &yPointer,
+ &iDummy, &iDummy, &uiDummy))
+ {
+ output = screen->outputDeviceForPoint (xPointer, yPointer);
+ }
}
- }
- break;
- case PLACE_MOMODE_ACTIVEWIN:
- {
- CompWindow *active;
+ break;
+ case PlaceOptions::MultioutputModeUseOutputDeviceOfFocussedWindow:
+ {
+ CompWindow *active;
- active = screen->findWindow (screen->activeWindow ());
- if (active)
- output = active->outputDevice ();
- }
- break;
- case PLACE_MOMODE_FULLSCREEN:
- /* only place on fullscreen output if not placing centered, as the
- constraining will move the window away from the center otherwise */
- if (strategy != PlaceCenteredOnScreen)
- return screen->fullscreenOutput ();
- break;
+ active = screen->findWindow (screen->activeWindow ());
+ if (active)
+ output = active->outputDevice ();
+ }
+ break;
+ case PlaceOptions::MultioutputModePlaceAcrossAllOutputs:
+ /* only place on fullscreen output if not placing centered, as the
+ constraining will move the window away from the center otherwise */
+ if (strategy != PlaceCenteredOnScreen)
+ return screen->fullscreenOutput ();
+ break;
}
if (output < 0)
@@ -1312,11 +1264,11 @@ PlaceWindow::matchPosition (CompPoint &pos,
PLACE_SCREEN (screen);
return matchXYValue (
- ps->opt[PLACE_OPTION_POSITION_MATCHES].value ().list (),
- ps->opt[PLACE_OPTION_POSITION_X_VALUES].value ().list (),
- ps->opt[PLACE_OPTION_POSITION_Y_VALUES].value ().list (),
+ ps->optionGetPositionMatches (),
+ ps->optionGetPositionXValues (),
+ ps->optionGetPositionYValues (),
pos,
- &ps->opt[PLACE_OPTION_POSITION_CONSTRAIN].value ().list (),
+ &ps->optionGetPositionConstrainWorkarea (),
&keepInWorkarea);
}
@@ -1325,9 +1277,9 @@ PlaceWindow::matchViewport (CompPoint &pos)
{
PLACE_SCREEN (screen);
- if (matchXYValue (ps->opt[PLACE_OPTION_VIEWPORT_MATCHES].value ().list (),
- ps->opt[PLACE_OPTION_VIEWPORT_X_VALUES].value ().list (),
- ps->opt[PLACE_OPTION_VIEWPORT_Y_VALUES].value ().list (),
+ if (matchXYValue (ps->optionGetViewportMatches (),
+ ps->optionGetViewportXValues (),
+ ps->optionGetViewportYValues (),
pos))
{
/* Viewport matches are given 1-based, so we need to adjust that */
@@ -1346,9 +1298,6 @@ PlacePluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromOptionInfo (placeOptionInfo, PLACE_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/place/src/place.h b/plugins/place/src/place.h
index cabc865..3106796 100644
--- a/plugins/place/src/place.h
+++ b/plugins/place/src/place.h
@@ -28,49 +28,23 @@
#include <core/atoms.h>
#include <core/pluginclasshandler.h>
-#define PLACE_MODE_CASCADE 0
-#define PLACE_MODE_CENTERED 1
-#define PLACE_MODE_SMART 2
-#define PLACE_MODE_MAXIMIZE 3
-#define PLACE_MODE_RANDOM 4
-#define PLACE_MODE_LAST PLACE_MODE_RANDOM
-
-#define PLACE_MOMODE_CURRENT 0
-#define PLACE_MOMODE_POINTER 1
-#define PLACE_MOMODE_ACTIVEWIN 2
-#define PLACE_MOMODE_FULLSCREEN 3
-#define PLACE_MOMODE_LAST PLACE_MOMODE_FULLSCREEN
-
-#define PLACE_OPTION_WORKAROUND 0
-#define PLACE_OPTION_MODE 1
-#define PLACE_OPTION_MULTIOUTPUT_MODE 2
-#define PLACE_OPTION_FORCE_PLACEMENT 3
-#define PLACE_OPTION_POSITION_MATCHES 4
-#define PLACE_OPTION_POSITION_X_VALUES 5
-#define PLACE_OPTION_POSITION_Y_VALUES 6
-#define PLACE_OPTION_POSITION_CONSTRAIN 7
-#define PLACE_OPTION_VIEWPORT_MATCHES 8
-#define PLACE_OPTION_VIEWPORT_X_VALUES 9
-#define PLACE_OPTION_VIEWPORT_Y_VALUES 10
-#define PLACE_OPTION_NUM 11
+#include "place_options.h"
#define PLACE_SCREEN(s) PlaceScreen *ps = PlaceScreen::get (s)
class PlaceScreen :
public PluginClassHandler<PlaceScreen, CompScreen>,
- public ScreenInterface
+ public ScreenInterface,
+ public PlaceOptions
{
public:
PlaceScreen (CompScreen *screen);
~PlaceScreen ();
+ void updateMatches (unsigned int opt);
+
void handleEvent (XEvent *event);
void handleScreenSizeChange (int width, int height);
-
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
-
- CompOption::Vector opt;
};
class PlaceWindow :
@@ -134,8 +108,6 @@ class PlacePluginVTable :
{
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (PlaceScreen);
};
typedef enum {
diff --git a/plugins/regex/src/regex.cpp b/plugins/regex/src/regex.cpp
index 4ecb5dd..f906ce3 100644
--- a/plugins/regex/src/regex.cpp
+++ b/plugins/regex/src/regex.cpp
@@ -26,7 +26,7 @@
#include "regexplugin.h"
#include <limits.h>
-COMPIZ_PLUGIN_20081216 (regex, RegexPluginVTable);
+COMPIZ_PLUGIN_20090315 (regex, RegexPluginVTable);
class RegexExp : public CompMatch::Expression
{
@@ -306,7 +306,5 @@ RegexPluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/resize/resize.xml.in b/plugins/resize/resize.xml.in
index e2569b4..ceb19a1 100644
--- a/plugins/resize/resize.xml.in
+++ b/plugins/resize/resize.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="resize">
+ <plugin name="resize" useBcop="true">
<_short>Resize Window</_short>
<_long>Resize window</_long>
<deps>
diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp
index 1bb406c..25a9837 100644
--- a/plugins/resize/src/resize.cpp
+++ b/plugins/resize/src/resize.cpp
@@ -35,7 +35,7 @@
#include <core/atoms.h>
#include "resize.h"
-COMPIZ_PLUGIN_20081216 (resize, ResizePluginVTable)
+COMPIZ_PLUGIN_20090315 (resize, ResizePluginVTable)
void
ResizeScreen::getPaintRectangle (BoxPtr pBox)
@@ -283,28 +283,28 @@ resizeInitiate (CompAction *action,
/* if the window is fully maximized, showing the outline or
rectangle would be visually distracting as the window can't
be resized anyway; so we better don't use them in this case */
- rs->mode = RESIZE_MODE_NORMAL;
+ rs->mode = ResizeOptions::ModeNormal;
}
else
{
- rs->mode = rs->opt[RESIZE_OPTION_MODE].value ().i ();
- for (i = 0; i <= RESIZE_MODE_LAST; i++)
+ rs->mode = rs->optionGetMode ();
+ for (i = 0; i <= ResizeOptions::ModeStretch; i++)
{
- if (action == &rs->opt[i].value ().action ())
+ if (action == &rs->getOptions ()[i].value ().action ())
{
rs->mode = i;
break;
}
}
- if (i > RESIZE_MODE_LAST)
+ if (i > ResizeOptions::ModeStretch)
{
int index;
- for (i = 0; i <= RESIZE_MODE_LAST; i++)
+ for (i = 0; i <= ResizeOptions::ModeStretch; i++)
{
- index = RESIZE_OPTION_NORMAL_MATCH + i;
- if (rs->opt[index].value ().match ().evaluate (w))
+ index = ResizeOptions::NormalMatch + i;
+ if (rs->getOptions ()[index].value ().match ().evaluate (w))
{
rs->mode = i;
break;
@@ -314,15 +314,15 @@ resizeInitiate (CompAction *action,
if (!rs->gScreen || !rs->cScreen ||
rs->cScreen->compositingActive ())
- rs->mode = RESIZE_MODE_NORMAL;
+ rs->mode = ResizeOptions::ModeNormal;
}
- if (rs->mode != RESIZE_MODE_NORMAL)
+ if (rs->mode != ResizeOptions::ModeNormal)
{
RESIZE_WINDOW (w);
- if (rw->gWindow && rs->mode == RESIZE_MODE_STRETCH)
+ if (rw->gWindow && rs->mode == ResizeOptions::ModeStretch)
rw->gWindow->glPaintSetEnabled (rw, true);
- if (rw->cWindow && rs->mode == RESIZE_MODE_STRETCH)
+ if (rw->cWindow && rs->mode == ResizeOptions::ModeStretch)
rw->cWindow->damageRectSetEnabled (rw, true);
rs->gScreen->glPaintOutputSetEnabled (rs, true);
}
@@ -385,7 +385,7 @@ resizeTerminate (CompAction *action,
XWindowChanges xwc;
unsigned int mask = 0;
- if (rs->mode == RESIZE_MODE_NORMAL)
+ if (rs->mode == ResizeOptions::ModeNormal)
{
if (state & CompAction::StateCancel)
{
@@ -410,7 +410,7 @@ resizeTerminate (CompAction *action,
{
BoxRec box;
- if (rs->mode == RESIZE_MODE_STRETCH)
+ if (rs->mode == ResizeOptions::ModeStretch)
rs->getStretchRectangle (&box);
else
rs->getPaintRectangle (&box);
@@ -427,12 +427,12 @@ resizeTerminate (CompAction *action,
mask = CWX | CWY | CWWidth | CWHeight;
}
- if (rs->mode != RESIZE_MODE_NORMAL)
+ if (rs->mode != ResizeOptions::ModeNormal)
{
RESIZE_WINDOW (rs->w);
- if (rw->gWindow && rs->mode == RESIZE_MODE_STRETCH)
+ if (rw->gWindow && rs->mode == ResizeOptions::ModeStretch)
rw->gWindow->glPaintSetEnabled (rw, false);
- if (rw->cWindow && rs->mode == RESIZE_MODE_STRETCH)
+ if (rw->cWindow && rs->mode == ResizeOptions::ModeStretch)
rw->cWindow->damageRectSetEnabled (rw, false);
rs->gScreen->glPaintOutputSetEnabled (rs, false);
}
@@ -606,9 +606,8 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
CompAction *action;
int pointerAdjustX = 0;
int pointerAdjustY = 0;
- int option = RESIZE_OPTION_INITIATE_KEY;
- action = &opt[option].value ().action ();
+ action = &optionGetInitiateKey ();
action->setState (action->state () |
CompAction::StateTermButton);
@@ -658,9 +657,9 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
w->constrainNewWindowSize (wi, he, &wi, &he);
- if (mode != RESIZE_MODE_NORMAL)
+ if (mode != ResizeOptions::ModeNormal)
{
- if (mode == RESIZE_MODE_STRETCH)
+ if (mode == ResizeOptions::ModeStretch)
getStretchRectangle (&box);
else
getPaintRectangle (&box);
@@ -677,9 +676,9 @@ ResizeScreen::handleMotionEvent (int xRoot, int yRoot)
geometry.width = wi;
geometry.height = he;
- if (mode != RESIZE_MODE_NORMAL)
+ if (mode != ResizeOptions::ModeNormal)
{
- if (mode == RESIZE_MODE_STRETCH)
+ if (mode == ResizeOptions::ModeStretch)
getStretchRectangle (&box);
else
getPaintRectangle (&box);
@@ -712,8 +711,7 @@ ResizeScreen::handleEvent (XEvent *event)
if (releaseButton == -1 ||
(int) event->xbutton.button == releaseButton)
{
- int opt = RESIZE_OPTION_INITIATE_BUTTON;
- CompAction *action = &this->opt[opt].value ().action ();
+ CompAction *action = &optionGetInitiateButton ();
resizeTerminate (action, CompAction::StateTermButton,
noOptions);
@@ -745,7 +743,6 @@ ResizeScreen::handleEvent (XEvent *event)
if (w)
{
CompOption::Vector o (0);
- int option;
o.push_back (CompOption ("window",
CompOption::TypeInt));
@@ -753,9 +750,7 @@ ResizeScreen::handleEvent (XEvent *event)
if (event->xclient.data.l[2] == WmMoveResizeSizeKeyboard)
{
- option = RESIZE_OPTION_INITIATE_KEY;
-
- resizeInitiate (&opt[option].value ().action (),
+ resizeInitiate (&optionGetInitiateKey (),
CompAction::StateInitKey, o);
}
else
@@ -774,8 +769,6 @@ ResizeScreen::handleEvent (XEvent *event)
Window root, child;
int xRoot, yRoot, i;
- option = RESIZE_OPTION_INITIATE_BUTTON;
-
XQueryPointer (screen->dpy (),
screen->root (),
&root, &child, &xRoot, &yRoot,
@@ -806,7 +799,7 @@ ResizeScreen::handleEvent (XEvent *event)
((int) (event->xclient.data.l[3] ?
event->xclient.data.l[3] : -1));
- resizeInitiate (&opt[option].value ().action (),
+ resizeInitiate (&optionGetInitiateButton (),
CompAction::StateInitButton, o);
ResizeScreen::get (screen)->
@@ -819,13 +812,9 @@ ResizeScreen::handleEvent (XEvent *event)
{
if (rs->w->id () == event->xclient.window)
{
- int option;
-
- option = RESIZE_OPTION_INITIATE_BUTTON;
- resizeTerminate (&opt[option].value ().action (),
+ resizeTerminate (&optionGetInitiateButton (),
CompAction::StateCancel, noOptions);
- option = RESIZE_OPTION_INITIATE_KEY;
- resizeTerminate (&opt[option].value ().action (),
+ resizeTerminate (&optionGetInitiateKey (),
CompAction::StateCancel, noOptions);
}
}
@@ -834,23 +823,15 @@ ResizeScreen::handleEvent (XEvent *event)
case DestroyNotify:
if (w && w->id () == event->xdestroywindow.window)
{
- int option;
-
- option = RESIZE_OPTION_INITIATE_BUTTON;
- resizeTerminate (&opt[option].value ().action (), 0, noOptions);
- option = RESIZE_OPTION_INITIATE_KEY;
- resizeTerminate (&opt[option].value ().action (), 0, noOptions);
+ resizeTerminate (&optionGetInitiateButton (), 0, noOptions);
+ resizeTerminate (&optionGetInitiateKey (), 0, noOptions);
}
break;
case UnmapNotify:
if (w && w->id () == event->xunmap.window)
{
- int option;
-
- option = RESIZE_OPTION_INITIATE_BUTTON;
- resizeTerminate (&opt[option].value ().action (), 0, noOptions);
- option = RESIZE_OPTION_INITIATE_KEY;
- resizeTerminate (&opt[option].value ().action (), 0, noOptions);
+ resizeTerminate (&optionGetInitiateButton (), 0, noOptions);
+ resizeTerminate (&optionGetInitiateKey (), 0, noOptions);
}
default:
break;
@@ -937,7 +918,7 @@ ResizeScreen::glPaintOutput (const GLScreenPaintAttrib &sAttrib,
if (w)
{
- if (mode == RESIZE_MODE_STRETCH)
+ if (mode == ResizeOptions::ModeStretch)
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
}
@@ -947,14 +928,14 @@ ResizeScreen::glPaintOutput (const GLScreenPaintAttrib &sAttrib,
{
unsigned short *border, *fill;
- border = opt[RESIZE_OPTION_BORDER_COLOR].value ().c ();
- fill = opt[RESIZE_OPTION_FILL_COLOR].value ().c ();
+ border = optionGetBorderColor ();
+ fill = optionGetFillColor ();
switch (mode) {
- case RESIZE_MODE_OUTLINE:
+ case ResizeOptions::ModeOutline:
glPaintRectangle (sAttrib, transform, output, border, NULL);
break;
- case RESIZE_MODE_RECTANGLE:
+ case ResizeOptions::ModeRectangle:
glPaintRectangle (sAttrib, transform, output, border, fill);
default:
break;
@@ -972,7 +953,7 @@ ResizeWindow::glPaint (const GLWindowPaintAttrib &attrib,
{
bool status;
- if (window == rScreen->w && rScreen->mode == RESIZE_MODE_STRETCH)
+ if (window == rScreen->w && rScreen->mode == ResizeOptions::ModeStretch)
{
GLMatrix wTransform (transform);
BoxRec box;
@@ -1027,7 +1008,7 @@ ResizeWindow::damageRect (bool initial, const CompRect &rect)
{
bool status = false;
- if (window == rScreen->w && rScreen->mode == RESIZE_MODE_STRETCH)
+ if (window == rScreen->w && rScreen->mode == ResizeOptions::ModeStretch)
{
BoxRec box;
@@ -1042,61 +1023,16 @@ ResizeWindow::damageRect (bool initial, const CompRect &rect)
return status;
}
-CompOption::Vector &
-ResizeScreen::getOptions ()
-{
- return opt;
-}
-
-bool
-ResizeScreen::setOption (const char *name,
- CompOption::Value &value)
-{
- CompOption *o;
- unsigned int index;
-
- o = CompOption::findOption (opt, name, &index);
- if (!o)
- return false;
-
- return CompOption::setOption (*o, value);
-
-}
-
-static const CompMetadata::OptionInfo resizeOptionInfo[] = {
- { "initiate_normal_key", "key", 0, resizeInitiate, resizeTerminate },
- { "initiate_outline_key", "key", 0, resizeInitiate, resizeTerminate },
- { "initiate_rectangle_key", "key", 0, resizeInitiate, resizeTerminate },
- { "initiate_stretch_key", "key", 0, resizeInitiate, resizeTerminate },
- { "initiate_button", "button", 0, resizeInitiate, resizeTerminate },
- { "initiate_key", "key", 0, resizeInitiate, resizeTerminate },
- { "mode", "int", RESTOSTRING (0, RESIZE_MODE_LAST), 0, 0 },
- { "border_color", "color", 0, 0, 0 },
- { "fill_color", "color", 0, 0, 0 },
- { "normal_match", "match", 0, 0, 0 },
- { "outline_match", "match", 0, 0, 0 },
- { "rectangle_match", "match", 0, 0, 0 },
- { "stretch_match", "match", 0, 0, 0 }
-};
-
ResizeScreen::ResizeScreen (CompScreen *s) :
PluginClassHandler<ResizeScreen,CompScreen> (s),
gScreen (GLScreen::get (s)),
cScreen (CompositeScreen::get (s)),
w (NULL),
- releaseButton (0),
- opt (RESIZE_OPTION_NUM)
+ releaseButton (0)
{
Display *dpy = s->dpy ();
- if (!resizeVTable->getMetadata ()->initOptions (resizeOptionInfo,
- RESIZE_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
-
resizeNotifyAtom = XInternAtom (s->dpy (),
"_COMPIZ_RESIZE_NOTIFY", 0);
resizeInformationAtom = XInternAtom (s->dpy (),
@@ -1122,6 +1058,19 @@ ResizeScreen::ResizeScreen (CompScreen *s) :
cursor[2] = upCursor;
cursor[3] = downCursor;
+ optionSetInitiateNormalKeyInitiate (resizeInitiate);
+ optionSetInitiateNormalKeyTerminate (resizeTerminate);
+ optionSetInitiateOutlineKeyInitiate (resizeInitiate);
+ optionSetInitiateOutlineKeyTerminate (resizeTerminate);
+ optionSetInitiateRectangleKeyInitiate (resizeInitiate);
+ optionSetInitiateRectangleKeyTerminate (resizeTerminate);
+ optionSetInitiateStretchKeyInitiate (resizeInitiate);
+ optionSetInitiateStretchKeyTerminate (resizeTerminate);
+ optionSetInitiateKeyInitiate (resizeInitiate);
+ optionSetInitiateKeyTerminate (resizeTerminate);
+ optionSetInitiateButtonInitiate (resizeInitiate);
+ optionSetInitiateButtonTerminate (resizeTerminate);
+
ScreenInterface::setHandler (s);
if (gScreen)
@@ -1180,9 +1129,6 @@ ResizePluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromOptionInfo (resizeOptionInfo, RESIZE_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/resize/src/resize.h b/plugins/resize/src/resize.h
index 5000a46..e2eee68 100644
--- a/plugins/resize/src/resize.h
+++ b/plugins/resize/src/resize.h
@@ -32,20 +32,7 @@
#include <composite/composite.h>
#include <opengl/opengl.h>
-#define RESIZE_OPTION_INITIATE_NORMAL_KEY 0
-#define RESIZE_OPTION_INITIATE_OUTLINE_KEY 1
-#define RESIZE_OPTION_INITIATE_RECTANGLE_KEY 2
-#define RESIZE_OPTION_INITIATE_STRETCH_KEY 3
-#define RESIZE_OPTION_INITIATE_BUTTON 4
-#define RESIZE_OPTION_INITIATE_KEY 5
-#define RESIZE_OPTION_MODE 6
-#define RESIZE_OPTION_BORDER_COLOR 7
-#define RESIZE_OPTION_FILL_COLOR 8
-#define RESIZE_OPTION_NORMAL_MATCH 9
-#define RESIZE_OPTION_OUTLINE_MATCH 10
-#define RESIZE_OPTION_RECTANGLE_MATCH 11
-#define RESIZE_OPTION_STRETCH_MATCH 12
-#define RESIZE_OPTION_NUM 13
+#include "resize_options.h"
#define RESIZE_SCREEN(s) ResizeScreen *rs = ResizeScreen::get(s)
#define RESIZE_WINDOW(w) ResizeWindow *rw = ResizeWindow::get(w)
@@ -55,12 +42,6 @@
#define ResizeLeftMask (1L << 2)
#define ResizeRightMask (1L << 3)
-#define RESIZE_MODE_NORMAL 0
-#define RESIZE_MODE_OUTLINE 1
-#define RESIZE_MODE_RECTANGLE 2
-#define RESIZE_MODE_STRETCH 3
-#define RESIZE_MODE_LAST RESIZE_MODE_STRETCH
-
struct _ResizeKeys {
const char *name;
int dx;
@@ -82,15 +63,13 @@ struct _ResizeKeys {
class ResizeScreen :
public PluginClassHandler<ResizeScreen,CompScreen>,
public GLScreenInterface,
- public ScreenInterface
+ public ScreenInterface,
+ public ResizeOptions
{
public:
ResizeScreen (CompScreen *s);
~ResizeScreen ();
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
-
void handleEvent (XEvent *event);
void getPaintRectangle (BoxPtr pBox);
@@ -150,8 +129,6 @@ class ResizeScreen :
Cursor downRightCursor;
Cursor middleCursor;
Cursor cursor[NUM_KEYS];
-
- CompOption::Vector opt;
};
class ResizeWindow :
@@ -187,9 +164,6 @@ class ResizePluginVTable :
{
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (ResizeScreen)
-
};
#endif
diff --git a/plugins/scale/include/scale/scale.h b/plugins/scale/include/scale/scale.h
index c035297..f31fe71 100644
--- a/plugins/scale/include/scale/scale.h
+++ b/plugins/scale/include/scale/scale.h
@@ -49,7 +49,8 @@ class ScaleScreenInterface :
class ScaleScreen :
public WrapableHandler<ScaleScreenInterface, 1>,
- public PluginClassHandler<ScaleScreen, CompScreen, COMPIZ_SCALE_ABI>
+ public PluginClassHandler<ScaleScreen, CompScreen, COMPIZ_SCALE_ABI>,
+ public CompOption::Class
{
public:
typedef enum {
@@ -71,8 +72,7 @@ class ScaleScreen :
void relayoutSlots (const CompMatch& match);
CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
- CompOption * getOption (const char *name);
+ bool setOption (const CompString &name, CompOption::Value &value);
WRAPABLE_HND (0, ScaleScreenInterface, bool,
layoutSlotsAndAssignWindows)
diff --git a/plugins/scale/scale.xml.in b/plugins/scale/scale.xml.in
index c4f2ce8..414c3db 100644
--- a/plugins/scale/scale.xml.in
+++ b/plugins/scale/scale.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="scale">
+ <plugin name="scale" useBcop="true">
<_short>Scale</_short>
<_long>Scale windows</_long>
<deps>
diff --git a/plugins/scale/src/privates.h b/plugins/scale/src/privates.h
index 972669a..a0e65c3 100644
--- a/plugins/scale/src/privates.h
+++ b/plugins/scale/src/privates.h
@@ -27,40 +27,7 @@
#define _SCALE_PRIVATES_H
#include <scale/scale.h>
-
-#define SCALE_ICON_NONE 0
-#define SCALE_ICON_EMBLEM 1
-#define SCALE_ICON_BIG 2
-#define SCALE_ICON_LAST SCALE_ICON_BIG
-
-#define SCALE_MOMODE_CURRENT 0
-#define SCALE_MOMODE_ALL 1
-#define SCALE_MOMODE_LAST SCALE_MOMODE_ALL
-
-#define SCALE_OPTION_INITIATE_EDGE 0
-#define SCALE_OPTION_INITIATE_BUTTON 1
-#define SCALE_OPTION_INITIATE_KEY 2
-#define SCALE_OPTION_INITIATE_ALL_EDGE 3
-#define SCALE_OPTION_INITIATE_ALL_BUTTON 4
-#define SCALE_OPTION_INITIATE_ALL_KEY 5
-#define SCALE_OPTION_INITIATE_GROUP_EDGE 6
-#define SCALE_OPTION_INITIATE_GROUP_BUTTON 7
-#define SCALE_OPTION_INITIATE_GROUP_KEY 8
-#define SCALE_OPTION_INITIATE_OUTPUT_EDGE 9
-#define SCALE_OPTION_INITIATE_OUTPUT_BUTTON 10
-#define SCALE_OPTION_INITIATE_OUTPUT_KEY 11
-#define SCALE_OPTION_SHOW_DESKTOP 12
-#define SCALE_OPTION_SPACING 13
-#define SCALE_OPTION_SPEED 14
-#define SCALE_OPTION_TIMESTEP 15
-#define SCALE_OPTION_WINDOW_MATCH 16
-#define SCALE_OPTION_DARKEN_BACK 17
-#define SCALE_OPTION_OPACITY 18
-#define SCALE_OPTION_ICON 19
-#define SCALE_OPTION_HOVER_TIME 20
-#define SCALE_OPTION_MULTIOUTPUT_MODE 21
-#define SCALE_OPTION_NUM 22
-
+#include "scale_options.h"
class ScaleSlot {
public:
@@ -88,7 +55,8 @@ enum ScaleType {
class PrivateScaleScreen :
public ScreenInterface,
public CompositeScreenInterface,
- public GLScreenInterface
+ public GLScreenInterface,
+ public ScaleOptions
{
public:
PrivateScaleScreen (CompScreen *);
@@ -139,6 +107,8 @@ class PrivateScaleScreen :
bool hoverTimeout ();
+ void updateOpacity ();
+
public:
CompositeScreen *cScreen;
@@ -178,8 +148,6 @@ class PrivateScaleScreen :
CompMatch match;
CompMatch currentMatch;
-
- CompOption::Vector opt;
};
class PrivateScaleWindow :
diff --git a/plugins/scale/src/scale.cpp b/plugins/scale/src/scale.cpp
index 9ee8914..0615fd1 100644
--- a/plugins/scale/src/scale.cpp
+++ b/plugins/scale/src/scale.cpp
@@ -50,11 +50,9 @@ class ScalePluginVTable :
bool init ();
void fini ();
-
- PLUGIN_OPTION_HELPER (ScaleScreen)
};
-COMPIZ_PLUGIN_20081216 (scale, ScalePluginVTable)
+COMPIZ_PLUGIN_20090315 (scale, ScalePluginVTable)
bool
PrivateScaleWindow::isNeverScaleWin () const
@@ -138,7 +136,7 @@ ScaleWindow::scalePaintDecoration (const GLWindowPaintAttrib& attrib,
{
WRAPABLE_HND_FUNC(0, scalePaintDecoration, attrib, transform, region, mask)
- if (priv->spScreen->opt[SCALE_OPTION_ICON].value ().i () != SCALE_ICON_NONE)
+ if (priv->spScreen->optionGetOverlayIcon () != ScaleOptions::OverlayIconNone)
{
GLWindowPaintAttrib sAttrib (attrib);
GLTexture *icon;
@@ -158,12 +156,12 @@ ScaleWindow::scalePaintDecoration (const GLWindowPaintAttrib& attrib,
scaledWinWidth = priv->window->width () * priv->scale;
scaledWinHeight = priv->window->height () * priv->scale;
- switch (priv->spScreen->opt[SCALE_OPTION_ICON].value ().i ()) {
- case SCALE_ICON_NONE:
- case SCALE_ICON_EMBLEM:
+ switch (priv->spScreen->optionGetOverlayIcon ()) {
+ case ScaleOptions::OverlayIconNone:
+ case ScaleOptions::OverlayIconEmblem:
scale = 1.0f;
break;
- case SCALE_ICON_BIG:
+ case ScaleOptions::OverlayIconBig:
default:
sAttrib.opacity /= 3;
scale = MIN (((float) scaledWinWidth / icon->width ()),
@@ -174,13 +172,13 @@ ScaleWindow::scalePaintDecoration (const GLWindowPaintAttrib& attrib,
width = icon->width () * scale;
height = icon->height () * scale;
- switch (priv->spScreen->opt[SCALE_OPTION_ICON].value ().i ()) {
- case SCALE_ICON_NONE:
- case SCALE_ICON_EMBLEM:
+ switch (priv->spScreen->optionGetOverlayIcon ()) {
+ case ScaleOptions::OverlayIconNone:
+ case ScaleOptions::OverlayIconEmblem:
x = priv->window->x () + scaledWinWidth - icon->width ();
y = priv->window->y () + scaledWinHeight - icon->height ();
break;
- case SCALE_ICON_BIG:
+ case ScaleOptions::OverlayIconBig:
default:
x = priv->window->x () + scaledWinWidth / 2 - width / 2;
y = priv->window->y () + scaledWinHeight / 2 - height / 2;
@@ -281,7 +279,7 @@ ScaleWindow::setScaledPaintAttributes (GLWindowPaintAttrib& attrib)
}
else if (priv->spScreen->state != ScaleScreen::In)
{
- if (priv->spScreen->opt[SCALE_OPTION_DARKEN_BACK].value ().b ())
+ if (priv->spScreen->optionGetDarkenBack ())
{
/* modify brightness of the other windows */
attrib.brightness = attrib.brightness / 2;
@@ -291,13 +289,12 @@ ScaleWindow::setScaledPaintAttributes (GLWindowPaintAttrib& attrib)
that are not in scale mode */
if (!priv->isNeverScaleWin ())
{
- int opt, moMode, output;
+ int moMode, output;
- opt = SCALE_OPTION_MULTIOUTPUT_MODE;
- moMode = priv->spScreen->opt[opt].value ().i ();
+ moMode = priv->spScreen->optionGetMultioutputMode ();
switch (moMode) {
- case SCALE_MOMODE_CURRENT:
+ case ScaleOptions::MultioutputModeOnCurrentOutputDevice:
output = screen->currentOutputDev ().id ();
if (priv->window->outputDevice () == output)
attrib.opacity = 0;
@@ -387,7 +384,7 @@ PrivateScaleScreen::layoutSlotsForArea (const CompRect& workArea,
return;
lines = sqrt (nWindows + 1);
- spacing = opt[SCALE_OPTION_SPACING].value ().i ();
+ spacing = optionGetSpacing ();
nSlots = 0;
y = workArea.y () + spacing;
@@ -491,18 +488,18 @@ PrivateScaleScreen::layoutSlots ()
int i;
int moMode;
- moMode = opt[SCALE_OPTION_MULTIOUTPUT_MODE].value ().i ();
+ moMode = optionGetMultioutputMode ();
/* if we have only one head, we don't need the
additional effort of the all outputs mode */
if (screen->outputDevs ().size () == 1)
- moMode = SCALE_MOMODE_CURRENT;
+ moMode = ScaleOptions::MultioutputModeOnCurrentOutputDevice;
nSlots = 0;
switch (moMode)
{
- case SCALE_MOMODE_ALL:
+ case ScaleOptions::MultioutputModeOnAllOutputDevices:
{
SlotArea::vector slotAreas = getSlotAreas ();
if (slotAreas.size ())
@@ -510,7 +507,7 @@ PrivateScaleScreen::layoutSlots ()
layoutSlotsForArea (sa.workArea, sa.nWindows);
}
break;
- case SCALE_MOMODE_CURRENT:
+ case ScaleOptions::MultioutputModeOnCurrentOutputDevice:
default:
{
CompRect workArea (screen->currentOutputDev ().workArea ());
@@ -778,9 +775,8 @@ PrivateScaleScreen::preparePaint (int msSinceLastPaint)
int steps;
float amount, chunk;
- amount = msSinceLastPaint * 0.05f *
- opt[SCALE_OPTION_SPEED].value ().f ();
- steps = amount / (0.5f * opt[SCALE_OPTION_TIMESTEP].value ().f ());
+ amount = msSinceLastPaint * 0.05f * optionGetSpeed ();
+ steps = amount / (0.5f * optionGetTimestep ());
if (!steps)
steps = 1;
@@ -1047,7 +1043,7 @@ PrivateScaleScreen::scaleInitiateCommon (CompAction *action,
match = CompOption::getMatchOptionNamed (options, "match",
CompMatch::emptyMatch);
if (match.isEmpty ())
- match = opt[SCALE_OPTION_WINDOW_MATCH].value ().match ();
+ match = optionGetWindowMatch ();
/* TODO: match.update() ? */
currentMatch = match;
@@ -1288,10 +1284,10 @@ PrivateScaleScreen::windowRemove (Window id)
o.push_back (CompOption ("root", CompOption::TypeInt));
o[0].value ().set ((int) screen->root ());
- action = &opt[SCALE_OPTION_INITIATE_EDGE].value ().action ();
+ action = &optionGetInitiateEdge ();
scaleTerminate (action, CompAction::StateCancel, o);
- action = &opt[SCALE_OPTION_INITIATE_KEY].value ().action ();
+ action = &optionGetInitiateKey ();
scaleTerminate (action, CompAction::StateCancel, o);
break;
}
@@ -1306,7 +1302,6 @@ PrivateScaleScreen::hoverTimeout ()
{
CompWindow *w;
CompOption::Vector o (0);
- int option;
w = screen->findWindow (selectedWindow);
if (w)
@@ -1320,10 +1315,8 @@ PrivateScaleScreen::hoverTimeout ()
o.push_back (CompOption ("root", CompOption::TypeInt));
o[0].value ().set ((int) screen->root ());
- option = SCALE_OPTION_INITIATE_EDGE;
- scaleTerminate (&opt[option].value ().action (), 0, o);
- option = SCALE_OPTION_INITIATE_KEY;
- scaleTerminate (&opt[option].value ().action (), 0, o);
+ scaleTerminate (&optionGetInitiateEdge (), 0, o);
+ scaleTerminate (&optionGetInitiateKey (), 0, o);
}
return false;
@@ -1356,7 +1349,6 @@ PrivateScaleScreen::handleEvent (XEvent *event)
state != ScaleScreen::In)
{
XButtonEvent *button = &event->xbutton;
- int option;
CompOption::Vector o (0);
o.push_back (CompOption ("root", CompOption::TypeInt));
@@ -1364,22 +1356,18 @@ PrivateScaleScreen::handleEvent (XEvent *event)
if (selectWindowAt (button->x_root, button->y_root, true))
{
- option = SCALE_OPTION_INITIATE_EDGE;
- scaleTerminate (&opt[option].value ().action (), 0, o);
- option = SCALE_OPTION_INITIATE_KEY;
- scaleTerminate (&opt[option].value ().action (), 0, o);
+ scaleTerminate (&optionGetInitiateEdge (), 0, o);
+ scaleTerminate (&optionGetInitiateKey (), 0, o);
}
- else if (opt[SCALE_OPTION_SHOW_DESKTOP].value ().b ())
+ else if (optionGetShowDesktop ())
{
CompPoint pointer (button->x_root, button->y_root);
CompRect workArea (screen->workArea ());
if (workArea.contains (pointer))
{
- option = SCALE_OPTION_INITIATE_EDGE;
- scaleTerminate (&opt[option].value ().action (), 0, o);
- option = SCALE_OPTION_INITIATE_KEY;
- scaleTerminate (&opt[option].value ().action (), 0, o);
+ scaleTerminate (&optionGetInitiateEdge (), 0, o);
+ scaleTerminate (&optionGetInitiateKey (), 0, o);
screen->enterShowDesktopMode ();
}
}
@@ -1430,7 +1418,7 @@ PrivateScaleScreen::handleEvent (XEvent *event)
{
int time;
- time = opt[SCALE_OPTION_HOVER_TIME].value ().i ();
+ time = optionGetHoverTime ();
if (hover.active ())
{
@@ -1457,8 +1445,6 @@ PrivateScaleScreen::handleEvent (XEvent *event)
CompWindow *w = screen->findWindow (event->xclient.window);
if (w)
{
- int option;
-
if (grab &&
state != ScaleScreen::In &&
w->id () == dndTarget)
@@ -1467,10 +1453,8 @@ PrivateScaleScreen::handleEvent (XEvent *event)
o.push_back (CompOption ("root", CompOption::TypeInt));
o[0].value ().set ((int) screen->root ());
- option = SCALE_OPTION_INITIATE_EDGE;
- scaleTerminate (&opt[option].value ().action (), 0, o);
- option = SCALE_OPTION_INITIATE_KEY;
- scaleTerminate (&opt[option].value ().action (), 0, o);
+ scaleTerminate (&optionGetInitiateEdge (), 0, o);
+ scaleTerminate (&optionGetInitiateKey (), 0, o);
}
}
}
@@ -1522,48 +1506,6 @@ PrivateScaleWindow::damageRect (bool initial,
return status;
}
-#define SCALEBIND(a) \
- boost::bind (PrivateScaleScreen::scaleInitiate, _1, _2, _3, a)
-
-static const CompMetadata::OptionInfo scaleOptionInfo[] = {
- { "initiate_edge", "edge", 0,
- SCALEBIND (ScaleTypeNormal), PrivateScaleScreen::scaleTerminate },
- { "initiate_button", "button", 0,
- SCALEBIND (ScaleTypeNormal), PrivateScaleScreen::scaleTerminate },
- { "initiate_key", "key", 0,
- SCALEBIND (ScaleTypeNormal), PrivateScaleScreen::scaleTerminate },
- { "initiate_all_edge", "edge", 0,
- SCALEBIND (ScaleTypeAll), PrivateScaleScreen::scaleTerminate },
- { "initiate_all_button", "button", 0,
- SCALEBIND (ScaleTypeAll), PrivateScaleScreen::scaleTerminate },
- { "initiate_all_key", "key", 0,
- SCALEBIND (ScaleTypeAll), PrivateScaleScreen::scaleTerminate },
- { "initiate_group_edge", "edge", 0,
- SCALEBIND (ScaleTypeGroup), PrivateScaleScreen::scaleTerminate },
- { "initiate_group_button", "button", 0,
- SCALEBIND (ScaleTypeGroup), PrivateScaleScreen::scaleTerminate },
- { "initiate_group_key", "key", 0,
- SCALEBIND (ScaleTypeGroup), PrivateScaleScreen::scaleTerminate },
- { "initiate_output_edge", "edge", 0,
- SCALEBIND (ScaleTypeOutput), PrivateScaleScreen::scaleTerminate },
- { "initiate_output_button", "button", 0,
- SCALEBIND (ScaleTypeOutput), PrivateScaleScreen::scaleTerminate },
- { "initiate_output_key", "key", 0,
- SCALEBIND (ScaleTypeOutput), PrivateScaleScreen::scaleTerminate },
- { "show_desktop", "bool", 0, 0, 0 },
- { "spacing", "int", "<min>0</min>", 0, 0 },
- { "speed", "float", "<min>0.1</min>", 0, 0 },
- { "timestep", "float", "<min>0.1</min>", 0, 0 },
- { "window_match", "match", 0, 0, 0 },
- { "darken_back", "bool", 0, 0, 0 },
- { "opacity", "int", "<min>0</min><max>100</max>", 0, 0 },
- { "overlay_icon", "int", RESTOSTRING (0, SCALE_ICON_LAST), 0, 0 },
- { "hover_time", "int", "<min>50</min>", 0, 0 },
- { "multioutput_mode", "int", RESTOSTRING (0, SCALE_MOMODE_LAST), 0, 0 }
-};
-
-#undef SCALEBIND
-
ScaleScreen::ScaleScreen (CompScreen *s) :
PluginClassHandler<ScaleScreen, CompScreen, COMPIZ_SCALE_ABI> (s),
priv (new PrivateScaleScreen (s))
@@ -1604,13 +1546,6 @@ PrivateScaleScreen::PrivateScaleScreen (CompScreen *s) :
cursor (0),
nSlots (0)
{
- if (!scaleVTable->getMetadata ()->initOptions (scaleOptionInfo,
- SCALE_OPTION_NUM, opt))
- {
- ScaleScreen::get (s)->setFailed ();
- return;
- }
-
leftKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Left"));
rightKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Right"));
upKeyCode = XKeysymToKeycode (screen->dpy (), XStringToKeysym ("Up"));
@@ -1618,10 +1553,45 @@ PrivateScaleScreen::PrivateScaleScreen (CompScreen *s) :
cursor = XCreateFontCursor (screen->dpy (), XC_left_ptr);
- opacity = (OPAQUE * opt[SCALE_OPTION_OPACITY].value ().i ()) / 100;
+ opacity = (OPAQUE * optionGetOpacity ()) / 100;
hover.setCallback (boost::bind (&PrivateScaleScreen::hoverTimeout, this));
+ optionSetOpacityNotify (boost::bind (&PrivateScaleScreen::updateOpacity, this));
+
+#define SCALEBIND(a) \
+ boost::bind (PrivateScaleScreen::scaleInitiate, _1, _2, _3, a)
+
+ optionSetInitiateEdgeInitiate (SCALEBIND (ScaleTypeNormal));
+ optionSetInitiateEdgeTerminate (PrivateScaleScreen::scaleTerminate);
+ optionSetInitiateButtonInitiate (SCALEBIND (ScaleTypeNormal));
+ optionSetInitiateButtonTerminate (PrivateScaleScreen::scaleTerminate);
+ optionSetInitiateKeyInitiate (SCALEBIND (ScaleTypeNormal));
+ optionSetInitiateKeyTerminate (PrivateScaleScreen::scaleTerminate);
+
+ optionSetInitiateAllEdgeInitiate (SCALEBIND (ScaleTypeAll));
+ optionSetInitiateAllEdgeTerminate (PrivateScaleScreen::scaleTerminate);
+ optionSetInitiateAllButtonInitiate (SCALEBIND (ScaleTypeAll));
+ optionSetInitiateAllButtonTerminate (PrivateScaleScreen::scaleTerminate);
+ optionSetInitiateAllKeyInitiate (SCALEBIND (ScaleTypeAll));
+ optionSetInitiateAllKeyTerminate (PrivateScaleScreen::scaleTerminate);
+
+ optionSetInitiateGroupEdgeInitiate (SCALEBIND (ScaleTypeGroup));
+ optionSetInitiateGroupEdgeTerminate (PrivateScaleScreen::scaleTerminate);
+ optionSetInitiateGroupButtonInitiate (SCALEBIND (ScaleTypeGroup));
+ optionSetInitiateGroupButtonTerminate (PrivateScaleScreen::scaleTerminate);
+ optionSetInitiateGroupKeyInitiate (SCALEBIND (ScaleTypeGroup));
+ optionSetInitiateGroupKeyTerminate (PrivateScaleScreen::scaleTerminate);
+
+ optionSetInitiateOutputEdgeInitiate (SCALEBIND (ScaleTypeOutput));
+ optionSetInitiateOutputEdgeTerminate (PrivateScaleScreen::scaleTerminate);
+ optionSetInitiateOutputButtonInitiate (SCALEBIND (ScaleTypeOutput));
+ optionSetInitiateOutputButtonTerminate (PrivateScaleScreen::scaleTerminate);
+ optionSetInitiateOutputKeyInitiate (SCALEBIND (ScaleTypeOutput));
+ optionSetInitiateOutputKeyTerminate (PrivateScaleScreen::scaleTerminate);
+
+#undef SCALEBIND
+
ScreenInterface::setHandler (s);
CompositeScreenInterface::setHandler (cScreen, false);
GLScreenInterface::setHandler (gScreen, false);
@@ -1633,6 +1603,12 @@ PrivateScaleScreen::~PrivateScaleScreen ()
XFreeCursor (screen->dpy (), cursor);
}
+void
+PrivateScaleScreen::updateOpacity ()
+{
+ opacity = (OPAQUE * optionGetOpacity ()) / 100;
+}
+
PrivateScaleWindow::PrivateScaleWindow (CompWindow *w) :
window (w),
@@ -1667,40 +1643,14 @@ PrivateScaleWindow::~PrivateScaleWindow ()
CompOption::Vector &
ScaleScreen::getOptions ()
{
- return priv->opt;
-}
-
-CompOption *
-ScaleScreen::getOption (const char *name)
-{
- return CompOption::findOption (priv->opt, name);
+ return priv->getOptions ();
}
bool
-ScaleScreen::setOption (const char *name,
+ScaleScreen::setOption (const CompString &name,
CompOption::Value &value)
{
- CompOption *o;
- unsigned int index;
-
- o = CompOption::findOption (priv->opt, name, &index);
- if (!o)
- return false;
-
- switch (index) {
- case SCALE_OPTION_OPACITY:
- if (o->set (value))
- {
- priv->opacity = (OPAQUE * o->value ().i ()) / 100;
- return true;
- }
- default:
- if (CompOption::setOption (*o, value))
- return true;
- break;
- }
-
- return false;
+ return priv->setOption (name, value);
}
bool
@@ -1715,9 +1665,6 @@ ScalePluginVTable::init ()
p.uval = COMPIZ_SCALE_ABI;
screen->storeValue ("scale_ABI", p);
- getMetadata ()->addFromOptionInfo (scaleOptionInfo, SCALE_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/switcher/src/switcher.cpp b/plugins/switcher/src/switcher.cpp
index fad8198..e645d40 100644
--- a/plugins/switcher/src/switcher.cpp
+++ b/plugins/switcher/src/switcher.cpp
@@ -25,7 +25,7 @@
#include "switcher.h"
-COMPIZ_PLUGIN_20081216 (switcher, SwitchPluginVTable)
+COMPIZ_PLUGIN_20090315 (switcher, SwitchPluginVTable)
static float _boxVertices[] =
{
@@ -64,7 +64,7 @@ SwitchWindow::isSwitchWin ()
{
if (!window->isViewable ())
{
- if (sScreen->opt[SWITCH_OPTION_MINIMIZED].value ().b ())
+ if (sScreen->optionGetMinimized ())
{
if (!window->minimized () && !window->inShowDesktopMode () &&
!window->shaded ())
@@ -99,7 +99,7 @@ SwitchWindow::isSwitchWin ()
if (window->state () & CompWindowStateSkipTaskbarMask)
return false;
- match = &sScreen->opt[SWITCH_OPTION_WINDOW_MATCH].value ().match ();
+ match = &sScreen->optionGetWindowMatch ();
if (!match->evaluate (window))
return false;
@@ -262,8 +262,7 @@ SwitchScreen::switchToWindow (bool toNext)
{
Window old = selectedWindow;
- if (selection == AllViewports &&
- opt[SWITCH_OPTION_AUTO_ROTATE].value ().b ())
+ if (selection == AllViewports && optionGetAutoRotate ())
{
XEvent xev;
CompPoint pnt = w->defaultViewport ();
@@ -636,57 +635,6 @@ switchInitiateCommon (CompAction *action,
return false;
}
-#define SWITCHBIND(a,b,c) boost::bind (switchInitiateCommon, _1, _2, _3, a, b, c)
-
-static const CompMetadata::OptionInfo switchOptionInfo[] = {
- { "next_button", "button", 0,
- SWITCHBIND (CurrentViewport, true, true), switchTerminate },
- { "next_key", "key", 0,
- SWITCHBIND (CurrentViewport, true, true), switchTerminate },
- { "prev_button", "button", 0,
- SWITCHBIND (CurrentViewport, true, false), switchTerminate },
- { "prev_key", "key", 0,
- SWITCHBIND (CurrentViewport, true, false), switchTerminate },
- { "next_all_button", "button", 0,
- SWITCHBIND (AllViewports, true, true), switchTerminate },
- { "next_all_key", "key", 0,
- SWITCHBIND (AllViewports, true, true), switchTerminate },
- { "prev_all_button", "button", 0,
- SWITCHBIND (AllViewports, true, false), switchTerminate },
- { "prev_all_key", "key", 0,
- SWITCHBIND (AllViewports, true, false), switchTerminate },
- { "next_no_popup_button", "button", 0,
- SWITCHBIND (CurrentViewport, false, true), switchTerminate },
- { "next_no_popup_key", "key", 0,
- SWITCHBIND (CurrentViewport, false, true), switchTerminate },
- { "prev_no_popup_button", "button", 0,
- SWITCHBIND (CurrentViewport, false, false), switchTerminate },
- { "prev_no_popup_key", "key", 0,
- SWITCHBIND (CurrentViewport, false, false), switchTerminate },
- { "next_panel_button", "button", 0,
- SWITCHBIND (Panels, false, true), switchTerminate },
- { "next_panel_key", "key", 0,
- SWITCHBIND (Panels, false, true), switchTerminate },
- { "prev_panel_button", "button", 0,
- SWITCHBIND (Panels, false, false), switchTerminate },
- { "prev_panel_key", "key", 0,
- SWITCHBIND (Panels, false, false), switchTerminate },
- { "speed", "float", "<min>0.1</min>", 0, 0 },
- { "timestep", "float", "<min>0.1</min>", 0, 0 },
- { "window_match", "match", 0, 0, 0 },
- { "mipmap", "bool", 0, 0, 0 },
- { "saturation", "int", "<min>0</min><max>100</max>", 0, 0 },
- { "brightness", "int", "<min>0</min><max>100</max>", 0, 0 },
- { "opacity", "int", "<min>0</min><max>100</max>", 0, 0 },
- { "bring_to_front", "bool", 0, 0, 0 },
- { "zoom", "float", "<min>0</min>", 0, 0 },
- { "icon", "bool", 0, 0, 0 },
- { "minimized", "bool", 0, 0, 0 },
- { "auto_rotate", "bool", 0, 0, 0 }
-};
-
-#undef SWITCHBIND
-
void
SwitchScreen::windowRemove (Window id)
{
@@ -955,10 +903,8 @@ SwitchScreen::preparePaint (int msSinceLastPaint)
int steps, m;
float amount, chunk;
- amount = msSinceLastPaint * 0.05f *
- opt[SWITCH_OPTION_SPEED].value ().f ();
- steps = amount /
- (0.5f * opt[SWITCH_OPTION_TIMESTEP].value ().f ());
+ amount = msSinceLastPaint * 0.05f * optionGetSpeed ();
+ steps = amount / (0.5f * optionGetTimestep ());
if (!steps) steps = 1;
chunk = amount / (float) steps;
@@ -1053,7 +999,7 @@ SwitchScreen::glPaintOutput (const GLScreenPaintAttrib &sAttrib,
zoomMask = NORMAL_WINDOW_MASK;
}
- if (opt[SWITCH_OPTION_BRINGTOFRONT].value ().b ())
+ if (optionGetBringToFront ())
{
zoomed = screen->findWindow (zoomedWindow);
if (zoomed)
@@ -1258,7 +1204,7 @@ SwitchWindow::paintThumb (const GLWindowPaintAttrib &attrib,
glPopMatrix ();
- if (sScreen->opt[SWITCH_OPTION_ICON].value ().b ())
+ if (sScreen->optionGetIcon ())
{
icon = gWindow->getIcon (ICON_SIZE, ICON_SIZE);
if (icon)
@@ -1387,7 +1333,7 @@ SwitchWindow::glPaint (const GLWindowPaintAttrib &attrib,
filter = gScreen->textureFilter ();
- if (sScreen->opt[SWITCH_OPTION_MIPMAP].value ().b ())
+ if (sScreen->optionGetMipmap ())
gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
glPushAttrib (GL_SCISSOR_BIT);
@@ -1439,7 +1385,7 @@ SwitchWindow::glPaint (const GLWindowPaintAttrib &attrib,
}
else if (window->id () == sScreen->selectedWindow)
{
- if (sScreen->opt[SWITCH_OPTION_BRINGTOFRONT].value ().b () &&
+ if (sScreen->optionGetBringToFront () &&
sScreen->selectedWindow == sScreen->zoomedWindow)
zoomType = ZOOMED_WINDOW_MASK;
@@ -1454,23 +1400,23 @@ SwitchWindow::glPaint (const GLWindowPaintAttrib &attrib,
GLWindowPaintAttrib sAttrib (attrib);
GLuint value;
- value = sScreen->opt[SWITCH_OPTION_SATURATION].value ().i ();
+ value = sScreen->optionGetSaturation ();
if (value != 100)
sAttrib.saturation = sAttrib.saturation * value / 100;
- value = sScreen->opt[SWITCH_OPTION_BRIGHTNESS].value ().i ();
+ value = sScreen->optionGetBrightness ();
if (value != 100)
sAttrib.brightness = sAttrib.brightness * value / 100;
if (window->wmType () & ~(CompWindowTypeDockMask |
CompWindowTypeDesktopMask))
{
- value = sScreen->opt[SWITCH_OPTION_OPACITY].value ().i ();
+ value = sScreen->optionGetOpacity ();
if (value != 100)
sAttrib.opacity = sAttrib.opacity * value / 100;
}
- if (sScreen->opt[SWITCH_OPTION_BRINGTOFRONT].value ().b () &&
+ if (sScreen->optionGetBringToFront () &&
window->id () == sScreen->zoomedWindow)
zoomType = ZOOMED_WINDOW_MASK;
@@ -1520,53 +1466,26 @@ SwitchWindow::damageRect (bool initial, const CompRect &rect)
return status;
}
-CompOption::Vector &
-SwitchScreen::getOptions ()
-{
- return opt;
-}
-
-bool
-SwitchScreen::setOption (const char *name,
- CompOption::Value &value)
+void
+SwitchScreen::setZoom ()
{
- CompOption *o;
- unsigned int index;
-
- o = CompOption::findOption (opt, name, &index);
- if (!o)
- return false;
-
- switch (index) {
- case SWITCH_OPTION_ZOOM:
- if (o->set (value))
- {
- if (o->value ().f () < 0.05f)
- {
- zooming = false;
- zoom = 0.0f;
- }
- else
- {
- zooming = true;
- zoom = o->value ().f () / 30.0f;
- }
+ if (optionGetZoom () < 0.05f)
+ {
+ zooming = false;
+ zoom = 0.0f;
+ }
+ else
+ {
+ zooming = true;
+ zoom = optionGetZoom () / 30.0f;
+ }
- return true;
- }
- break;
- default:
- return CompOption::setOption (*o, value);
- }
-
- return false;
}
SwitchScreen::SwitchScreen (CompScreen *screen) :
PluginClassHandler<SwitchScreen,CompScreen> (screen),
cScreen (CompositeScreen::get (screen)),
gScreen (GLScreen::get (screen)),
- opt(SWITCH_OPTION_NUM),
popupWindow (None),
selectedWindow (None),
zoomedWindow (None),
@@ -1586,16 +1505,9 @@ SwitchScreen::SwitchScreen (CompScreen *screen) :
selection (CurrentViewport),
ignoreSwitcher (false)
{
- if (!switcherVTable->getMetadata ()->initOptions (switchOptionInfo,
- SWITCH_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
-
- zoom = opt[SWITCH_OPTION_ZOOM].value ().f () / 30.0f;
+ zoom = optionGetZoom () / 30.0f;
- zooming = (opt[SWITCH_OPTION_ZOOM].value ().f () > 0.05f);
+ zooming = (optionGetZoom () > 0.05f);
fgColor[0] = 0;
fgColor[1] = 0;
@@ -1607,6 +1519,47 @@ SwitchScreen::SwitchScreen (CompScreen *screen) :
selectFgColorAtom =
XInternAtom (screen->dpy (), DECOR_SWITCH_FOREGROUND_COLOR_ATOM_NAME, 0);
+ optionSetZoomNotify (boost::bind (&SwitchScreen::setZoom, this));
+
+#define SWITCHBIND(a,b,c) boost::bind (switchInitiateCommon, _1, _2, _3, a, b, c)
+
+ optionSetNextButtonInitiate (SWITCHBIND (CurrentViewport, true, true));
+ optionSetNextButtonTerminate (switchTerminate);
+ optionSetNextKeyInitiate (SWITCHBIND (CurrentViewport, true, true));
+ optionSetNextKeyTerminate (switchTerminate);
+ optionSetPrevButtonInitiate (SWITCHBIND (CurrentViewport, true, false));
+ optionSetPrevButtonTerminate (switchTerminate);
+ optionSetPrevKeyInitiate (SWITCHBIND (CurrentViewport, true, false));
+ optionSetPrevKeyTerminate (switchTerminate);
+
+ optionSetNextAllButtonInitiate (SWITCHBIND (AllViewports, true, true));
+ optionSetNextAllButtonTerminate (switchTerminate);
+ optionSetNextAllKeyInitiate (SWITCHBIND (AllViewports, true, true));
+ optionSetNextAllKeyTerminate (switchTerminate);
+ optionSetPrevAllButtonInitiate (SWITCHBIND (AllViewports, true, false));
+ optionSetPrevAllButtonTerminate (switchTerminate);
+ optionSetPrevAllKeyInitiate (SWITCHBIND (AllViewports, true, false));
+ optionSetPrevAllKeyTerminate (switchTerminate);
+
+ optionSetNextNoPopupButtonInitiate (SWITCHBIND (CurrentViewport, false, true));
+ optionSetNextNoPopupButtonTerminate (switchTerminate);
+ optionSetNextNoPopupKeyInitiate (SWITCHBIND (CurrentViewport, false, true));
+ optionSetNextNoPopupKeyTerminate (switchTerminate);
+ optionSetPrevNoPopupButtonInitiate (SWITCHBIND (CurrentViewport, false, false));
+ optionSetPrevNoPopupButtonTerminate (switchTerminate);
+ optionSetPrevNoPopupKeyInitiate (SWITCHBIND (CurrentViewport, false, false));
+ optionSetPrevNoPopupKeyTerminate (switchTerminate);
+
+ optionSetNextPanelButtonInitiate (SWITCHBIND (Panels, false, true));
+ optionSetNextPanelButtonTerminate (switchTerminate);
+ optionSetNextPanelKeyInitiate (SWITCHBIND (Panels, false, true));
+ optionSetNextPanelKeyTerminate (switchTerminate);
+ optionSetPrevPanelButtonInitiate (SWITCHBIND (Panels, false, false));
+ optionSetPrevPanelButtonTerminate (switchTerminate);
+ optionSetPrevPanelKeyInitiate (SWITCHBIND (Panels, false, false));
+ optionSetPrevPanelKeyTerminate (switchTerminate);
+
+#undef SWITCHBIND
ScreenInterface::setHandler (screen, false);
CompositeScreenInterface::setHandler (cScreen, false);
@@ -1627,9 +1580,6 @@ SwitchPluginVTable::init ()
!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
return false;
- getMetadata ()->addFromOptionInfo (switchOptionInfo, SWITCH_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/switcher/src/switcher.h b/plugins/switcher/src/switcher.h
index 7cd6f49..cb895a4 100644
--- a/plugins/switcher/src/switcher.h
+++ b/plugins/switcher/src/switcher.h
@@ -41,39 +41,11 @@
#include <X11/Xatom.h>
#include <X11/extensions/Xrender.h>
+#include "switcher_options.h"
+
#define ZOOMED_WINDOW_MASK (1 << 0)
#define NORMAL_WINDOW_MASK (1 << 1)
-#define SWITCH_OPTION_NEXT_BUTTON 0
-#define SWITCH_OPTION_NEXT_KEY 1
-#define SWITCH_OPTION_PREV_BUTTON 2
-#define SWITCH_OPTION_PREV_KEY 3
-#define SWITCH_OPTION_NEXT_ALL_BUTTON 4
-#define SWITCH_OPTION_NEXT_ALL_KEY 5
-#define SWITCH_OPTION_PREV_ALL_BUTTON 6
-#define SWITCH_OPTION_PREV_ALL_KEY 7
-#define SWITCH_OPTION_NEXT_NO_POPUP_BUTTON 8
-#define SWITCH_OPTION_NEXT_NO_POPUP_KEY 9
-#define SWITCH_OPTION_PREV_NO_POPUP_BUTTON 10
-#define SWITCH_OPTION_PREV_NO_POPUP_KEY 11
-#define SWITCH_OPTION_NEXT_PANEL_BUTTON 12
-#define SWITCH_OPTION_NEXT_PANEL_KEY 13
-#define SWITCH_OPTION_PREV_PANEL_BUTTON 14
-#define SWITCH_OPTION_PREV_PANEL_KEY 15
-#define SWITCH_OPTION_SPEED 16
-#define SWITCH_OPTION_TIMESTEP 17
-#define SWITCH_OPTION_WINDOW_MATCH 18
-#define SWITCH_OPTION_MIPMAP 19
-#define SWITCH_OPTION_SATURATION 20
-#define SWITCH_OPTION_BRIGHTNESS 21
-#define SWITCH_OPTION_OPACITY 22
-#define SWITCH_OPTION_BRINGTOFRONT 23
-#define SWITCH_OPTION_ZOOM 24
-#define SWITCH_OPTION_ICON 25
-#define SWITCH_OPTION_MINIMIZED 26
-#define SWITCH_OPTION_AUTO_ROTATE 27
-#define SWITCH_OPTION_NUM 28
-
enum SwitchWindowSelection{
CurrentViewport = 0,
AllViewports,
@@ -84,15 +56,15 @@ class SwitchScreen :
public ScreenInterface,
public CompositeScreenInterface,
public GLScreenInterface,
- public PluginClassHandler<SwitchScreen,CompScreen>
+ public PluginClassHandler<SwitchScreen,CompScreen>,
+ public SwitcherOptions
{
public:
SwitchScreen (CompScreen *screen);
~SwitchScreen ();
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
+ void setZoom ();
void handleEvent (XEvent *);
@@ -118,8 +90,6 @@ class SwitchScreen :
CompositeScreen *cScreen;
GLScreen *gScreen;
-
- CompOption::Vector opt;
Atom selectWinAtom;
Atom selectFgColorAtom;
@@ -230,9 +200,6 @@ class SwitchPluginVTable :
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (SwitchScreen);
-
};
diff --git a/plugins/switcher/switcher.xml.in b/plugins/switcher/switcher.xml.in
index dda448a..3ffb401 100644
--- a/plugins/switcher/switcher.xml.in
+++ b/plugins/switcher/switcher.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="switcher">
+ <plugin name="switcher" useBcop="true">
<_short>Application Switcher</_short>
<_long>Application Switcher</_long>
<deps>
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>
diff --git a/plugins/zoom/src/zoom.cpp b/plugins/zoom/src/zoom.cpp
index 74f6919..629ff41 100644
--- a/plugins/zoom/src/zoom.cpp
+++ b/plugins/zoom/src/zoom.cpp
@@ -25,7 +25,7 @@
#include "zoom.h"
-COMPIZ_PLUGIN_20081216 (zoom, ZoomPluginVTable)
+COMPIZ_PLUGIN_20090315 (zoom, ZoomPluginVTable)
static int
adjustZoomVelocity (ZoomScreen *zs)
@@ -90,8 +90,8 @@ ZoomScreen::preparePaint (int ms)
int steps;
float amount;
- amount = ms * 0.35f * opt[ZOOM_OPTION_SPEED].value ().f ();
- steps = amount / (0.5f * opt[ZOOM_OPTION_TIMESTEP].value ().f ());
+ amount = ms * 0.35f * optionGetSpeed ();
+ steps = amount / (0.5f * optionGetTimestep ());
if (!steps) steps = 1;
while (steps--)
@@ -187,7 +187,7 @@ ZoomScreen::glPaintOutput (const GLScreenPaintAttrib &sAttrib,
saveFilter = gScreen->filter (SCREEN_TRANS_FILTER);
if ((zoomOutput != output->id () || !adjust) && scale > 3.9f &&
- !opt[ZOOM_OPTION_FILTER_LINEAR].value ().b ())
+ !optionGetFilterLinear ())
gScreen->setFilter (SCREEN_TRANS_FILTER, GLTexture::Fast);
status = gScreen->glPaintOutput (sAttrib, zTransform, region, output,
@@ -366,10 +366,8 @@ zoomIn (CompAction *action,
box.y2 = screen->outputDevs ()[output].y2 ();
}
- w = (box.x2 - box.x1) /
- zs->opt[ZOOM_OPTION_ZOOM_FACTOR].value ().f ();
- h = (box.y2 - box.y1) /
- zs->opt[ZOOM_OPTION_ZOOM_FACTOR].value ().f ();
+ w = (box.x2 - box.x1) / zs->optionGetZoomFactor ();
+ h = (box.y2 - box.y1) / zs->optionGetZoomFactor ();
x0 = (pointerX - screen->outputDevs ()[output].x1 ()) / (float)
screen->outputDevs ()[output].width ();
@@ -688,43 +686,10 @@ ZoomScreen::handleEvent (XEvent *event)
screen->handleEvent (event);
}
-
-CompOption::Vector &
-ZoomScreen::getOptions ()
-{
- return opt;
-}
-
-bool
-ZoomScreen::setOption (const char *name,
- CompOption::Value &value)
-{
- CompOption *o;
- unsigned int index;
-
- o = CompOption::findOption (opt, name, &index);
- if (!o)
- return false;
-
- return CompOption::setOption (*o, value);
-}
-
-static const CompMetadata::OptionInfo zoomOptionInfo[] = {
- { "initiate_button", "button", 0, zoomInitiate, zoomTerminate },
- { "zoom_in_button", "button", 0, zoomIn, 0 },
- { "zoom_out_button", "button", 0, zoomOut, 0 },
- { "zoom_pan_button", "button", 0, zoomInitiatePan, zoomTerminatePan },
- { "speed", "float", "<min>0.1</min>", 0, 0 },
- { "timestep", "float", "<min>0.1</min>", 0, 0 },
- { "zoom_factor", "float", "<min>1.01</min>", 0, 0 },
- { "filter_linear", "bool", 0, 0, 0 }
-};
-
ZoomScreen::ZoomScreen (CompScreen *screen) :
PluginClassHandler<ZoomScreen,CompScreen> (screen),
cScreen (CompositeScreen::get (screen)),
gScreen (GLScreen::get (screen)),
- opt(ZOOM_OPTION_NUM),
grabIndex (0),
grab (false),
zoomed (0),
@@ -734,18 +699,20 @@ ZoomScreen::ZoomScreen (CompScreen *screen) :
scale (0.0),
zoomOutput (0)
{
- if (!zoomVTable->getMetadata ()->initOptions (zoomOptionInfo,
- ZOOM_OPTION_NUM, opt))
- {
- setFailed ();
- return;
- }
-
panCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
memset (&current, 0, sizeof (current));
memset (&last, 0, sizeof (last));
+ optionSetInitiateButtonInitiate (zoomInitiate);
+ optionSetInitiateButtonTerminate (zoomTerminate);
+
+ optionSetZoomInButtonInitiate (zoomIn);
+ optionSetZoomOutButtonInitiate (zoomOut);
+
+ optionSetZoomPanButtonInitiate (zoomInitiatePan);
+ optionSetZoomPanButtonTerminate (zoomTerminatePan);
+
ScreenInterface::setHandler (screen, false);
CompositeScreenInterface::setHandler (cScreen, false);
GLScreenInterface::setHandler (gScreen, false);
@@ -766,9 +733,6 @@ ZoomPluginVTable::init ()
!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
return false;
- getMetadata ()->addFromOptionInfo (zoomOptionInfo, ZOOM_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/zoom/src/zoom.h b/plugins/zoom/src/zoom.h
index d292d9f..90e4449 100644
--- a/plugins/zoom/src/zoom.h
+++ b/plugins/zoom/src/zoom.h
@@ -37,15 +37,7 @@
#include <composite/composite.h>
#include <opengl/opengl.h>
-#define ZOOM_OPTION_INITIATE_BUTTON 0
-#define ZOOM_OPTION_IN_BUTTON 1
-#define ZOOM_OPTION_OUT_BUTTON 2
-#define ZOOM_OPTION_PAN_BUTTON 3
-#define ZOOM_OPTION_SPEED 4
-#define ZOOM_OPTION_TIMESTEP 5
-#define ZOOM_OPTION_ZOOM_FACTOR 6
-#define ZOOM_OPTION_FILTER_LINEAR 7
-#define ZOOM_OPTION_NUM 8
+#include "zoom_options.h"
#define ZOOM_SCREEN(s) \
ZoomScreen *zs = ZoomScreen::get (s)
@@ -61,16 +53,14 @@ class ZoomScreen :
public ScreenInterface,
public CompositeScreenInterface,
public GLScreenInterface,
- public PluginClassHandler<ZoomScreen,CompScreen>
+ public PluginClassHandler<ZoomScreen,CompScreen>,
+ public ZoomOptions
{
public:
ZoomScreen (CompScreen *screen);
~ZoomScreen ();
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value &value);
-
void handleEvent (XEvent *);
void preparePaint (int);
@@ -89,8 +79,6 @@ class ZoomScreen :
CompositeScreen *cScreen;
GLScreen *gScreen;
-
- CompOption::Vector opt;
float pointerSensitivity;
@@ -121,7 +109,4 @@ class ZoomPluginVTable :
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (ZoomScreen);
-
};
diff --git a/plugins/zoom/zoom.xml.in b/plugins/zoom/zoom.xml.in
index ff8bb5a..2214f1d 100644
--- a/plugins/zoom/zoom.xml.in
+++ b/plugins/zoom/zoom.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="zoom">
+ <plugin name="zoom" useBcop="true">
<_short>Zoom Desktop</_short>
<_long>Zoom and pan desktop cube</_long>
<deps>