added safety counter for the loops in nextFocus
This commit is contained in:
parent
018d248f09
commit
f503c6cbb0
1 changed files with 12 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
// FocusControl.hh
|
// FocusControl.cc
|
||||||
// Copyright (c) 2006 Fluxbox Team (fluxgen at fluxbox dot org)
|
// Copyright (c) 2006 Fluxbox Team (fluxgen at fluxbox dot org)
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
@ -252,7 +252,7 @@ void FocusControl::nextFocus(int opts) {
|
||||||
|
|
||||||
if (!(opts & CYCLELINEAR)) {
|
if (!(opts & CYCLELINEAR)) {
|
||||||
if (!m_cycling_focus) {
|
if (!m_cycling_focus) {
|
||||||
m_cycling_focus = True;
|
m_cycling_focus = true;
|
||||||
m_cycling_window = m_focused_list.begin();
|
m_cycling_window = m_focused_list.begin();
|
||||||
m_cycling_last = 0;
|
m_cycling_last = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -263,11 +263,14 @@ void FocusControl::nextFocus(int opts) {
|
||||||
// that is on the same workspace
|
// that is on the same workspace
|
||||||
FocusedWindows::iterator it = m_cycling_window;
|
FocusedWindows::iterator it = m_cycling_window;
|
||||||
const FocusedWindows::iterator it_end = m_focused_list.end();
|
const FocusedWindows::iterator it_end = m_focused_list.end();
|
||||||
|
int safety_counter = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
++it;
|
++it;
|
||||||
if (it == it_end) {
|
if (it == it_end) {
|
||||||
it = m_focused_list.begin();
|
it = m_focused_list.begin();
|
||||||
|
safety_counter++;
|
||||||
|
if (safety_counter > 3)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// give up [do nothing] if we reach the current focused again
|
// give up [do nothing] if we reach the current focused again
|
||||||
if ((*it) == (*m_cycling_window)) {
|
if ((*it) == (*m_cycling_window)) {
|
||||||
|
@ -323,10 +326,15 @@ void FocusControl::nextFocus(int opts) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int safety_counter = 0;
|
||||||
do {
|
do {
|
||||||
++it;
|
++it;
|
||||||
if (it == wins.end())
|
if (it == wins.end()) {
|
||||||
it = wins.begin();
|
it = wins.begin();
|
||||||
|
safety_counter++;
|
||||||
|
if (safety_counter > 3)
|
||||||
|
break;
|
||||||
|
}
|
||||||
// see if the window should be skipped
|
// see if the window should be skipped
|
||||||
if (! (doSkipWindow((*it)->winClient(), opts) || !(*it)->setInputFocus()) )
|
if (! (doSkipWindow((*it)->winClient(), opts) || !(*it)->setInputFocus()) )
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue