From d666bec238b6681cedd3f6094f2e0dd772c512f9 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 19 Jul 2006 07:31:39 +0000 Subject: preserve order of focused windows on restart --- ChangeLog | 3 +++ src/FocusControl.cc | 14 +++++++++++++- src/FocusControl.hh | 1 + src/Screen.cc | 1 + src/Workspace.cc | 2 -- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d0e461..195f5b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0rc3: +*06/07/19: + * Preserve order of focused windows on restart (Mark) + Workspace.cc Screen.cc FocusControl.cc/hh *06/07/16: * Fix a bug in Transparent.cc, (Henrik) #1362913 Fluxbox core dumps on Solaris diff --git a/src/FocusControl.cc b/src/FocusControl.cc index 6b4f64a..c4c441e 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -219,7 +219,8 @@ WinClient *FocusControl::lastFocusedWindow(FluxboxWindow &group, WinClient *igno void FocusControl::setScreenFocusedWindow(WinClient &win_client) { // raise newly focused window to the top of the focused list - if (!m_cycling_focus) { // don't change the order if we're cycling + // don't change the order if we're cycling or shutting down + if (!m_cycling_focus && !win_client.screen().isShuttingdown()) { m_focused_list.remove(&win_client); m_focused_list.push_front(&win_client); m_cycling_window = m_focused_list.begin(); @@ -334,6 +335,9 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) { } void FocusControl::removeClient(WinClient &client) { + if (client.screen().isShuttingdown()) + return; + WinClient *cyc = 0; if (m_cycling_window != m_focused_list.end() && m_cycling_window != m_creation_order_list.end()) cyc = *m_cycling_window; @@ -347,6 +351,14 @@ void FocusControl::removeClient(WinClient &client) { } } +void FocusControl::shutdown() { + FocusedWindows::iterator it = m_focused_list.begin(); + for (; it != m_focused_list.end(); ++it) { + if (*it && (*it)->fbwindow()) + (*it)->fbwindow()->restore(*it, true); + } +} + /** * This function is called whenever we aren't quite sure what * focus is meant to be, it'll make things right ;-) diff --git a/src/FocusControl.hh b/src/FocusControl.hh index 666ab3c..0e64de8 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh @@ -95,6 +95,7 @@ public: WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client); void removeClient(WinClient &client); + void shutdown(); static void revertFocus(BScreen &screen); // like revertFocus, but specifically related to this window (transients etc) diff --git a/src/Screen.cc b/src/Screen.cc index 20fc755..73af5e9 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1789,6 +1789,7 @@ void BScreen::shutdown() { rootWindow().setEventMask(NoEventMask); FbTk::App::instance()->sync(false); m_shutdown = true; + m_focus_control->shutdown(); for_each(m_workspaces_list.begin(), m_workspaces_list.end(), mem_fun(&Workspace::shutdown)); diff --git a/src/Workspace.cc b/src/Workspace.cc index dc9fd86..b5ffcb6 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -377,8 +377,6 @@ void Workspace::setName(const std::string &name) { void Workspace::shutdown() { // note: when the window dies it'll remove it self from the list while (!m_windowlist.empty()) { - // restore with remap on all clients in that window - m_windowlist.back()->restore(true); //delete window (the window removes it self from m_windowlist) delete m_windowlist.back(); } -- cgit v0.11.2