aboutsummaryrefslogtreecommitdiff
path: root/src/FocusControl.cc
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-06-30 20:10:29 (GMT)
committerMathias Gumz <akira@fluxbox.org>2016-07-01 17:42:28 (GMT)
commitea306493f95abd04cfa5b7653e3ad30a74b1985f (patch)
treef51e0977dc3bda87cd1a638a2915d44e136ddc0d /src/FocusControl.cc
parente85cf490355346d89f4f758d3193ed7199280793 (diff)
downloadfluxbox-ea306493f95abd04cfa5b7653e3ad30a74b1985f.zip
fluxbox-ea306493f95abd04cfa5b7653e3ad30a74b1985f.tar.bz2
re-fix alt+tab'bing through tabbed windows
commit 98313bf broke (i'm terribly sorry) this because m_cycling_last stores the first client in a tabgroup, thus cannot be abused for this purpose. So we explicitly store a value and btw. do it before sending the focus, ie. "in time" for sure instead of "for sure™"
Diffstat (limited to 'src/FocusControl.cc')
-rw-r--r--src/FocusControl.cc16
1 files changed, 11 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 }