From c02da6ba204d674a9648712ab12976a5d9f530e0 Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 20 May 2007 02:50:15 +0000 Subject: little fixes for window focus on restart --- src/FocusControl.cc | 8 +++++--- src/Window.cc | 16 ++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/FocusControl.cc b/src/FocusControl.cc index d78f997..11ee0a7 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -278,8 +278,8 @@ Focusable *FocusControl::lastFocusedWindow(int workspace) { if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces()) return m_focused_list.front(); - Focusables::iterator it = m_focused_win_list.begin(); - Focusables::iterator it_end = m_focused_win_list.end(); + Focusables::iterator it = m_focused_list.begin(); + Focusables::iterator it_end = m_focused_list.end(); for (; it != it_end; ++it) { if ((*it)->fbwindow() && ((((int)(*it)->fbwindow()->workspaceNumber()) == workspace || @@ -472,6 +472,8 @@ void FocusControl::shutdown() { Focusables::reverse_iterator it = m_focused_list.rbegin(); for (; it != m_focused_list.rend(); ++it) { WinClient *client = dynamic_cast(*it); +if (client) +std::cerr << "FocusControl::shutdown: " << client->title() << std::endl; if (client && client->fbwindow()) client->fbwindow()->restore(client, true); } @@ -487,7 +489,7 @@ void FocusControl::revertFocus(BScreen &screen) { FocusControl::s_reverting = true; - Focusable *next_focus = + Focusable *next_focus = screen.focusControl().lastFocusedWindow(screen.currentWorkspaceID()); // if setting focus fails, or isn't possible, fallback correctly diff --git a/src/Window.cc b/src/Window.cc index a2200f0..68aef8d 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -546,7 +546,7 @@ void FluxboxWindow::init() { iconic = true; deiconify(false); // check if we should prevent this window from gaining focus - if (!allowsFocusFromClient()) + if (!allowsFocusFromClient() || Fluxbox::instance()->isStartup()) m_focused = false; } @@ -650,9 +650,10 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { frame().clientArea().height()); // right now, this block only happens with new windows or on restart - if (screen().focusControl().focusNew() || - Fluxbox::instance()->isStartup()) - focused_win = &client; + if (screen().focusControl().focusNew() && + !Fluxbox::instance()->isStartup()) + was_focused = true; + focused_win = screen().focusControl().focusNew() ? &client : m_client; client.saveBlackboxAttribs(m_blackbox_attrib); m_clientlist.push_back(&client); @@ -674,7 +675,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { if (!focused_win) focused_win = screen().focusControl().lastFocusedWindow(*this); if (focused_win) - focused_win->focus(); + setCurrentClient(*focused_win, false); } frame().reconfigure(); } @@ -1553,9 +1554,8 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { // focus new, OR if it's the only window on the workspace // but not on startup: focus will be handled after creating everything // we use m_focused as a signal to focus the window when mapped - if (was_iconic && !Fluxbox::instance()->isStartup() && - (screen().focusControl().focusNew() || m_client->isTransient() || - screen().currentWorkspace()->numberOfWindows() == 1)) + if (was_iconic && (screen().currentWorkspace()->numberOfWindows() == 1 || + screen().focusControl().focusNew() || m_client->isTransient())) m_focused = true; oplock = false; -- cgit v0.11.2