From e35670d4a6a1ace394ff13cae39e41c2171b9054 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 26 Jan 2007 17:21:44 +0000 Subject: opening window on different workspace should put it at front of focused list with focusnew --- ChangeLog | 5 +++++ src/FocusControl.cc | 10 ++++++++-- src/FocusControl.hh | 1 + src/Screen.cc | 8 +++++--- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c9ea69..256b72d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ (Format: Year/Month/Day) Changes for 1.0rc3: +*07/01/26: + * Opening a window on a different workspace with Focus New Windows enabled + should focus the window when you get to that workspace -- as a free bonus, + stacking order should be more stable on fluxbox restart (Mark) + Screen.cc FocusControl.cc/hh *07/01/25: * Don't raise any windows above OverrideRedirect windows, otherwise they eventually get pushed to the bottomm, bug #1447583 (Mark) 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) { m_creation_order_list.push_back(&client); } +void FocusControl::addFocusFront(WinClient &client) { + m_focused_list.push_front(&client); + m_creation_order_list.push_back(&client); +} + // move all clients in given window to back of focused list void FocusControl::setFocusBack(FluxboxWindow *fbwin) { // do nothing if there are no windows open @@ -375,8 +380,9 @@ void FocusControl::removeClient(WinClient &client) { } void FocusControl::shutdown() { - FocusedWindows::iterator it = m_focused_list.begin(); - for (; it != m_focused_list.end(); ++it) { + // restore windows backwards so they get put back correctly on restart + FocusedWindows::reverse_iterator it = m_focused_list.rbegin(); + for (; it != m_focused_list.rend(); ++it) { if (*it && (*it)->fbwindow()) (*it)->fbwindow()->restore(*it, true); } 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: bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } bool isCycling() const { return m_cycling_focus; } void addFocusBack(WinClient &client); + void addFocusFront(WinClient &client); void setFocusBack(FluxboxWindow *fbwin); 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) { } } - // always put on end of focused list, if it gets focused it'll get pushed up - // there is only the one win client at this stage - focusControl().addFocusBack(*winclient); + // add the window to the focus list + if (focusControl().focusNew()) + focusControl().addFocusFront(*winclient); + else + focusControl().addFocusBack(*winclient); // we also need to check if another window expects this window to the left // and if so, then join it. -- cgit v0.11.2