summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h7
-rw-r--r--plugins/compiztoolbox/src/compiztoolbox.cpp36
-rw-r--r--plugins/resize/CMakeLists.txt2
-rw-r--r--plugins/resize/resize.xml.in3
-rw-r--r--plugins/resize/src/resize.cpp55
-rw-r--r--plugins/resize/src/resize.h5
6 files changed, 78 insertions, 30 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;
diff --git a/plugins/resize/CMakeLists.txt b/plugins/resize/CMakeLists.txt
index 14fc915..ec8352d 100644
--- a/plugins/resize/CMakeLists.txt
+++ b/plugins/resize/CMakeLists.txt
@@ -2,4 +2,4 @@ find_package (Compiz REQUIRED)
include (CompizPlugin)
-compiz_plugin(resize PLUGINDEPS composite opengl) \ No newline at end of file
+compiz_plugin(resize PLUGINDEPS composite opengl compiztoolbox)
diff --git a/plugins/resize/resize.xml.in b/plugins/resize/resize.xml.in
index a28dfef..9076903 100644
--- a/plugins/resize/resize.xml.in
+++ b/plugins/resize/resize.xml.in
@@ -4,6 +4,9 @@
<_long>Resize window</_long>
<category>Window Management</category>
<deps>
+ <requirement>
+ <plugin>compiztoolbox</plugin>
+ </requirement>
<relation type="after">
<plugin>composite</plugin>
<plugin>opengl</plugin>
diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp
index fa28b8e..5f9a211 100644
--- a/plugins/resize/src/resize.cpp
+++ b/plugins/resize/src/resize.cpp
@@ -152,24 +152,39 @@ ResizeScreen::sendResizeNotify ()
void
ResizeScreen::updateWindowProperty ()
{
- unsigned long data[4];
+ CompOption::Vector data;
+ CompOption::Value v;
- data[0] = geometry.x;
- data[1] = geometry.y;
- data[2] = geometry.width;
- data[3] = geometry.height;
+ data.resize (4);
- XChangeProperty (screen->dpy (), w->id (), resizeInformationAtom,
- XA_CARDINAL, 32, PropModeReplace,
- (unsigned char*) data, 4);
+ v = geometry.x;
+ data.at (0).setName ("x", CompOption::TypeInt);
+ data.at (0).set (v);
+
+ v = geometry.y;
+ data.at (1).setName ("y", CompOption::TypeInt);
+ data.at (1).set (v);
+
+ v = geometry.width;
+ data.at (2).setName ("width", CompOption::TypeInt);
+ data.at (2).set (v);
+
+ v = geometry.height;
+ data.at (3).setName ("x", CompOption::TypeInt);
+ data.at (3).set (v);
+
+ fprintf (stderr, "update window property\n");
+
+ resizeInformationAtom.updateProperty (w->id (), data, false, XA_CARDINAL);
}
void
ResizeScreen::finishResizing ()
{
w->ungrabNotify ();
-
- XDeleteProperty (screen->dpy (), w->id (), resizeInformationAtom);
+ CompOption::Vector opts;
+
+ resizeInformationAtom.updateProperty (w->id (), opts, true, XA_CARDINAL);
w = NULL;
}
@@ -1283,13 +1298,23 @@ ResizeScreen::ResizeScreen (CompScreen *s) :
releaseButton (0),
isConstrained (false)
{
-
+ CompOption::Vector atomTemplate;
Display *dpy = s->dpy ();
+
+ atomTemplate.resize (4);
+
+ for (int i = 0; i < 4; i++)
+ {
+ char buf[4];
+ snprintf (buf, 4, "%i", i);
+ CompString tmpName (buf);
+
+ atomTemplate.at (i).setName (tmpName, CompOption::TypeInt);
+ }
- resizeNotifyAtom = XInternAtom (s->dpy (),
- "_COMPIZ_RESIZE_NOTIFY", 0);
- resizeInformationAtom = XInternAtom (s->dpy (),
- "_COMPIZ_RESIZE_INFORMATION", 0);
+ resizeNotifyAtom = XInternAtom (s->dpy (), "_COMPIZ_RESIZE_NOTIFY", 0);
+ resizeInformationAtom = PropertyWriter ("_COMPIZ_RESIZE_INFORMATION",
+ atomTemplate);
for (unsigned int i = 0; i < NUM_KEYS; i++)
key[i] = XKeysymToKeycode (s->dpy (), XStringToKeysym (rKeys[i].name));
diff --git a/plugins/resize/src/resize.h b/plugins/resize/src/resize.h
index ad32947..845396d 100644
--- a/plugins/resize/src/resize.h
+++ b/plugins/resize/src/resize.h
@@ -31,6 +31,7 @@
#include <composite/composite.h>
#include <opengl/opengl.h>
+#include <compiztoolbox/compiztoolbox.h>
#include "resize_options.h"
@@ -103,8 +104,8 @@ class ResizeScreen :
GLScreen *gScreen;
CompositeScreen *cScreen;
- Atom resizeNotifyAtom;
- Atom resizeInformationAtom;
+ Atom resizeNotifyAtom;
+ PropertyWriter resizeInformationAtom;
CompWindow *w;
int mode;