diff options
-rw-r--r-- | src/FocusControl.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index f0d88b9..3be7937 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -239,7 +239,11 @@ void FocusControl::stopCyclingFocus() { | |||
239 | 239 | ||
240 | // put currently focused window to top | 240 | // put currently focused window to top |
241 | if (s_focused_window) { | 241 | if (s_focused_window) { |
242 | setScreenFocusedWindow(*s_focused_window); | 242 | // re-focus last window to give the client a chance to redistribute the |
243 | // focus internally (client-side only modality) | ||
244 | s_focused_window->focus(); | ||
245 | if (s_focused_window) | ||
246 | setScreenFocusedWindow(*s_focused_window); | ||
243 | if (s_focused_fbwindow) | 247 | if (s_focused_fbwindow) |
244 | s_focused_fbwindow->raise(); | 248 | s_focused_fbwindow->raise(); |
245 | } else | 249 | } else |
@@ -574,6 +578,16 @@ void FocusControl::setFocusedWindow(WinClient *client) { | |||
574 | return; | 578 | return; |
575 | 579 | ||
576 | BScreen *screen = client ? &client->screen() : 0; | 580 | BScreen *screen = client ? &client->screen() : 0; |
581 | if (screen && screen->focusControl().isCycling()) { | ||
582 | WinClient *last = screen->focusControl().m_cycling_last; | ||
583 | if (last && last != client && screen->focusControl().m_cycling_list->contains(*last)) { | ||
584 | // if we're currently cycling and the client tries to juggle around focus | ||
585 | // on FocusIn events to provide client-side modality - don't let him | ||
586 | last->focus(); | ||
587 | return; | ||
588 | } | ||
589 | } | ||
590 | |||
577 | BScreen *old_screen = | 591 | BScreen *old_screen = |
578 | FocusControl::focusedWindow() ? | 592 | FocusControl::focusedWindow() ? |
579 | &FocusControl::focusedWindow()->screen() : 0; | 593 | &FocusControl::focusedWindow()->screen() : 0; |