14 #ifndef _PieDock_WindowManager_
15 #define _PieDock_WindowManager_
18 #include <X11/Xatom.h>
24 static int ignoreHandler( Display *, XErrorEvent * ) {
return True; }
51 static void activate( Display *, Window );
52 static void iconify( Display *, Window );
53 static void close( Display *, Window );
56 static std::string
getTitle( Display *, Window );
70 unsigned long = 0,
unsigned long = 0,
unsigned long = 0,
71 unsigned long = 0,
unsigned long = 0 );
72 static Atom
getAtom( Display *,
const char * );
78 template <
class T>
class Property
81 Property( Display *d, Window w ) :
86 Property( Display *d, Window w, Atom type,
88 Property( d, w ) { fetch( type, name ); }
89 virtual ~Property() { freeData(); }
90 inline T *getData()
const {
return data; }
91 inline unsigned long getItems()
const {
return items; }
92 bool fetch( Atom type,
const char *name,
93 long length = 1024,
long offset = 0,
101 unsigned long bytesAfter;
104 XErrorHandler defaultHandler =
105 XSetErrorHandler( ignoreHandler );
107 if( XGetWindowProperty(
122 XSetErrorHandler( defaultHandler );
124 if( returnedType != type )
130 this->data =
reinterpret_cast<T *
>( data );
147 XFree( reinterpret_cast<unsigned char *>( data ) );
154 typedef std::map<std::string, Atom> StringToAtom;
155 static StringToAtom stringToAtom;
158 WindowManager &operator=(
const WindowManager & ) {
return *
this; }