// make sure asserts fire if there is a problem
memset(_atoms, 0, sizeof(_atoms));
// make sure asserts fire if there is a problem
memset(_atoms, 0, sizeof(_atoms));
-void OBProperty::set(Window win, Atom atom, Atom type,
+void Property::set(Window win, Atom atom, Atom type,
unsigned char* data, int size, int nelements,
bool append) const
{
assert(win != None); assert(atom != None); assert(type != None);
assert(nelements == 0 || (nelements > 0 && data != (unsigned char *) 0));
assert(size == 8 || size == 16 || size == 32);
unsigned char* data, int size, int nelements,
bool append) const
{
assert(win != None); assert(atom != None); assert(type != None);
assert(nelements == 0 || (nelements > 0 && data != (unsigned char *) 0));
assert(size == 8 || size == 16 || size == 32);
- XChangeProperty(OBDisplay::display, win, atom, type, size,
+ XChangeProperty(**display, win, atom, type, size,
-void OBProperty::set(Window win, Atoms atom, Atoms type,
+void Property::set(Window win, Atoms atom, Atoms type,
-void OBProperty::set(Window win, Atoms atom, Atoms type,
+void Property::set(Window win, Atoms atom, Atoms type,
unsigned long value[], int elements) const
{
assert(atom >= 0 && atom < NUM_ATOMS);
unsigned long value[], int elements) const
{
assert(atom >= 0 && atom < NUM_ATOMS);
-void OBProperty::set(Window win, Atoms atom, StringType type,
- const std::string &value) const
+void Property::set(Window win, Atoms atom, StringType type,
+ const ustring &value) const
- case ascii: t = _atoms[Atom_String]; break;
- case utf8: t = _atoms[Atom_Utf8]; break;
+ case ascii: t = _atoms[Atom_String]; assert(!value.utf8()); break;
+ case utf8: t = _atoms[Atom_Utf8]; assert(value.utf8()); break;
set(win, _atoms[atom], t,
reinterpret_cast<unsigned char *>(const_cast<char *>(value.c_str())),
8, value.size() + 1, False); // add 1 to the size to include the null
set(win, _atoms[atom], t,
reinterpret_cast<unsigned char *>(const_cast<char *>(value.c_str())),
8, value.size() + 1, False); // add 1 to the size to include the null
-void OBProperty::set(Window win, Atoms atom, StringType type,
+void Property::set(Window win, Atoms atom, StringType type,
const StringVect &strings) const
{
assert(atom >= 0 && atom < NUM_ATOMS);
assert(type >= 0 && type < NUM_STRING_TYPE);
Atom t;
const StringVect &strings) const
{
assert(atom >= 0 && atom < NUM_ATOMS);
assert(type >= 0 && type < NUM_STRING_TYPE);
Atom t;
StringVect::const_iterator it = strings.begin();
const StringVect::const_iterator end = strings.end();
StringVect::const_iterator it = strings.begin();
const StringVect::const_iterator end = strings.end();
set(win, _atoms[atom], t,
reinterpret_cast<unsigned char *>(const_cast<char *>(value.c_str())),
set(win, _atoms[atom], t,
reinterpret_cast<unsigned char *>(const_cast<char *>(value.c_str())),
* property did not exist on the window, or has a different type/size format
* than the user tried to retrieve.
*/
* property did not exist on the window, or has a different type/size format
* than the user tried to retrieve.
*/
-bool OBProperty::get(Window win, Atom atom, Atom type,
+bool Property::get(Window win, Atom atom, Atom type,
- result = XGetWindowProperty(OBDisplay::display, win, atom, 0l, 1l,
+ result = XGetWindowProperty(**display, win, atom, 0l, 1l,
False, AnyPropertyType, &ret_type, &ret_size,
nelements, &ret_bytes, &c_val);
ret = (result == Success && ret_type == type && ret_size == size &&
False, AnyPropertyType, &ret_type, &ret_size,
nelements, &ret_bytes, &c_val);
ret = (result == Success && ret_type == type && ret_size == size &&
int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1;
if (remain > size/8 * (signed)maxread) // dont get more than the max
remain = size/8 * (signed)maxread;
int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1;
if (remain > size/8 * (signed)maxread) // dont get more than the max
remain = size/8 * (signed)maxread;
- result = XGetWindowProperty(OBDisplay::display, win, atom, 0l,
+ result = XGetWindowProperty(**display, win, atom, 0l,
remain, False, type, &ret_type, &ret_size,
nelements, &ret_bytes, &c_val);
ret = (result == Success && ret_type == type && ret_size == size &&
remain, False, type, &ret_type, &ret_size,
nelements, &ret_bytes, &c_val);
ret = (result == Success && ret_type == type && ret_size == size &&
-bool OBProperty::get(Window win, Atoms atom, Atoms type,
+bool Property::get(Window win, Atoms atom, Atoms type,
unsigned long *nelements,
unsigned long **value) const
{
unsigned long *nelements,
unsigned long **value) const
{
-bool OBProperty::get(Window win, Atoms atom, Atoms type,
+bool Property::get(Window win, Atoms atom, Atoms type,
-bool OBProperty::get(Window win, Atoms atom, StringType type,
- std::string *value) const
+bool Property::get(Window win, Atoms atom, StringType type,
+ ustring *value) const
if (get(win, atom, type, &n, &s)) {
*value = s[0];
return True;
if (get(win, atom, type, &n, &s)) {
*value = s[0];
return True;
-bool OBProperty::get(Window win, Atoms atom, StringType type,
- unsigned long *nelements, StringVect *strings) const
+bool Property::get(Window win, Atoms atom, StringType type,
+ unsigned long *nelements, StringVect *strings) const
std::string::const_iterator tmp = it; // current string.begin()
it = std::find(tmp, end, '\0'); // look for null between tmp and end
strings->push_back(std::string(tmp, it)); // s[tmp:it)
std::string::const_iterator tmp = it; // current string.begin()
it = std::find(tmp, end, '\0'); // look for null between tmp and end
strings->push_back(std::string(tmp, it)); // s[tmp:it)