diff options
-rw-r--r-- | src/FocusControl.cc | 16 | ||||
-rw-r--r-- | src/FocusControl.hh | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index f59b5ff..716883b 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -86,6 +86,7 @@ FocusControl::FocusControl(BScreen &screen): | |||
86 | m_cycling_list(0), | 86 | m_cycling_list(0), |
87 | m_was_iconic(0), | 87 | m_was_iconic(0), |
88 | m_cycling_last(0), | 88 | m_cycling_last(0), |
89 | m_cycling_next(0), | ||
89 | m_ignore_mouse_x(-1), m_ignore_mouse_y(-1) { | 90 | m_ignore_mouse_x(-1), m_ignore_mouse_y(-1) { |
90 | 91 | ||
91 | m_cycling_window = m_focused_list.clientList().end(); | 92 | m_cycling_window = m_focused_list.clientList().end(); |
@@ -101,6 +102,7 @@ void FocusControl::cycleFocus(const FocusableList &window_list, | |||
101 | m_cycling_list = &window_list; | 102 | m_cycling_list = &window_list; |
102 | m_was_iconic = 0; | 103 | m_was_iconic = 0; |
103 | m_cycling_last = 0; | 104 | m_cycling_last = 0; |
105 | m_cycling_next = 0; | ||
104 | } else if (m_cycling_list != &window_list) | 106 | } else if (m_cycling_list != &window_list) |
105 | m_cycling_list = &window_list; | 107 | m_cycling_list = &window_list; |
106 | 108 | ||
@@ -140,7 +142,7 @@ void FocusControl::cycleFocus(const FocusableList &window_list, | |||
140 | was_iconic = (fbwin->isIconic() ? last_client : 0); | 142 | was_iconic = (fbwin->isIconic() ? last_client : 0); |
141 | 143 | ||
142 | // now we actually try to focus the window | 144 | // now we actually try to focus the window |
143 | if (!doSkipWindow(**it, pat) && (*it)->focus()) | 145 | if (!doSkipWindow(**it, pat) && (m_cycling_next = *it) && (*it)->focus()) |
144 | break; | 146 | break; |
145 | } | 147 | } |
146 | m_cycling_window = it; | 148 | m_cycling_window = it; |
@@ -235,6 +237,7 @@ void FocusControl::stopCyclingFocus() { | |||
235 | return; | 237 | return; |
236 | 238 | ||
237 | m_cycling_last = 0; | 239 | m_cycling_last = 0; |
240 | m_cycling_next = 0; | ||
238 | m_cycling_list = 0; | 241 | m_cycling_list = 0; |
239 | 242 | ||
240 | // put currently focused window to top | 243 | // put currently focused window to top |
@@ -461,8 +464,11 @@ void FocusControl::removeClient(WinClient &client) { | |||
461 | *m_cycling_window == &client) { | 464 | *m_cycling_window == &client) { |
462 | m_cycling_window = m_cycling_list->clientList().end(); | 465 | m_cycling_window = m_cycling_list->clientList().end(); |
463 | stopCyclingFocus(); | 466 | stopCyclingFocus(); |
464 | } else if (m_cycling_last == &client) | 467 | } else if (m_cycling_last == &client) { |
465 | m_cycling_last = 0; | 468 | m_cycling_last = 0; |
469 | } else if (m_cycling_next == &client) { | ||
470 | m_cycling_next = 0; | ||
471 | } | ||
466 | 472 | ||
467 | m_focused_list.remove(client); | 473 | m_focused_list.remove(client); |
468 | m_creation_order_list.remove(client); | 474 | m_creation_order_list.remove(client); |
@@ -579,11 +585,11 @@ void FocusControl::setFocusedWindow(WinClient *client) { | |||
579 | 585 | ||
580 | BScreen *screen = client ? &client->screen() : 0; | 586 | BScreen *screen = client ? &client->screen() : 0; |
581 | if (screen && screen->focusControl().isCycling()) { | 587 | if (screen && screen->focusControl().isCycling()) { |
582 | WinClient *last = screen->focusControl().m_cycling_last; | 588 | Focusable *next = screen->focusControl().m_cycling_next; |
583 | if (last && last != client && screen->focusControl().m_cycling_list->contains(*last)) { | 589 | if (next && next != client && screen->focusControl().m_cycling_list->contains(*next)) { |
584 | // if we're currently cycling and the client tries to juggle around focus | 590 | // 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 | 591 | // on FocusIn events to provide client-side modality - don't let him |
586 | last->focus(); | 592 | next->focus(); |
587 | return; | 593 | return; |
588 | } | 594 | } |
589 | } | 595 | } |
diff --git a/src/FocusControl.hh b/src/FocusControl.hh index d583d16..2289481 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh | |||
@@ -180,6 +180,7 @@ private: | |||
180 | const FocusableList *m_cycling_list; | 180 | const FocusableList *m_cycling_list; |
181 | Focusable *m_was_iconic; | 181 | Focusable *m_was_iconic; |
182 | WinClient *m_cycling_last; | 182 | WinClient *m_cycling_last; |
183 | Focusable *m_cycling_next; | ||
183 | int m_ignore_mouse_x, m_ignore_mouse_y; | 184 | int m_ignore_mouse_x, m_ignore_mouse_y; |
184 | 185 | ||
185 | static WinClient *s_focused_window; | 186 | static WinClient *s_focused_window; |