From 16743aad06e7f8b6c2d3b0aab4311980ce06dc16 Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 13 Jan 2007 19:24:35 +0000 Subject: don't change focus order unless the user specifically focuses a window --- ChangeLog | 3 +++ src/FocusControl.cc | 7 ++++++- src/FocusControl.hh | 1 + src/Screen.cc | 2 +- src/Window.cc | 12 +++++++----- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1a6732..1955aa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0rc3: +*07/01/13: + * Only change focus order when user specifically focuses a window (Mark) + Screen.cc Window.cc FocusControl.cc/hh *07/01/11: * Added option to :Minimize key command to lower all windows in the same layer as the focused window -- syntax is `:Minimize (layer)' (Mark) diff --git a/src/FocusControl.cc b/src/FocusControl.cc index c5441dd..9c82e3e 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -39,6 +39,7 @@ using std::string; WinClient *FocusControl::s_focused_window = 0; FluxboxWindow *FocusControl::s_focused_fbwindow = 0; +bool FocusControl::s_reverting = false; FocusControl::FocusControl(BScreen &screen): m_screen(screen), @@ -242,7 +243,7 @@ void FocusControl::setScreenFocusedWindow(WinClient &win_client) { // raise newly focused window to the top of the focused list // don't change the order if we're cycling or shutting down - if (!m_cycling_focus && !win_client.screen().isShuttingdown()) { + if (!isCycling() && !m_screen.isShuttingdown() && !s_reverting) { m_focused_list.remove(&win_client); m_focused_list.push_front(&win_client); m_cycling_window = m_focused_list.begin(); @@ -396,6 +397,8 @@ void FocusControl::revertFocus(BScreen &screen) { if (screen.focusControl().isCycling()) return; + FocusControl::s_reverting = true; + WinClient *next_focus = screen.focusControl().lastFocusedWindow(screen.currentWorkspaceID()); @@ -412,6 +415,8 @@ void FocusControl::revertFocus(BScreen &screen) { break; } } + + FocusControl::s_reverting = false; } /* diff --git a/src/FocusControl.hh b/src/FocusControl.hh index 708b960..d38ede0 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh @@ -127,6 +127,7 @@ private: static WinClient *s_focused_window; static FluxboxWindow *s_focused_fbwindow; + static bool s_reverting; }; #endif // FOCUSCONTROL_HH diff --git a/src/Screen.cc b/src/Screen.cc index e4a58e3..89400fe 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1129,7 +1129,7 @@ void BScreen::changeWorkspaceID(unsigned int id) { currentWorkspace()->showAll(); - if (focused && (focused->isStuck() || focused->isMoving())) + if (focused && focused->isMoving()) focused->setInputFocus(); else FocusControl::revertFocus(*this); diff --git a/src/Window.cc b/src/Window.cc index ff005c3..a3a10c5 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1053,7 +1053,8 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { if (client.fbwindow() != this) return false; - m_screen.focusControl().setScreenFocusedWindow(client); + if (&client != m_client) + m_screen.focusControl().setScreenFocusedWindow(client); m_client = &client; m_client->raise(); m_client->focusSig().notify(); @@ -1432,6 +1433,11 @@ bool FluxboxWindow::setInputFocus() { if (! m_client->validateClient()) return false; + + // this needs to be here rather than setFocusFlag because + // FocusControl::revertFocus will return before FocusIn events arrive + m_screen.focusControl().setScreenFocusedWindow(*m_client); + #ifdef DEBUG cerr<<"FluxboxWindow::"<<__FUNCTION__<<" isModal() = "<isModal()<