better string get/set
This commit is contained in:
parent
120d8e5ac3
commit
18bdbfaad2
2 changed files with 10 additions and 9 deletions
12
src/XAtom.cc
12
src/XAtom.cc
|
@ -182,7 +182,8 @@ void XAtom::setPixmapValue(Window win, Atom atom, Pixmap value) const {
|
||||||
/*
|
/*
|
||||||
* Set a string property value on a window.
|
* Set a string property value on a window.
|
||||||
*/
|
*/
|
||||||
void XAtom::setStringValue(Window win, Atom atom, std::string &value) const {
|
void XAtom::setStringValue(Window win, Atom atom,
|
||||||
|
const std::string &value) const {
|
||||||
setValue(win, atom, XA_STRING,
|
setValue(win, atom, XA_STRING,
|
||||||
const_cast<unsigned char*>
|
const_cast<unsigned char*>
|
||||||
(reinterpret_cast<const unsigned char*>(value.c_str())),
|
(reinterpret_cast<const unsigned char*>(value.c_str())),
|
||||||
|
@ -229,7 +230,8 @@ void XAtom::addPixmapValue(Window win, Atom atom, Pixmap value) const {
|
||||||
/*
|
/*
|
||||||
* Add characters to a string property value on a window.
|
* Add characters to a string property value on a window.
|
||||||
*/
|
*/
|
||||||
void XAtom::addStringValue(Window win, Atom atom, std::string &value) const {
|
void XAtom::addStringValue(Window win, Atom atom,
|
||||||
|
const std::string &value) const {
|
||||||
setValue(win, atom, XA_STRING,
|
setValue(win, atom, XA_STRING,
|
||||||
const_cast<unsigned char*>
|
const_cast<unsigned char*>
|
||||||
(reinterpret_cast<const unsigned char *>
|
(reinterpret_cast<const unsigned char *>
|
||||||
|
@ -328,10 +330,10 @@ bool XAtom::getPixmapValue(Window win, Atom atom, unsigned long *nelements,
|
||||||
/*
|
/*
|
||||||
* Gets an string property's value from a window.
|
* Gets an string property's value from a window.
|
||||||
*/
|
*/
|
||||||
bool XAtom::getStringValue(Window win, Atom atom, unsigned long *nelements,
|
bool XAtom::getStringValue(Window win, Atom atom, std::string &value) const {
|
||||||
std::string &value) const {
|
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
bool ret = XAtom::getValue(win, atom, XA_STRING, nelements, &data, 8);
|
unsigned long nelements;
|
||||||
|
bool ret = XAtom::getValue(win, atom, XA_STRING, &nelements, &data, 8);
|
||||||
if (ret)
|
if (ret)
|
||||||
value = reinterpret_cast<char*>(data);
|
value = reinterpret_cast<char*>(data);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -122,13 +122,13 @@ public:
|
||||||
void setAtomValue(Window win, Atom atom, Atom value) const;
|
void setAtomValue(Window win, Atom atom, Atom value) const;
|
||||||
void setWindowValue(Window win, Atom atom, Window value) const;
|
void setWindowValue(Window win, Atom atom, Window value) const;
|
||||||
void setPixmapValue(Window win, Atom atom, Pixmap value) const;
|
void setPixmapValue(Window win, Atom atom, Pixmap value) const;
|
||||||
void setStringValue(Window win, Atom atom, std::string &value) const;
|
void setStringValue(Window win, Atom atom, const std::string &value) const;
|
||||||
|
|
||||||
void addCardValue(Window win, Atom atom, long value) const; // 32-bit CARDINAL
|
void addCardValue(Window win, Atom atom, long value) const; // 32-bit CARDINAL
|
||||||
void addAtomValue(Window win, Atom atom, Atom value) const;
|
void addAtomValue(Window win, Atom atom, Atom value) const;
|
||||||
void addWindowValue(Window win, Atom atom, Window value) const;
|
void addWindowValue(Window win, Atom atom, Window value) const;
|
||||||
void addPixmapValue(Window win, Atom atom, Pixmap value) const;
|
void addPixmapValue(Window win, Atom atom, Pixmap value) const;
|
||||||
void addStringValue(Window win, Atom atom, std::string &value) const;
|
void addStringValue(Window win, Atom atom, const std::string &value) const;
|
||||||
|
|
||||||
// the 'value' is allocated inside the function and
|
// the 'value' is allocated inside the function and
|
||||||
// delete [] value needs to be called when you are done with it.
|
// delete [] value needs to be called when you are done with it.
|
||||||
|
@ -142,8 +142,7 @@ public:
|
||||||
Window **value) const;
|
Window **value) const;
|
||||||
bool getPixmapValue(Window win, Atom atom, unsigned long *nelements,
|
bool getPixmapValue(Window win, Atom atom, unsigned long *nelements,
|
||||||
Pixmap **value) const;
|
Pixmap **value) const;
|
||||||
bool getStringValue(Window win, Atom atom, unsigned long *nelements,
|
bool getStringValue(Window win, Atom atom, std::string &value) const;
|
||||||
std::string &value) const;
|
|
||||||
|
|
||||||
void eraseValue(Window win, Atom atom) const;
|
void eraseValue(Window win, Atom atom) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue