diff options
author | fluxgen <fluxgen> | 2006-02-19 07:38:02 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2006-02-19 07:38:02 (GMT) |
commit | f503c6cbb0da3fff30ebeb151fe23a4b87a48f40 (patch) | |
tree | 64dc91004dca133c83de2f33e957b4b78b9de32c /src | |
parent | 018d248f09b11be8907ef8e4e9cd13a917050330 (diff) | |
download | fluxbox_paul-f503c6cbb0da3fff30ebeb151fe23a4b87a48f40.zip fluxbox_paul-f503c6cbb0da3fff30ebeb151fe23a4b87a48f40.tar.bz2 |
added safety counter for the loops in nextFocus
Diffstat (limited to 'src')
-rw-r--r-- | src/FocusControl.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index 6e98fc4..f0d19d2 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -1,4 +1,4 @@ | |||
1 | // FocusControl.hh | 1 | // FocusControl.cc |
2 | // Copyright (c) 2006 Fluxbox Team (fluxgen at fluxbox dot org) | 2 | // Copyright (c) 2006 Fluxbox Team (fluxgen at fluxbox dot org) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
@@ -252,7 +252,7 @@ void FocusControl::nextFocus(int opts) { | |||
252 | 252 | ||
253 | if (!(opts & CYCLELINEAR)) { | 253 | if (!(opts & CYCLELINEAR)) { |
254 | if (!m_cycling_focus) { | 254 | if (!m_cycling_focus) { |
255 | m_cycling_focus = True; | 255 | m_cycling_focus = true; |
256 | m_cycling_window = m_focused_list.begin(); | 256 | m_cycling_window = m_focused_list.begin(); |
257 | m_cycling_last = 0; | 257 | m_cycling_last = 0; |
258 | } else { | 258 | } else { |
@@ -263,11 +263,14 @@ void FocusControl::nextFocus(int opts) { | |||
263 | // that is on the same workspace | 263 | // that is on the same workspace |
264 | FocusedWindows::iterator it = m_cycling_window; | 264 | FocusedWindows::iterator it = m_cycling_window; |
265 | const FocusedWindows::iterator it_end = m_focused_list.end(); | 265 | const FocusedWindows::iterator it_end = m_focused_list.end(); |
266 | 266 | int safety_counter = 0; | |
267 | while (true) { | 267 | while (true) { |
268 | ++it; | 268 | ++it; |
269 | if (it == it_end) { | 269 | if (it == it_end) { |
270 | it = m_focused_list.begin(); | 270 | it = m_focused_list.begin(); |
271 | safety_counter++; | ||
272 | if (safety_counter > 3) | ||
273 | break; | ||
271 | } | 274 | } |
272 | // give up [do nothing] if we reach the current focused again | 275 | // give up [do nothing] if we reach the current focused again |
273 | if ((*it) == (*m_cycling_window)) { | 276 | if ((*it) == (*m_cycling_window)) { |
@@ -323,10 +326,15 @@ void FocusControl::nextFocus(int opts) { | |||
323 | continue; | 326 | continue; |
324 | } | 327 | } |
325 | 328 | ||
329 | int safety_counter = 0; | ||
326 | do { | 330 | do { |
327 | ++it; | 331 | ++it; |
328 | if (it == wins.end()) | 332 | if (it == wins.end()) { |
329 | it = wins.begin(); | 333 | it = wins.begin(); |
334 | safety_counter++; | ||
335 | if (safety_counter > 3) | ||
336 | break; | ||
337 | } | ||
330 | // see if the window should be skipped | 338 | // see if the window should be skipped |
331 | if (! (doSkipWindow((*it)->winClient(), opts) || !(*it)->setInputFocus()) ) | 339 | if (! (doSkipWindow((*it)->winClient(), opts) || !(*it)->setInputFocus()) ) |
332 | break; | 340 | break; |