diff options
Diffstat (limited to 'src/FocusControl.cc')
-rw-r--r-- | src/FocusControl.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index c17b900..3f8aac5 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -168,18 +168,24 @@ void FocusControl::cycleFocus(const FocusableList &window_list, | |||
168 | 168 | ||
169 | void FocusControl::goToWindowNumber(const FocusableList &winlist, int num, | 169 | void FocusControl::goToWindowNumber(const FocusableList &winlist, int num, |
170 | const ClientPattern *pat) { | 170 | const ClientPattern *pat) { |
171 | Focusables::const_iterator it = winlist.clientList().begin(); | 171 | Focusables list = winlist.clientList(); |
172 | Focusables::const_iterator it_end = winlist.clientList().end(); | 172 | if (num < 0) { |
173 | for (; it != it_end && num; ++it) { | 173 | list.reverse(); |
174 | num = -num; | ||
175 | } | ||
176 | Focusable *win = 0; | ||
177 | Focusables::const_iterator it = list.begin(), it_end = list.end(); | ||
178 | for (; num && it != it_end; ++it) { | ||
174 | if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { | 179 | if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { |
175 | num > 0 ? --num : ++num; | 180 | --num; |
176 | if (!num) { | 181 | win = *it; |
177 | (*it)->focus(); | ||
178 | if ((*it)->fbwindow()) | ||
179 | (*it)->fbwindow()->raise(); | ||
180 | } | ||
181 | } | 182 | } |
182 | } | 183 | } |
184 | if (win) { | ||
185 | win->focus(); | ||
186 | if (win->fbwindow()) | ||
187 | win->fbwindow()->raise(); | ||
188 | } | ||
183 | } | 189 | } |
184 | 190 | ||
185 | void FocusControl::addFocusBack(WinClient &client) { | 191 | void FocusControl::addFocusBack(WinClient &client) { |