all repos — fluxbox @ c7ddf2e4e566a1587c9276a0f71f71d2a72ff014

custom fork of the fluxbox windowmanager

fix negative arguments to :GoToWindow
Mark Tiefenbruck mark@fluxbox.org
commit

c7ddf2e4e566a1587c9276a0f71f71d2a72ff014

parent

079b1b13a039fd841ab2be0bbe0da486b15536a4

1 files changed, 8 insertions(+), 4 deletions(-)

jump to
M src/FocusControl.ccsrc/FocusControl.cc

@@ -168,12 +168,16 @@ }

void FocusControl::goToWindowNumber(const FocusableList &winlist, int num, const ClientPattern *pat) { + Focusables list = winlist.clientList(); + if (num < 0) { + list.reverse(); + num = -num; + } Focusable *win = 0; - Focusables::const_iterator it = winlist.clientList().begin(); - Focusables::const_iterator it_end = winlist.clientList().end(); - for (; it != it_end && num; ++it) { + Focusables::const_iterator it = list.begin(), it_end = list.end(); + for (; num && it != it_end; ++it) { if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { - num > 0 ? --num : ++num; + --num; win = *it; } }