// DEALINGS IN THE SOFTWARE.
#include "XAtom.h"
-#include "XDisplay.h"
-#include "XScreen.h"
+#include "openbox.h"
+#include "Screen.h"
#include "Util.h"
-XAtom::XAtom(const XDisplay *display) {
- _display = display->_display;
+XAtom::XAtom(Openbox &ob) {
+ _display = ob.getXDisplay();
#ifdef HAVE_GETPID
openbox_pid = getAtom("_BLACKBOX_PID");
net_wm_ping = getAtom("_NET_WM_PING");
- for (int s = 0, c = display->screenCount(); s < c; ++s)
- setSupported(display->screen(s));
+ for (unsigned int s = 0, c = ob.managedScreenCount(); s < c; ++s)
+ setSupported( static_cast<ScreenInfo*>(ob.getScreen(s)) );
}
/*
* Sets which atoms are supported for NETWM, by Openbox, on the root window.
*/
-void XAtom::setSupported(const XScreen *screen) {
+void XAtom::setSupported(const ScreenInfo *screen) {
// create the netwm support window
- Window w = XCreateSimpleWindow(_display, screen->rootWindow(),
+ Window w = XCreateSimpleWindow(_display, screen->getRootWindow(),
0, 0, 1, 1, 0, 0, 0);
ASSERT(w != None);
_support_windows.push_back(w);
/*
* 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,
const_cast<unsigned char*>
(reinterpret_cast<const unsigned char*>(value.c_str())),
/*
* 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,
const_cast<unsigned char*>
(reinterpret_cast<const unsigned char *>
/*
* Gets an string property's value from a window.
*/
-bool XAtom::getStringValue(Window win, Atom atom, unsigned long *nelements,
- std::string &value) const {
+bool XAtom::getStringValue(Window win, Atom atom, std::string &value) const {
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)
value = reinterpret_cast<char*>(data);
return ret;