Fix some focus issues on detach and restart

This commit is contained in:
markt 2006-06-28 00:54:40 +00:00
parent 5459e88035
commit 03631ca98e
5 changed files with 20 additions and 15 deletions

View file

@ -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

View file

@ -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 = "<<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);

View file

@ -120,6 +120,7 @@ private:
WinClient *m_cycling_last;
static WinClient *s_focused_window;
static FluxboxWindow *s_focused_fbwindow;
};
#endif // FOCUSCONTROL_HH

View file

@ -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);

View file

@ -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