- Atom t;
- switch (type) {
- case Type_Cardinal: t = XA_CARDINAL; break;
- case Type_Atom: t = XA_ATOM; break;
- case Type_Window: t = XA_WINDOW; break;
- case Type_Pixmap: t = XA_PIXMAP; break;
- default: assert(false); // unhandled AtomType
- }
- setValue(win, atom, t, reinterpret_cast<unsigned char*>(&value),
- 32, 1, false);
-}
-
-
-/*
- * Set a string property value on a window.
- */
-void XAtom::setValue(Window win, AvailableAtoms atom, StringType type,
- const std::string &value) const {
- Atom t;
- switch (type) {
- case Type_String: t = XA_STRING; break;
- case Type_Utf8: t = _atoms[utf8_string]; break;
- default: assert(false); // unhandled StringType
- }
- setValue(win, atom, t,
- const_cast<unsigned char*>
- (reinterpret_cast<const unsigned char*>(value.c_str())),
- 8, value.size(), false);
+ assert(atom >= 0 && atom < NUM_ATOMS);
+ assert(type >= 0 && type < NUM_ATOMS);
+ setValue(win, _atoms[atom], _atoms[type],
+ reinterpret_cast<unsigned char*>(&value), 32, 1, false);