-// -*- mode: C++; indent-tabs-mode: nil; -*-
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
// window.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
//
#include "epist.hh"
#include "screen.hh"
#include "window.hh"
-#include "../../src/XAtom.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) {
void XWindow::updateWMHints() {
XWMHints *hints;
+ // assume a window takes input if it doesnt specify
+ _can_focus = True;
+
if ((hints = XGetWMHints(_epist->getXDisplay(), _window)) != NULL) {
- _can_focus = hints->input;
+ if (hints->flags & InputHint)
+ _can_focus = hints->input;
XFree(hints);
- } else {
- // assume a window takes input if it doesnt specify
- _can_focus = True;
}
}
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))
}
-void XWindow::focus() const {
+void XWindow::focus(bool raise) const {
// this will cause the window to be uniconified also
- _xatom->sendClientMessage(_screen->rootWindow(), XAtom::net_active_window,
- _window);
-
- //XSetInputFocus(_epist->getXDisplay(), _window, None, CurrentTime);
+
+ if (raise) {
+ _xatom->sendClientMessage(_screen->rootWindow(), XAtom::net_active_window,
+ _window);
+ } else {
+ XSetInputFocus(_epist->getXDisplay(), _window, None, CurrentTime);
+ }
}