all repos — openbox @ c9be3ee06121bc4d0dec3586918607f18dabdb89

openbox fork - make it a bit more like ryudo

added window cycling
Dana Jansens danakj@orodu.net
commit

c9be3ee06121bc4d0dec3586918607f18dabdb89

parent

8e601e4a64b37f333fc3a5f844e4d72d6f289415

4 files changed, 56 insertions(+), 7 deletions(-)

jump to
M util/epist/actions.hhutil/epist/actions.hh

@@ -39,7 +39,7 @@ iconify,

raiseWindow, lowerWindow, closeWindow, - shade, + toggleshade, moveWindowUp, moveWindowDown, moveWindowLeft,
M util/epist/epist.ccutil/epist/epist.cc

@@ -79,15 +79,23 @@

_actions.push_back(Action(Action::nextWorkspace, XKeysymToKeycode(getXDisplay(), XStringToKeysym("Tab")), - Mod1Mask)); + ControlMask)); _actions.push_back(Action(Action::prevWorkspace, XKeysymToKeycode(getXDisplay(), XStringToKeysym("Tab")), - ControlMask)); - _actions.push_back(Action(Action::shade, + ControlMask | ShiftMask)); + _actions.push_back(Action(Action::toggleshade, XKeysymToKeycode(getXDisplay(), XStringToKeysym("F5")), Mod1Mask)); + _actions.push_back(Action(Action::nextWindow, + XKeysymToKeycode(getXDisplay(), + XStringToKeysym("Tab")), + Mod1Mask)); + _actions.push_back(Action(Action::prevWindow, + XKeysymToKeycode(getXDisplay(), + XStringToKeysym("Tab")), + Mod1Mask | ShiftMask)); activateGrabs(); }
M util/epist/screen.ccutil/epist/screen.cc

@@ -157,6 +157,14 @@ case Action::prevWorkspace:

cycleWorkspace(false); return; + case Action::nextWindow: + cycleWindow(true); + return; + + case Action::prevWindow: + cycleWindow(false); + return; + case Action::changeWorkspace: changeWorkspace(it->number()); return;

@@ -167,7 +175,7 @@ if (_active != _clients.end()) {

XWindow *window = *_active; switch (it->type()) { - case Action::shade: + case Action::toggleshade: window->shade(! window->shaded()); return; }

@@ -274,6 +282,37 @@ perror("putenv()");

} */ + +void screen::cycleWindow(const bool forward) const { + if (_clients.empty()) return; + + WindowList::const_iterator target = _active; + + if (target == _clients.end()) + target = _clients.begin(); + + do { + if (forward) { + ++target; + if (target == _clients.end()) + target = _clients.begin(); + } else { + if (target == _clients.begin()) + target = _clients.end(); + --target; + } + } while (target == _clients.end() || (*target)->iconic()); + + if (target != _clients.end()) { + // we dont send an ACTIVE_WINDOW client message because that would also + // unshade the window if it was shaded + XSetInputFocus(_epist->getXDisplay(), (*target)->window(), RevertToNone, + CurrentTime); + XRaiseWindow(_epist->getXDisplay(), (*target)->window()); + } +} + + void screen::cycleWorkspace(const bool forward) const { unsigned long currentDesktop = 0; unsigned long numDesktops = 0;

@@ -296,6 +335,7 @@

changeWorkspace(currentDesktop); } } + void screen::changeWorkspace(const int num) const { _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
M util/epist/screen.hhutil/epist/screen.hh

@@ -65,8 +65,9 @@ void processEvent(const XEvent &e);

void handleKeypress(const XEvent &e); - void cycleWorkspace(const bool forward)const; - void changeWorkspace(const int num)const; + void cycleWindow(const bool forward) const; + void cycleWorkspace(const bool forward) const; + void changeWorkspace(const int num) const; void toggleShaded(const Window win) const; };