From 079b1b13a039fd841ab2be0bbe0da486b15536a4 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Tue, 20 May 2008 18:55:32 -0700 Subject: if argument to :GoToWindow is too large, select the last window --- src/FocusControl.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/FocusControl.cc b/src/FocusControl.cc index c17b900..d094a55 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -168,18 +168,20 @@ void FocusControl::cycleFocus(const FocusableList &window_list, void FocusControl::goToWindowNumber(const FocusableList &winlist, int num, const ClientPattern *pat) { + Focusable *win = 0; Focusables::const_iterator it = winlist.clientList().begin(); Focusables::const_iterator it_end = winlist.clientList().end(); for (; it != it_end && num; ++it) { if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { num > 0 ? --num : ++num; - if (!num) { - (*it)->focus(); - if ((*it)->fbwindow()) - (*it)->fbwindow()->raise(); - } + win = *it; } } + if (win) { + win->focus(); + if (win->fbwindow()) + win->fbwindow()->raise(); + } } void FocusControl::addFocusBack(WinClient &client) { -- cgit v0.11.2