summaryrefslogtreecommitdiff
path: root/src/FocusControl.cc
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/FocusControl.cc
parent2732e23812eb6b7adbd5f9ad1e4a23d3db1f9655 (diff)
downloadfluxbox_lack-d666bec238b6681cedd3f6094f2e0dd772c512f9.zip
fluxbox_lack-d666bec238b6681cedd3f6094f2e0dd772c512f9.tar.bz2
preserve order of focused windows on restart
Diffstat (limited to 'src/FocusControl.cc')
-rw-r--r--src/FocusControl.cc14
1 files changed, 13 insertions, 1 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 ;-)