#include "window.hh"
#include "../../src/XAtom.hh"
+ // defined by black/openbox
+const unsigned long XWindow::PropBlackboxAttributesElements;
+const unsigned long XWindow::AttribDecoration;
+const unsigned long XWindow::DecorNone;
+const unsigned long XWindow::DecorNormal;
+
+
XWindow::XWindow(epist *epist, screen *screen, Window window)
: _epist(epist), _screen(screen), _xatom(epist->xatom()), _window(window) {
XSelectInput(_epist->getXDisplay(), _window,
PropertyChangeMask | StructureNotifyMask);
+ updateBlackboxAttributes();
updateNormalHints();
updateWMHints();
updateDimentions();
}
+void XWindow::updateBlackboxAttributes() {
+ unsigned long *data;
+ unsigned long num = PropBlackboxAttributesElements;
+
+ _decorated = true;
+
+ if (_xatom->getValue(_window,
+ XAtom::blackbox_attributes, XAtom::blackbox_attributes,
+ num, &data)) {
+ if (num == PropBlackboxAttributesElements)
+ if (data[0] & AttribDecoration)
+ _decorated = (data[4] != DecorNone);
+ delete data;
+ }
+}
+
+
void XWindow::updateNormalHints() {
XSizeHints size;
long ret;
case PropertyNotify:
if (e.xproperty.atom == XA_WM_NORMAL_HINTS)
updateNormalHints();
- if (e.xproperty.atom == XA_WM_HINTS)
+ else if (e.xproperty.atom == XA_WM_HINTS)
updateWMHints();
+ else if (e.xproperty.atom == _xatom->getAtom(XAtom::blackbox_attributes))
+ updateBlackboxAttributes();
else if (e.xproperty.atom == _xatom->getAtom(XAtom::net_wm_state))
updateState();
else if (e.xproperty.atom == _xatom->getAtom(XAtom::net_wm_desktop))
break;
}
}
+
+
+void XWindow::decorate(bool d) const {
+ _xatom->sendClientMessage(_screen->rootWindow(),
+ XAtom::blackbox_change_attributes,
+ _window, AttribDecoration,
+ 0, 0, 0, (d ? DecorNormal : DecorNone));
+}