diff options
-rw-r--r-- | include/core/option.h | 10 | ||||
-rw-r--r-- | include/core/screen.h | 10 | ||||
-rw-r--r-- | src/option.cpp | 7 | ||||
-rw-r--r-- | src/screen.cpp | 11 |
4 files changed, 23 insertions, 15 deletions
diff --git a/include/core/option.h b/include/core/option.h index d058755..a67744b 100644 --- a/include/core/option.h +++ b/include/core/option.h @@ -140,6 +140,16 @@ class CompOption { typedef std::vector<CompOption> Vector; + class Class { + public: + virtual Vector & getOptions () const = 0; + + virtual CompOption * getOption (const CompString &name) const; + + virtual bool setOption (const CompString &name, + Value &value) = 0; + }; + public: CompOption (); CompOption (const CompOption &); diff --git a/include/core/screen.h b/include/core/screen.h index 29467d2..93a0d9c 100644 --- a/include/core/screen.h +++ b/include/core/screen.h @@ -127,7 +127,8 @@ class ScreenInterface : public WrapableInterface<CompScreen, ScreenInterface> { class CompScreen : public CompSize, public WrapableHandler<ScreenInterface, 17>, - public PluginClassStorage + public PluginClassStorage, + public CompOption::Class { public: @@ -162,12 +163,9 @@ class CompScreen : Display * dpy(); - CompOption::Vector & getOptions (); - - CompOption * getOption (const char *); + CompOption::Vector & getOptions () const; - bool setOption (const char *name, - CompOption::Value &value); + bool setOption (const CompString &name, CompOption::Value &value); bool XRandr (); diff --git a/src/option.cpp b/src/option.cpp index 0140812..d90fbfc 100644 --- a/src/option.cpp +++ b/src/option.cpp @@ -582,6 +582,13 @@ CompOption::Restriction::operator= (const CompOption::Restriction &rest) } CompOption * +CompOption::Class::getOption (const CompString &name) const +{ + CompOption *o = CompOption::findOption (getOptions (), name); + return o; +} + +CompOption * CompOption::findOption (CompOption::Vector &options, CompString name, unsigned int *index) diff --git a/src/screen.cpp b/src/screen.cpp index e4c0f07..9090ddb 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -625,13 +625,6 @@ CompScreen::dpy () return priv->dpy; } -CompOption * -CompScreen::getOption (const char *name) -{ - CompOption *o = CompOption::findOption (priv->opt, name); - return o; -} - bool CompScreen::XRandr () { @@ -744,13 +737,13 @@ PrivateScreen::handlePingTimeout () } CompOption::Vector & -CompScreen::getOptions () +CompScreen::getOptions () const { return priv->opt; } bool -CompScreen::setOption (const char *name, +CompScreen::setOption (const CompString &name, CompOption::Value &value) { CompOption *o; |