summaryrefslogtreecommitdiff
path: root/plugins/compiztoolbox
diff options
context:
space:
mode:
authorSam Spilsbury <SmSpillaz@gmail.com>2010-05-23 20:07:04 +0800
committerSam Spilsbury <SmSpillaz@gmail.com>2010-05-23 20:07:04 +0800
commita27614ff510929d8d7d8fa67216fb8dbd4aac82c (patch)
tree29c67c92c42e6976e6b3e3479b3d73bf8599b782 /plugins/compiztoolbox
parent79153214e2ba5898b6dd943d77bac6216a5d078d (diff)
downloadcompiz-with-glib-mainloop-a27614ff510929d8d7d8fa67216fb8dbd4aac82c.tar.gz
compiz-with-glib-mainloop-a27614ff510929d8d7d8fa67216fb8dbd4aac82c.tar.bz2
Use PropertyWriter in plugins which set window properties
Diffstat (limited to 'plugins/compiztoolbox')
-rw-r--r--plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h7
-rw-r--r--plugins/compiztoolbox/src/compiztoolbox.cpp36
2 files changed, 31 insertions, 12 deletions
diff --git a/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h b/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h
index b5171eb..7e6a99e 100644
--- a/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h
+++ b/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h
@@ -68,10 +68,11 @@ class PropertyWriter
{
public:
+ PropertyWriter ();
PropertyWriter (CompString propName,
CompOption::Vector &readTemplate);
- bool updateProperty (Window, CompOption::Vector &, bool);
+ bool updateProperty (Window, CompOption::Vector &, bool, int);
CompOption::Vector readProperty (Window);
void setReadTemplate (const CompOption::Vector &);
@@ -106,8 +107,8 @@ class BaseSwitchScreen
CompositeScreen *cScreen;
GLScreen *gScreen;
- Atom selectWinAtom;
- Atom selectFgColorAtom;
+ PropertyWriter selectWinAtom;
+ Atom selectFgColorAtom;
CountedList<CompWindow*> windows;
diff --git a/plugins/compiztoolbox/src/compiztoolbox.cpp b/plugins/compiztoolbox/src/compiztoolbox.cpp
index 7ff6995..bba1ca5 100644
--- a/plugins/compiztoolbox/src/compiztoolbox.cpp
+++ b/plugins/compiztoolbox/src/compiztoolbox.cpp
@@ -45,6 +45,10 @@ class CompizToolboxPluginVTable :
void fini ();
};
+PropertyWriter::PropertyWriter ()
+{
+}
+
PropertyWriter::PropertyWriter (CompString propName,
CompOption::Vector &readTemplate)
{
@@ -61,7 +65,8 @@ PropertyWriter::setReadTemplate (const CompOption::Vector &readTemplate)
bool
PropertyWriter::updateProperty (Window id,
CompOption::Vector &propertyData,
- bool remove)
+ bool remove,
+ int type)
{
int count = 0;
long int data[propertyData.size ()];
@@ -98,7 +103,7 @@ PropertyWriter::updateProperty (Window id,
}
XChangeProperty (screen->dpy (), id,
- mAtom, XA_CARDINAL, 32,
+ mAtom, type, 32,
PropModeReplace, (unsigned char *)data, 5);
}
@@ -260,13 +265,18 @@ void
BaseSwitchScreen::setSelectedWindowHint ()
{
Window selectedWindowId = None;
+ CompOption::Vector opts;
+ CompOption::Value v;
if (selectedWindow && !selectedWindow->destroyed ())
selectedWindowId = selectedWindow->id ();
- XChangeProperty (::screen->dpy (), popupWindow, selectWinAtom,
- XA_WINDOW, 32, PropModeReplace,
- (unsigned char *) &selectedWindowId, 1);
+ v = CompOption::Value ((int) selectedWindowId);
+ opts.resize (1);
+ opts.at (0).setName ("id", CompOption::TypeInt);
+ opts.at (0).set (v);
+
+ selectWinAtom.updateProperty (popupWindow, opts, false, XA_WINDOW);
}
void
@@ -798,17 +808,25 @@ BaseSwitchScreen::BaseSwitchScreen (CompScreen *screen) :
selection (CurrentViewport),
ignoreSwitcher (false)
{
+ CompOption::Vector atomTemplate;
+ CompOption::Value v;
+ CompOption o;
+
if (openGLAvailable)
{
cScreen = CompositeScreen::get (screen);
gScreen = GLScreen::get (screen);
}
+ o.setName ("id", CompOption::TypeInt);
+ atomTemplate.push_back (o);
+
+ selectWinAtom = PropertyWriter (CompString (DECOR_SWITCH_WINDOW_ATOM_NAME),
+ atomTemplate);
- selectWinAtom =
- XInternAtom (::screen->dpy (), DECOR_SWITCH_WINDOW_ATOM_NAME, 0);
- selectFgColorAtom =
- XInternAtom (::screen->dpy (), DECOR_SWITCH_FOREGROUND_COLOR_ATOM_NAME, 0);
+ selectFgColorAtom =
+ XInternAtom (::screen->dpy (),
+ DECOR_SWITCH_FOREGROUND_COLOR_ATOM_NAME, 0);
fgColor[0] = 0;
fgColor[1] = 0;