#include <X11/Xatom.h>
+#include <assert.h>
+
#include <algorithm>
#include "Util.hh"
string ret;
if (text_prop.value && text_prop.nitems > 0) {
- ret = (char *) text_prop.value;
- if (text_prop.encoding != XA_STRING) {
+ if (text_prop.encoding == XA_STRING) {
+ ret = (char *) text_prop.value;
+ } else {
text_prop.nitems = strlen((char *) text_prop.value);
char **list;
return ret;
}
+
+
+string itostring(unsigned long i) {
+ if (i == 0)
+ return string("0");
+
+ string tmp;
+ for (; i > 0; i /= 10)
+ tmp.insert(tmp.begin(), "0123456789"[i%10]);
+ return tmp;
+}
+
+
+string itostring(long i) {
+ if (i < 0) {
+ std::string tmp = itostring( (unsigned long) -i);
+ tmp.insert(tmp.begin(), '-');
+ return tmp;
+ } else
+ return itostring( (unsigned long) i);
+}