aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2006-07-19 07:31:39 (GMT)
committermarkt <markt>2006-07-19 07:31:39 (GMT)
commitd666bec238b6681cedd3f6094f2e0dd772c512f9 (patch)
tree0080b342098c172c88af0b3880a15b705ca09858 /src
parent2732e23812eb6b7adbd5f9ad1e4a23d3db1f9655 (diff)
downloadfluxbox_paul-d666bec238b6681cedd3f6094f2e0dd772c512f9.zip
fluxbox_paul-d666bec238b6681cedd3f6094f2e0dd772c512f9.tar.bz2
preserve order of focused windows on restart
Diffstat (limited to 'src')
-rw-r--r--src/FocusControl.cc14
-rw-r--r--src/FocusControl.hh1
-rw-r--r--src/Screen.cc1
-rw-r--r--src/Workspace.cc2
4 files changed, 15 insertions, 3 deletions
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
219void FocusControl::setScreenFocusedWindow(WinClient &win_client) { 219void FocusControl::setScreenFocusedWindow(WinClient &win_client) {
220 220
221 // raise newly focused window to the top of the focused list 221 // raise newly focused window to the top of the focused list
222 if (!m_cycling_focus) { // don't change the order if we're cycling 222 // don't change the order if we're cycling or shutting down
223 if (!m_cycling_focus && !win_client.screen().isShuttingdown()) {
223 m_focused_list.remove(&win_client); 224 m_focused_list.remove(&win_client);
224 m_focused_list.push_front(&win_client); 225 m_focused_list.push_front(&win_client);
225 m_cycling_window = m_focused_list.begin(); 226 m_cycling_window = m_focused_list.begin();
@@ -334,6 +335,9 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) {
334} 335}
335 336
336void FocusControl::removeClient(WinClient &client) { 337void FocusControl::removeClient(WinClient &client) {
338 if (client.screen().isShuttingdown())
339 return;
340
337 WinClient *cyc = 0; 341 WinClient *cyc = 0;
338 if (m_cycling_window != m_focused_list.end() && m_cycling_window != m_creation_order_list.end()) 342 if (m_cycling_window != m_focused_list.end() && m_cycling_window != m_creation_order_list.end())
339 cyc = *m_cycling_window; 343 cyc = *m_cycling_window;
@@ -347,6 +351,14 @@ void FocusControl::removeClient(WinClient &client) {
347 } 351 }
348} 352}
349 353
354void FocusControl::shutdown() {
355 FocusedWindows::iterator it = m_focused_list.begin();
356 for (; it != m_focused_list.end(); ++it) {
357 if (*it && (*it)->fbwindow())
358 (*it)->fbwindow()->restore(*it, true);
359 }
360}
361
350/** 362/**
351 * This function is called whenever we aren't quite sure what 363 * This function is called whenever we aren't quite sure what
352 * focus is meant to be, it'll make things right ;-) 364 * 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:
95 WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client); 95 WinClient *lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client);
96 96
97 void removeClient(WinClient &client); 97 void removeClient(WinClient &client);
98 void shutdown();
98 99
99 static void revertFocus(BScreen &screen); 100 static void revertFocus(BScreen &screen);
100 // like revertFocus, but specifically related to this window (transients etc) 101 // 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() {
1789 rootWindow().setEventMask(NoEventMask); 1789 rootWindow().setEventMask(NoEventMask);
1790 FbTk::App::instance()->sync(false); 1790 FbTk::App::instance()->sync(false);
1791 m_shutdown = true; 1791 m_shutdown = true;
1792 m_focus_control->shutdown();
1792 for_each(m_workspaces_list.begin(), 1793 for_each(m_workspaces_list.begin(),
1793 m_workspaces_list.end(), 1794 m_workspaces_list.end(),
1794 mem_fun(&Workspace::shutdown)); 1795 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) {
377void Workspace::shutdown() { 377void Workspace::shutdown() {
378 // note: when the window dies it'll remove it self from the list 378 // note: when the window dies it'll remove it self from the list
379 while (!m_windowlist.empty()) { 379 while (!m_windowlist.empty()) {
380 // restore with remap on all clients in that window
381 m_windowlist.back()->restore(true);
382 //delete window (the window removes it self from m_windowlist) 380 //delete window (the window removes it self from m_windowlist)
383 delete m_windowlist.back(); 381 delete m_windowlist.back();
384 } 382 }