diff options
author | markt <markt> | 2006-06-28 00:54:40 (GMT) |
---|---|---|
committer | markt <markt> | 2006-06-28 00:54:40 (GMT) |
commit | 03631ca98e7e20ff4b0b0f162e4720e0282dc7e4 (patch) | |
tree | e26bab1e7cdae944c1504ba4bccbda6fbdd76150 /src/FocusControl.cc | |
parent | 5459e88035ac09dee7af2169f1f8bc502311e2d4 (diff) | |
download | fluxbox-03631ca98e7e20ff4b0b0f162e4720e0282dc7e4.zip fluxbox-03631ca98e7e20ff4b0b0f162e4720e0282dc7e4.tar.bz2 |
Fix some focus issues on detach and restart
Diffstat (limited to 'src/FocusControl.cc')
-rw-r--r-- | src/FocusControl.cc | 24 |
1 files changed, 11 insertions, 13 deletions
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; | |||
38 | using std::string; | 38 | using std::string; |
39 | 39 | ||
40 | WinClient *FocusControl::s_focused_window = 0; | 40 | WinClient *FocusControl::s_focused_window = 0; |
41 | FluxboxWindow *FocusControl::s_focused_fbwindow = 0; | ||
41 | 42 | ||
42 | FocusControl::FocusControl(BScreen &screen): | 43 | FocusControl::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); |