X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fwindow.cc;h=505a0f87c393c18353c312c740615a2fb8184ea7;hb=f1b9e2168d8c1b03b0fcf0b6dd70aa46c513059d;hp=854297197012012b7bb7721a8f437a83032a406b;hpb=f44e3ed9a7232a38b454e293daee2f3e7009ad54;p=chaz%2Fopenbox diff --git a/util/epist/window.cc b/util/epist/window.cc index 85429719..505a0f87 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 // @@ -34,7 +34,7 @@ using std::dec; #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; @@ -130,12 +130,13 @@ void XWindow::updateNormalHints() { 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; } } @@ -261,12 +262,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); + } }