diff options
Diffstat (limited to 'src/FocusControl.cc')
-rw-r--r-- | src/FocusControl.cc | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index 27f387c..d78f997 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -313,13 +313,28 @@ void FocusControl::setScreenFocusedWindow(WinClient &win_client) { | |||
313 | 313 | ||
314 | // raise newly focused window to the top of the focused list | 314 | // raise newly focused window to the top of the focused list |
315 | // don't change the order if we're cycling or shutting down | 315 | // don't change the order if we're cycling or shutting down |
316 | // don't change on startup, as it may add windows that aren't listed yet | 316 | if (!isCycling() && !m_screen.isShuttingdown() && !s_reverting) { |
317 | if (!isCycling() && !m_screen.isShuttingdown() && !s_reverting && | 317 | |
318 | !Fluxbox::instance()->isStartup()) { | 318 | // make sure client is in our list, or else we could end up adding it |
319 | m_focused_list.remove(&win_client); | 319 | Focusables::iterator it_begin = m_focused_list.begin(), |
320 | it_end = m_focused_list.end(); | ||
321 | Focusables::iterator it = find(it_begin, it_end, &win_client); | ||
322 | if (it == it_end) | ||
323 | return; | ||
324 | |||
325 | m_focused_list.erase(it); | ||
320 | m_focused_list.push_front(&win_client); | 326 | m_focused_list.push_front(&win_client); |
321 | m_focused_win_list.remove(win_client.fbwindow()); | 327 | |
322 | m_focused_win_list.push_front(win_client.fbwindow()); | 328 | // also check the fbwindow |
329 | it_begin = m_focused_win_list.begin(); | ||
330 | it_end = m_focused_win_list.end(); | ||
331 | it = find(it_begin, it_end, win_client.fbwindow()); | ||
332 | |||
333 | if (it != it_end) { | ||
334 | m_focused_win_list.erase(it); | ||
335 | m_focused_win_list.push_front(win_client.fbwindow()); | ||
336 | } | ||
337 | |||
323 | } | 338 | } |
324 | } | 339 | } |
325 | 340 | ||
@@ -465,9 +480,6 @@ void FocusControl::shutdown() { | |||
465 | /** | 480 | /** |
466 | * This function is called whenever we aren't quite sure what | 481 | * This function is called whenever we aren't quite sure what |
467 | * focus is meant to be, it'll make things right ;-) | 482 | * focus is meant to be, it'll make things right ;-) |
468 | * last_focused is set to something if we want to make use of the | ||
469 | * previously focused window (it must NOT be set focused now, it | ||
470 | * is probably dying). | ||
471 | */ | 483 | */ |
472 | void FocusControl::revertFocus(BScreen &screen) { | 484 | void FocusControl::revertFocus(BScreen &screen) { |
473 | if (s_reverting) | 485 | if (s_reverting) |
@@ -508,9 +520,8 @@ void FocusControl::revertFocus(BScreen &screen) { | |||
508 | * If unfocus_frame is true, we won't focus anything in the same frame | 520 | * If unfocus_frame is true, we won't focus anything in the same frame |
509 | * as the client. | 521 | * as the client. |
510 | * | 522 | * |
511 | * So, we first prefer to choose a transient parent, then the last | 523 | * So, we first prefer to choose the last client in this window, and if no luck |
512 | * client in this window, and if no luck (or unfocus_frame), then | 524 | * (or unfocus_frame), then we just use the normal revertFocus on the screen. |
513 | * we just use the normal revertFocus on the screen. | ||
514 | * | 525 | * |
515 | * assumption: client has focus | 526 | * assumption: client has focus |
516 | */ | 527 | */ |