From 905f208007902dc64197240806e4bb519fab66f3 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 13 Apr 2007 18:08:39 +0000 Subject: fixed some focus issues with FocusNew off --- src/FocusControl.cc | 30 +++++++++--------------------- src/FocusControl.hh | 9 --------- src/Window.cc | 25 +++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/FocusControl.cc b/src/FocusControl.cc index 1a4d74d..27f387c 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -81,16 +81,6 @@ FocusControl::FocusControl(BScreen &screen): } -void FocusControl::cycleFocus(FocusedWindows &window_list, - const ClientPattern *pat, bool cycle_reverse) { - Focusables tmp_list; - FocusedWindows::iterator it = window_list.begin(); - FocusedWindows::iterator it_end = window_list.end(); - for (; it != it_end; ++it) - tmp_list.push_back(*it); - cycleFocus(tmp_list, pat, cycle_reverse); -} - void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat, bool cycle_reverse) { @@ -114,6 +104,7 @@ void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat, Focusables::iterator it = m_cycling_window; FluxboxWindow *fbwin = 0; WinClient *last_client = 0; + WinClient *was_iconic = 0; // find the next window in the list that works while (true) { @@ -135,14 +126,13 @@ void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat, // keep track of the originally selected window in a group last_client = &fbwin->winClient(); + was_iconic = (fbwin->isIconic() ? last_client : 0); // now we actually try to focus the window if (!doSkipWindow(**it, pat) && (*it)->focus()) break; } - m_cycling_window = it; - // if we're still in the same fbwin, there's nothing else to do if (m_cycling_last && m_cycling_last->fbwindow() == fbwin) return; @@ -161,12 +151,14 @@ void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat, } } - m_cycling_last = last_client; - if (fbwin->isIconic()) - m_was_iconic = m_cycling_last; - if (m_cycling_list) - // else window will raise itself (if desired) on FocusIn + if (isCycling()) fbwin->tempRaise(); + else + fbwin->raise(); + + m_cycling_window = it; + m_cycling_last = last_client; + m_was_iconic = was_iconic; } @@ -179,8 +171,6 @@ void FocusControl::goToWindowNumber(Focusables &winlist, int num, if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { --num; if (!num) { - if ((*it)->fbwindow() && (*it)->fbwindow()->isIconic()) - (*it)->fbwindow()->deiconify(); (*it)->focus(); return; } @@ -193,8 +183,6 @@ void FocusControl::goToWindowNumber(Focusables &winlist, int num, if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { ++num; if (!num) { - if ((*it)->fbwindow() && (*it)->fbwindow()->isIconic()) - (*it)->fbwindow()->deiconify(); (*it)->focus(); return; } diff --git a/src/FocusControl.hh b/src/FocusControl.hh index 69660f9..0790110 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh @@ -40,7 +40,6 @@ class BScreen; */ class FocusControl { public: - typedef std::list FocusedWindows; typedef std::list Focusables; /// main focus model enum FocusModel { @@ -81,14 +80,6 @@ public: void cycleFocus(Focusables &winlist, const ClientPattern *pat = 0, bool reverse = false); - /** - * Cycle focus for a set of windows. - * @param winlist the windowlist to cycle through - * @param pat pattern for matching focusables - * @param reverse reverse the cycle order - */ - void cycleFocus(FocusedWindows &winlist, const ClientPattern *pat = 0, - bool reverse = false); void goToWindowNumber(Focusables &winlist, int num, const ClientPattern *pat = 0); /// sets the focused window on a screen diff --git a/src/Window.cc b/src/Window.cc index d0f28ce..3b2d11a 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -769,14 +769,32 @@ void FluxboxWindow::nextClient() { if (numClients() <= 1) return; - screen().focusControl().cycleFocus(m_clientlist, 0); + ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), + m_client); + if (it == m_clientlist.end()) + return; + + ++it; + if (it == m_clientlist.end()) + it = m_clientlist.begin(); + + setCurrentClient(**it, isFocused()); } void FluxboxWindow::prevClient() { if (numClients() <= 1) return; - screen().focusControl().cycleFocus(m_clientlist, 0, true); + ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), + m_client); + if (it == m_clientlist.end()) + return; + + if (it == m_clientlist.begin()) + it = m_clientlist.end(); + --it; + + setCurrentClient(**it, isFocused()); } @@ -1357,6 +1375,9 @@ bool FluxboxWindow::focus() { screen().changeWorkspaceID(workspaceNumber()); } + if (isIconic()) + deiconify(); + // this needs to be here rather than setFocusFlag because // FocusControl::revertFocus will return before FocusIn events arrive m_screen.focusControl().setScreenFocusedWindow(*m_client); -- cgit v0.11.2