Fix some focus issues on detach and restart
markt markt
5 files changed,
20 insertions(+),
15 deletions(-)
M
ChangeLog
→
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
M
src/FocusControl.cc
→
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 @@ cerr<<"title: "<<client->fbwindow()->title()<<endl;
cerr<<"Current Focused window = "<<s_focused_window<<endl; cerr<<"------------------"<<endl; #endif // DEBUG - - WinClient *old_client = 0; // Update the old focused client to non focus // check if s_focused_window is valid if (s_focused_window != 0 && Fluxbox::instance()->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);
M
src/FocusControl.hh
→
src/FocusControl.hh
@@ -120,6 +120,7 @@ bool m_cycling_creation_order;
WinClient *m_cycling_last; static WinClient *s_focused_window; + static FluxboxWindow *s_focused_fbwindow; }; #endif // FOCUSCONTROL_HH
M
src/Screen.cc
→
src/Screen.cc
@@ -1361,6 +1361,7 @@ FluxboxWindow *win;
if ((win = findGroupLeft(*winclient)) != 0) { win->attachClient(*winclient); Fluxbox::instance()->attachSignals(*winclient); + focusControl().addFocusBack(*winclient); } else { Fluxbox::instance()->attachSignals(*winclient);
M
src/Window.cc
→
src/Window.cc
@@ -766,7 +766,6 @@ // m_client must be valid as there should be at least one other window
// 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 @@ if (numClients() <= 1)
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 @@ // since just detached, move relative to old location
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