aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2006-06-28 00:54:40 (GMT)
committermarkt <markt>2006-06-28 00:54:40 (GMT)
commit03631ca98e7e20ff4b0b0f162e4720e0282dc7e4 (patch)
treee26bab1e7cdae944c1504ba4bccbda6fbdd76150
parent5459e88035ac09dee7af2169f1f8bc502311e2d4 (diff)
downloadfluxbox_pavel-03631ca98e7e20ff4b0b0f162e4720e0282dc7e4.zip
fluxbox_pavel-03631ca98e7e20ff4b0b0f162e4720e0282dc7e4.tar.bz2
Fix some focus issues on detach and restart
-rw-r--r--ChangeLog3
-rw-r--r--src/FocusControl.cc24
-rw-r--r--src/FocusControl.hh1
-rw-r--r--src/Screen.cc1
-rw-r--r--src/Window.cc6
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 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0rc2: 2Changes for 1.0rc2:
3*06/06/28:
4 * Fixed some focus issues on detach and restart (Mark)
5 Window.cc FocusControl.cc/hh Screen.cc
3*06/06/27: 6*06/06/27:
4 * Some minor cleaning (thanks Slava Semushin + Mikhail Gusarov) 7 * Some minor cleaning (thanks Slava Semushin + Mikhail Gusarov)
5 FbTk/StringUtil.hh/cc Remember.cc 8 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;
38using std::string; 38using std::string;
39 39
40WinClient *FocusControl::s_focused_window = 0; 40WinClient *FocusControl::s_focused_window = 0;
41FluxboxWindow *FocusControl::s_focused_fbwindow = 0;
41 42
42FocusControl::FocusControl(BScreen &screen): 43FocusControl::FocusControl(BScreen &screen):
43 m_screen(screen), 44 m_screen(screen),
@@ -473,37 +474,34 @@ void FocusControl::setFocusedWindow(WinClient *client) {
473 cerr<<"Current Focused window = "<<s_focused_window<<endl; 474 cerr<<"Current Focused window = "<<s_focused_window<<endl;
474 cerr<<"------------------"<<endl; 475 cerr<<"------------------"<<endl;
475#endif // DEBUG 476#endif // DEBUG
476
477 WinClient *old_client = 0;
478 477
479 // Update the old focused client to non focus 478 // Update the old focused client to non focus
480 // check if s_focused_window is valid 479 // check if s_focused_window is valid
481 if (s_focused_window != 0 && 480 if (s_focused_window != 0 &&
482 Fluxbox::instance()->validateClient(s_focused_window)) { 481 Fluxbox::instance()->validateClient(s_focused_window)) {
483 482
484 old_client = s_focused_window; 483 if (!client ||
485 if (old_client->fbwindow()) { 484 s_focused_fbwindow && client->fbwindow() != s_focused_fbwindow)
486 FluxboxWindow *old_win = old_client->fbwindow(); 485 s_focused_fbwindow->setFocusFlag(false);
487
488 if (!client || client->fbwindow() != old_win)
489 old_win->setFocusFlag(false);
490 }
491 486
492 } else { 487 } else {
493 s_focused_window = 0; 488 s_focused_window = 0;
489 s_focused_fbwindow = 0;
494 } 490 }
495 491
496 492
497 if (client && client->fbwindow() && !client->fbwindow()->isIconic()) { 493 if (client && client->fbwindow() && !client->fbwindow()->isIconic()) {
498 // screen should be ok 494 // screen should be ok
499 FluxboxWindow *win = client->fbwindow(); 495 s_focused_fbwindow = client->fbwindow();
500 s_focused_window = client; // update focused window 496 s_focused_window = client; // update focused window
501 win->setCurrentClient(*client, 497 s_focused_fbwindow->setCurrentClient(*client,
502 false); // don't set inputfocus 498 false); // don't set inputfocus
503 win->setFocusFlag(true); // set focus flag 499 s_focused_fbwindow->setFocusFlag(true); // set focus flag
504 500
505 } else 501 } else {
506 s_focused_window = 0; 502 s_focused_window = 0;
503 s_focused_fbwindow = 0;
504 }
507 505
508 // update AtomHandlers and/or other stuff... 506 // update AtomHandlers and/or other stuff...
509 Fluxbox::instance()->updateFocusedWindow(screen, old_screen); 507 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:
120 WinClient *m_cycling_last; 120 WinClient *m_cycling_last;
121 121
122 static WinClient *s_focused_window; 122 static WinClient *s_focused_window;
123 static FluxboxWindow *s_focused_fbwindow;
123}; 124};
124 125
125#endif // FOCUSCONTROL_HH 126#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) {
1361 if ((win = findGroupLeft(*winclient)) != 0) { 1361 if ((win = findGroupLeft(*winclient)) != 0) {
1362 win->attachClient(*winclient); 1362 win->attachClient(*winclient);
1363 Fluxbox::instance()->attachSignals(*winclient); 1363 Fluxbox::instance()->attachSignals(*winclient);
1364 focusControl().addFocusBack(*winclient);
1364 } else { 1365 } else {
1365 1366
1366 Fluxbox::instance()->attachSignals(*winclient); 1367 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) {
766 // otherwise this wouldn't be here (refer numClients() <= 1 return) 766 // otherwise this wouldn't be here (refer numClients() <= 1 return)
767 client.setFluxboxWindow(screen().createWindow(client)); 767 client.setFluxboxWindow(screen().createWindow(client));
768 m_client->raise(); 768 m_client->raise();
769 setInputFocus();
770 return true; 769 return true;
771} 770}
772 771
@@ -776,8 +775,10 @@ void FluxboxWindow::detachCurrentClient() {
776 return; 775 return;
777 WinClient &client = *m_client; 776 WinClient &client = *m_client;
778 detachClient(*m_client); 777 detachClient(*m_client);
779 if (client.fbwindow() != 0) 778 if (client.fbwindow() != 0) {
780 client.fbwindow()->show(); 779 client.fbwindow()->show();
780 FocusControl::setFocusedWindow(&client);
781 }
781} 782}
782 783
783/// removes client from client list, does not create new fluxboxwindow for it 784/// 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) {
3660 if (client.fbwindow() != 0) { 3661 if (client.fbwindow() != 0) {
3661 client.fbwindow()->move(frame().x() - m_last_resize_x + x, frame().y() - m_last_resize_y + y); 3662 client.fbwindow()->move(frame().x() - m_last_resize_x + x, frame().y() - m_last_resize_y + y);
3662 client.fbwindow()->show(); 3663 client.fbwindow()->show();
3664 FocusControl::setFocusedWindow(&client);
3663 } 3665 }
3664 } else if( attach_to_win == this && attach_to_win->isTabable()) { 3666 } else if( attach_to_win == this && attach_to_win->isTabable()) {
3665 //reording of tabs within a frame 3667 //reording of tabs within a frame