X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fwindow.cc;h=5d1690f00454d7a0162f7d230024c8d25a20abae;hb=38b124e1b86de0a7611ea66a90689cc6b9f8800e;hp=48df206c989b9c9dc18319fe4ae5e643e666e1bc;hpb=5b088be950ce6e6a496b573e81dabeb54bd740ef;p=chaz%2Fopenbox diff --git a/util/epist/window.cc b/util/epist/window.cc index 48df206c..5d1690f0 100644 --- a/util/epist/window.cc +++ b/util/epist/window.cc @@ -1,4 +1,4 @@ -// -*- 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 // @@ -36,6 +36,13 @@ using std::dec; #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) { @@ -44,6 +51,7 @@ XWindow::XWindow(epist *epist, screen *screen, Window window) XSelectInput(_epist->getXDisplay(), _window, PropertyChangeMask | StructureNotifyMask); + updateBlackboxAttributes(); updateNormalHints(); updateWMHints(); updateDimentions(); @@ -78,6 +86,23 @@ void XWindow::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; @@ -185,8 +210,10 @@ void XWindow::processEvent(const XEvent &e) { 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)) @@ -234,12 +261,15 @@ void XWindow::iconify() const { } -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); + } } @@ -436,3 +466,11 @@ void XWindow::maximize(Max max) const { break; } } + + +void XWindow::decorate(bool d) const { + _xatom->sendClientMessage(_screen->rootWindow(), + XAtom::blackbox_change_attributes, + _window, AttribDecoration, + 0, 0, 0, (d ? DecorNormal : DecorNone)); +}