diff options
-rw-r--r-- | src/fluxbox.cc | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 3fcf743..1bd4234 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: fluxbox.cc,v 1.60 2002/05/29 06:22:31 fluxgen Exp $ | 25 | // $Id: fluxbox.cc,v 1.61 2002/07/13 14:04:46 fluxgen Exp $ |
26 | 26 | ||
27 | //Use GNU extensions | 27 | //Use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -2437,14 +2437,14 @@ void Fluxbox::timeout(void) { | |||
2437 | reconfigure_wait = reread_menu_wait = false; | 2437 | reconfigure_wait = reread_menu_wait = false; |
2438 | } | 2438 | } |
2439 | 2439 | ||
2440 | 2440 | // set focused window | |
2441 | void Fluxbox::setFocusedWindow(FluxboxWindow *win) { | 2441 | void Fluxbox::setFocusedWindow(FluxboxWindow *win) { |
2442 | BScreen *old_screen = 0, *screen = 0; | 2442 | BScreen *old_screen = 0, *screen = 0; |
2443 | FluxboxWindow *old_win = 0; | 2443 | FluxboxWindow *old_win = 0; |
2444 | Toolbar *old_tbar = 0, *tbar = 0; | 2444 | Toolbar *old_tbar = 0, *tbar = 0; |
2445 | Workspace *old_wkspc = 0, *wkspc = 0; | 2445 | Workspace *old_wkspc = 0, *wkspc = 0; |
2446 | 2446 | ||
2447 | if (focused_window!=0) { | 2447 | if (focused_window != 0) { |
2448 | old_win = focused_window; | 2448 | old_win = focused_window; |
2449 | old_screen = old_win->getScreen(); | 2449 | old_screen = old_win->getScreen(); |
2450 | 2450 | ||
@@ -2455,22 +2455,29 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) { | |||
2455 | old_wkspc->menu()->setItemSelected(old_win->getWindowNumber(), false); | 2455 | old_wkspc->menu()->setItemSelected(old_win->getWindowNumber(), false); |
2456 | 2456 | ||
2457 | } | 2457 | } |
2458 | 2458 | ||
2459 | if (win && ! win->isIconic()) { | 2459 | if (win && ! win->isIconic()) { |
2460 | 2460 | // make sure we have a valid win pointer with a valid screen | |
2461 | screen = win->getScreen(); | 2461 | ScreenList::iterator winscreen = |
2462 | tbar = screen->getToolbar(); | 2462 | std::find(screenList.begin(), screenList.end(), |
2463 | wkspc = screen->getWorkspace(win->getWorkspaceNumber()); | 2463 | win->getScreen()); |
2464 | focused_window = win; | 2464 | if (winscreen == screenList.end()) |
2465 | win->setFocusFlag(True); | 2465 | focused_window = 0; // the window pointer wasn't valid, mark no window focused |
2466 | wkspc->menu()->setItemSelected(win->getWindowNumber(), true); | 2466 | else { |
2467 | 2467 | screen = *winscreen; | |
2468 | tbar = screen->getToolbar(); | ||
2469 | wkspc = screen->getWorkspace(win->getWorkspaceNumber()); | ||
2470 | focused_window = win; // update focused window | ||
2471 | win->setFocusFlag(True); // set focus flag | ||
2472 | // select this window in workspace menu | ||
2473 | wkspc->menu()->setItemSelected(win->getWindowNumber(), true); | ||
2474 | } | ||
2468 | } else | 2475 | } else |
2469 | focused_window = (FluxboxWindow *) 0; | 2476 | focused_window = (FluxboxWindow *) 0; |
2470 | 2477 | ||
2471 | if (tbar!=0) | 2478 | if (tbar != 0) |
2472 | tbar->redrawWindowLabel(True); | 2479 | tbar->redrawWindowLabel(True); |
2473 | if (screen!=0) | 2480 | if (screen != 0) |
2474 | screen->updateNetizenWindowFocus(); | 2481 | screen->updateNetizenWindowFocus(); |
2475 | 2482 | ||
2476 | if (old_tbar && old_tbar != tbar) | 2483 | if (old_tbar && old_tbar != tbar) |