all repos — fluxbox @ f503c6cbb0da3fff30ebeb151fe23a4b87a48f40

custom fork of the fluxbox windowmanager

added safety counter for the loops in nextFocus
fluxgen fluxgen
commit

f503c6cbb0da3fff30ebeb151fe23a4b87a48f40

parent

018d248f09b11be8907ef8e4e9cd13a917050330

1 files changed, 12 insertions(+), 4 deletions(-)

jump to
M src/FocusControl.ccsrc/FocusControl.cc

@@ -1,4 +1,4 @@

-// FocusControl.hh +// FocusControl.cc // Copyright (c) 2006 Fluxbox Team (fluxgen at fluxbox dot org) // // Permission is hereby granted, free of charge, to any person obtaining a

@@ -252,7 +252,7 @@ return;

if (!(opts & CYCLELINEAR)) { if (!m_cycling_focus) { - m_cycling_focus = True; + m_cycling_focus = true; m_cycling_window = m_focused_list.begin(); m_cycling_last = 0; } else {

@@ -263,11 +263,14 @@ // if it is stacked, we want the highest window in the focused list

// that is on the same workspace FocusedWindows::iterator it = m_cycling_window; const FocusedWindows::iterator it_end = m_focused_list.end(); - + int safety_counter = 0; while (true) { ++it; if (it == it_end) { it = m_focused_list.begin(); + safety_counter++; + if (safety_counter > 3) + break; } // give up [do nothing] if we reach the current focused again if ((*it) == (*m_cycling_window)) {

@@ -323,10 +326,15 @@ for (; it != wins.end() && (*it) != focused_group; ++it)

continue; } + int safety_counter = 0; do { ++it; - if (it == wins.end()) + if (it == wins.end()) { it = wins.begin(); + safety_counter++; + if (safety_counter > 3) + break; + } // see if the window should be skipped if (! (doSkipWindow((*it)->winClient(), opts) || !(*it)->setInputFocus()) ) break;