aboutsummaryrefslogtreecommitdiff
path: root/src/FocusControl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FocusControl.cc')
-rw-r--r--src/FocusControl.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index 8706752..47a0a71 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -169,16 +169,15 @@ void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat,
169 169
170void FocusControl::goToWindowNumber(Focusables &winlist, int num, 170void FocusControl::goToWindowNumber(Focusables &winlist, int num,
171 const ClientPattern *pat) { 171 const ClientPattern *pat) {
172 Focusable *last_matched = 0;
172 if (num > 0) { 173 if (num > 0) {
173 Focusables::iterator it = winlist.begin(); 174 Focusables::iterator it = winlist.begin();
174 Focusables::iterator it_end = winlist.end(); 175 Focusables::iterator it_end = winlist.end();
175 for (; it != it_end; ++it) { 176 for (; it != it_end; ++it) {
176 if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { 177 if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) {
177 --num; 178 --num;
178 if (!num) { 179 last_matched = *it;
179 (*it)->focus(); 180 if (!num) break;
180 return;
181 }
182 } 181 }
183 } 182 }
184 } else if (num < 0) { 183 } else if (num < 0) {
@@ -187,13 +186,12 @@ void FocusControl::goToWindowNumber(Focusables &winlist, int num,
187 for (; it != it_end; ++it) { 186 for (; it != it_end; ++it) {
188 if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { 187 if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) {
189 ++num; 188 ++num;
190 if (!num) { 189 last_matched = *it;
191 (*it)->focus(); 190 if (!num) break;
192 return;
193 }
194 } 191 }
195 } 192 }
196 } 193 }
194 if (last_matched) last_matched->focus();
197} 195}
198 196
199void FocusControl::addFocusBack(WinClient &client) { 197void FocusControl::addFocusBack(WinClient &client) {