From 03631ca98e7e20ff4b0b0f162e4720e0282dc7e4 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 28 Jun 2006 00:54:40 +0000 Subject: Fix some focus issues on detach and restart --- ChangeLog | 3 +++ src/FocusControl.cc | 24 +++++++++++------------- src/FocusControl.hh | 1 + src/Screen.cc | 1 + src/Window.cc | 6 ++++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f7b251..10398e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0rc2: +*06/06/28: + * Fixed some focus issues on detach and restart (Mark) + Window.cc FocusControl.cc/hh Screen.cc *06/06/27: * Some minor cleaning (thanks Slava Semushin + Mikhail Gusarov) FbTk/StringUtil.hh/cc Remember.cc diff --git a/src/FocusControl.cc b/src/FocusControl.cc index ce61a4d..19d0bf8 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -38,6 +38,7 @@ using std::endl; using std::string; WinClient *FocusControl::s_focused_window = 0; +FluxboxWindow *FocusControl::s_focused_fbwindow = 0; FocusControl::FocusControl(BScreen &screen): m_screen(screen), @@ -473,37 +474,34 @@ void FocusControl::setFocusedWindow(WinClient *client) { cerr<<"Current Focused window = "<validateClient(s_focused_window)) { - old_client = s_focused_window; - if (old_client->fbwindow()) { - FluxboxWindow *old_win = old_client->fbwindow(); - - if (!client || client->fbwindow() != old_win) - old_win->setFocusFlag(false); - } + if (!client || + s_focused_fbwindow && client->fbwindow() != s_focused_fbwindow) + s_focused_fbwindow->setFocusFlag(false); } else { s_focused_window = 0; + s_focused_fbwindow = 0; } if (client && client->fbwindow() && !client->fbwindow()->isIconic()) { // screen should be ok - FluxboxWindow *win = client->fbwindow(); + s_focused_fbwindow = client->fbwindow(); s_focused_window = client; // update focused window - win->setCurrentClient(*client, + s_focused_fbwindow->setCurrentClient(*client, false); // don't set inputfocus - win->setFocusFlag(true); // set focus flag + s_focused_fbwindow->setFocusFlag(true); // set focus flag - } else + } else { s_focused_window = 0; + s_focused_fbwindow = 0; + } // update AtomHandlers and/or other stuff... Fluxbox::instance()->updateFocusedWindow(screen, old_screen); diff --git a/src/FocusControl.hh b/src/FocusControl.hh index fd8f56d..6a868a6 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh @@ -120,6 +120,7 @@ private: WinClient *m_cycling_last; static WinClient *s_focused_window; + static FluxboxWindow *s_focused_fbwindow; }; #endif // FOCUSCONTROL_HH diff --git a/src/Screen.cc b/src/Screen.cc index c6155fe..222f1fc 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1361,6 +1361,7 @@ FluxboxWindow *BScreen::createWindow(Window client) { if ((win = findGroupLeft(*winclient)) != 0) { win->attachClient(*winclient); Fluxbox::instance()->attachSignals(*winclient); + focusControl().addFocusBack(*winclient); } else { Fluxbox::instance()->attachSignals(*winclient); diff --git a/src/Window.cc b/src/Window.cc index 2016ab9..0ca7ba9 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -766,7 +766,6 @@ bool FluxboxWindow::detachClient(WinClient &client) { // otherwise this wouldn't be here (refer numClients() <= 1 return) client.setFluxboxWindow(screen().createWindow(client)); m_client->raise(); - setInputFocus(); return true; } @@ -776,8 +775,10 @@ void FluxboxWindow::detachCurrentClient() { return; WinClient &client = *m_client; detachClient(*m_client); - if (client.fbwindow() != 0) + if (client.fbwindow() != 0) { client.fbwindow()->show(); + FocusControl::setFocusedWindow(&client); + } } /// removes client from client list, does not create new fluxboxwindow for it @@ -3660,6 +3661,7 @@ void FluxboxWindow::attachTo(int x, int y, bool interrupted) { if (client.fbwindow() != 0) { client.fbwindow()->move(frame().x() - m_last_resize_x + x, frame().y() - m_last_resize_y + y); client.fbwindow()->show(); + FocusControl::setFocusedWindow(&client); } } else if( attach_to_win == this && attach_to_win->isTabable()) { //reording of tabs within a frame -- cgit v0.11.2