X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fscreen.cc;h=475a96e20f95581b766e4aec3f44ece9e3580ccf;hb=8e601e4a64b37f333fc3a5f844e4d72d6f289415;hp=afe5b8d1e6b53e00f952dbceb45f7ca149ad1919;hpb=b4411cb1ef1c25a287181b570e974545e1010530;p=chaz%2Fopenbox diff --git a/util/epist/screen.cc b/util/epist/screen.cc index afe5b8d1..475a96e2 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -143,28 +143,36 @@ void screen::processEvent(const XEvent &e) { } void screen::handleKeypress(const XEvent &e) { - list::const_iterator it = _epist->actions().begin(); - list::const_iterator end = _epist->actions().end(); + ActionList::const_iterator it = _epist->actions().begin(); + ActionList::const_iterator end = _epist->actions().end(); for (; it != end; ++it) { if (e.xkey.keycode == it->keycode() && - e.xkey.state == it->modifierMask() ) - { + e.xkey.state == it->modifierMask()) { + switch (it->type()) { + case Action::nextWorkspace: + cycleWorkspace(true); + return; + + case Action::prevWorkspace: + cycleWorkspace(false); + return; + + case Action::changeWorkspace: + changeWorkspace(it->number()); + return; + } + + // these actions require an active window + if (_active != _clients.end()) { + XWindow *window = *_active; + switch (it->type()) { - case Action::nextWorkspace: - cycleWorkspace(true); - break; - case Action::prevWorkspace: - cycleWorkspace(false); - break; - case Action::changeWorkspace: - changeWorkspace(it->number()); - break; case Action::shade: - toggleShaded((*_active)->window()); - break; + window->shade(! window->shaded()); + return; } - break; } + } } } @@ -216,7 +224,8 @@ void screen::updateClientList() { if (it == end) { // didn't already exist if (doAddWindow(rootclients[i])) { cout << "Added window: 0x" << hex << rootclients[i] << dec << endl; - _clients.insert(insert_point, new XWindow(_epist, rootclients[i])); + _clients.insert(insert_point, new XWindow(_epist, this, + rootclients[i])); } } } @@ -291,8 +300,3 @@ void screen::cycleWorkspace(const bool forward) const { void screen::changeWorkspace(const int num) const { _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num); } - -void screen::toggleShaded(const Window win) const { - _xatom->sendClientMessage(_root, XAtom::net_wm_state, win, 2, - XAtom::net_wm_state_shaded); -}