preserve order of focused windows on restart
markt markt
5 files changed,
18 insertions(+),
3 deletions(-)
M
src/FocusControl.cc
→
src/FocusControl.cc
@@ -219,7 +219,8 @@
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::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;@@ -344,6 +348,14 @@
if (cyc == &client) { m_cycling_window = m_creation_order_list.end(); stopCyclingFocus(); + } +} + +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); } }
M
src/FocusControl.hh
→
src/FocusControl.hh
@@ -95,6 +95,7 @@ WinClient *lastFocusedWindow(int workspace);
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)
M
src/Screen.cc
→
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));
M
src/Workspace.cc
→
src/Workspace.cc
@@ -377,8 +377,6 @@ */
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(); }