aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FocusControl.cc10
-rw-r--r--src/FocusControl.hh1
-rw-r--r--src/Screen.cc8
3 files changed, 14 insertions, 5 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index 61d6e87..21c243d 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -149,6 +149,11 @@ void FocusControl::addFocusBack(WinClient &client) {
149 m_creation_order_list.push_back(&client); 149 m_creation_order_list.push_back(&client);
150} 150}
151 151
152void FocusControl::addFocusFront(WinClient &client) {
153 m_focused_list.push_front(&client);
154 m_creation_order_list.push_back(&client);
155}
156
152// move all clients in given window to back of focused list 157// move all clients in given window to back of focused list
153void FocusControl::setFocusBack(FluxboxWindow *fbwin) { 158void FocusControl::setFocusBack(FluxboxWindow *fbwin) {
154 // do nothing if there are no windows open 159 // do nothing if there are no windows open
@@ -375,8 +380,9 @@ void FocusControl::removeClient(WinClient &client) {
375} 380}
376 381
377void FocusControl::shutdown() { 382void FocusControl::shutdown() {
378 FocusedWindows::iterator it = m_focused_list.begin(); 383 // restore windows backwards so they get put back correctly on restart
379 for (; it != m_focused_list.end(); ++it) { 384 FocusedWindows::reverse_iterator it = m_focused_list.rbegin();
385 for (; it != m_focused_list.rend(); ++it) {
380 if (*it && (*it)->fbwindow()) 386 if (*it && (*it)->fbwindow())
381 (*it)->fbwindow()->restore(*it, true); 387 (*it)->fbwindow()->restore(*it, true);
382 } 388 }
diff --git a/src/FocusControl.hh b/src/FocusControl.hh
index d38ede0..ee5fe95 100644
--- a/src/FocusControl.hh
+++ b/src/FocusControl.hh
@@ -85,6 +85,7 @@ public:
85 bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } 85 bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; }
86 bool isCycling() const { return m_cycling_focus; } 86 bool isCycling() const { return m_cycling_focus; }
87 void addFocusBack(WinClient &client); 87 void addFocusBack(WinClient &client);
88 void addFocusFront(WinClient &client);
88 void setFocusBack(FluxboxWindow *fbwin); 89 void setFocusBack(FluxboxWindow *fbwin);
89 90
90 FocusModel focusModel() const { return *m_focus_model; } 91 FocusModel focusModel() const { return *m_focus_model; }
diff --git a/src/Screen.cc b/src/Screen.cc
index 30cc4d3..7c0bed9 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1403,9 +1403,11 @@ FluxboxWindow *BScreen::createWindow(Window client) {
1403 } 1403 }
1404 } 1404 }
1405 1405
1406 // always put on end of focused list, if it gets focused it'll get pushed up 1406 // add the window to the focus list
1407 // there is only the one win client at this stage 1407 if (focusControl().focusNew())
1408 focusControl().addFocusBack(*winclient); 1408 focusControl().addFocusFront(*winclient);
1409 else
1410 focusControl().addFocusBack(*winclient);
1409 1411
1410 // we also need to check if another window expects this window to the left 1412 // we also need to check if another window expects this window to the left
1411 // and if so, then join it. 1413 // and if so, then join it.