X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FXAtom.hh;h=580b973c6e3f961e6eb3b81440c2ff48f8984008;hb=4e0fde35ac60dcf36c3180b1606abba84ccace34;hp=f73f75580c302c7f57e30f8e51e796955e568fa3;hpb=b8ee3dbc4565efb19338c5cf1948f0f4e2f24fd6;p=chaz%2Fopenbox diff --git a/src/XAtom.hh b/src/XAtom.hh index f73f7558..580b973c 100644 --- a/src/XAtom.hh +++ b/src/XAtom.hh @@ -32,8 +32,13 @@ class ScreenInfo; class XAtom { public: - enum AvailableAtoms { - // string type + enum Atoms { + // types + cardinal, + window, + pixmap, + atom, + string, utf8_string, #ifdef HAVE_GETPID @@ -102,16 +107,10 @@ public: NUM_ATOMS }; - enum AtomType { - Type_Cardinal, - Type_Atom, - Type_Window, - Type_Pixmap - }; - enum StringType { - Type_String, - Type_Utf8, + ansi, + utf8, + NUM_STRING_TYPE }; private: @@ -124,10 +123,10 @@ private: Atom create(const char *name) const; - void setValue(Window win, AvailableAtoms atom, Atom type, unsigned char *data, + void setValue(Window win, Atom atom, Atom type, unsigned char *data, int size, int nelements, bool append) const; - bool getValue(Window win, AvailableAtoms atom, Atom type, - unsigned long *nelements, unsigned char **value, + bool getValue(Window win, Atom atom, Atom type, + unsigned long &nelements, unsigned char **value, int size) const; // no copying!! @@ -142,29 +141,25 @@ public: // constructor. void setSupported(const ScreenInfo *screen); - void setValue(Window win, AvailableAtoms atom, AtomType type, - unsigned long value) const; - void setValue(Window win, AvailableAtoms atom, StringType type, - const std::string &value) const; - - void addValue(Window win, AvailableAtoms atom, AtomType type, - unsigned long value) const; - void addValue(Window win, AvailableAtoms atom, StringType type, + void setValue(Window win, Atoms atom, Atoms type, unsigned long value) const; + void setValue(Window win, Atoms atom, Atoms type, + unsigned long value[], int elements) const; + void setValue(Window win, Atoms atom, StringType type, const std::string &value) const; // the 'value' is allocated inside the function and // delete [] value needs to be called when you are done with it. // the 'value' array returned is null terminated, and has 'nelements' // elements in it plus the null. - bool getValue(Window win, AvailableAtoms atom, AtomType type, - unsigned long *nelements, unsigned long **value) const; - bool getValue(Window win, AvailableAtoms atom, StringType type, + bool getValue(Window win, Atoms atom, Atoms type, + unsigned long &nelements, unsigned long **value) const; + bool getValue(Window win, Atoms atom, StringType type, std::string &value) const; - void eraseValue(Window win, AvailableAtoms atom) const; + void eraseValue(Window win, Atoms atom) const; // temporary function!! remove when not used in blackbox.hh anymore!! - inline Atom getAtom(AvailableAtoms a) + inline Atom getAtom(Atoms a) { Atom ret = _atoms[a]; assert(ret != 0); return ret; } };