aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FocusControl.cc8
-rw-r--r--src/Window.cc16
2 files changed, 13 insertions, 11 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index d78f997..11ee0a7 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -278,8 +278,8 @@ Focusable *FocusControl::lastFocusedWindow(int workspace) {
278 if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces()) 278 if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces())
279 return m_focused_list.front(); 279 return m_focused_list.front();
280 280
281 Focusables::iterator it = m_focused_win_list.begin(); 281 Focusables::iterator it = m_focused_list.begin();
282 Focusables::iterator it_end = m_focused_win_list.end(); 282 Focusables::iterator it_end = m_focused_list.end();
283 for (; it != it_end; ++it) { 283 for (; it != it_end; ++it) {
284 if ((*it)->fbwindow() && 284 if ((*it)->fbwindow() &&
285 ((((int)(*it)->fbwindow()->workspaceNumber()) == workspace || 285 ((((int)(*it)->fbwindow()->workspaceNumber()) == workspace ||
@@ -472,6 +472,8 @@ void FocusControl::shutdown() {
472 Focusables::reverse_iterator it = m_focused_list.rbegin(); 472 Focusables::reverse_iterator it = m_focused_list.rbegin();
473 for (; it != m_focused_list.rend(); ++it) { 473 for (; it != m_focused_list.rend(); ++it) {
474 WinClient *client = dynamic_cast<WinClient *>(*it); 474 WinClient *client = dynamic_cast<WinClient *>(*it);
475if (client)
476std::cerr << "FocusControl::shutdown: " << client->title() << std::endl;
475 if (client && client->fbwindow()) 477 if (client && client->fbwindow())
476 client->fbwindow()->restore(client, true); 478 client->fbwindow()->restore(client, true);
477 } 479 }
@@ -487,7 +489,7 @@ void FocusControl::revertFocus(BScreen &screen) {
487 489
488 FocusControl::s_reverting = true; 490 FocusControl::s_reverting = true;
489 491
490 Focusable *next_focus = 492 Focusable *next_focus =
491 screen.focusControl().lastFocusedWindow(screen.currentWorkspaceID()); 493 screen.focusControl().lastFocusedWindow(screen.currentWorkspaceID());
492 494
493 // if setting focus fails, or isn't possible, fallback correctly 495 // if setting focus fails, or isn't possible, fallback correctly
diff --git a/src/Window.cc b/src/Window.cc
index a2200f0..68aef8d 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -546,7 +546,7 @@ void FluxboxWindow::init() {
546 iconic = true; 546 iconic = true;
547 deiconify(false); 547 deiconify(false);
548 // check if we should prevent this window from gaining focus 548 // check if we should prevent this window from gaining focus
549 if (!allowsFocusFromClient()) 549 if (!allowsFocusFromClient() || Fluxbox::instance()->isStartup())
550 m_focused = false; 550 m_focused = false;
551 } 551 }
552 552
@@ -650,9 +650,10 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
650 frame().clientArea().height()); 650 frame().clientArea().height());
651 651
652 // right now, this block only happens with new windows or on restart 652 // right now, this block only happens with new windows or on restart
653 if (screen().focusControl().focusNew() || 653 if (screen().focusControl().focusNew() &&
654 Fluxbox::instance()->isStartup()) 654 !Fluxbox::instance()->isStartup())
655 focused_win = &client; 655 was_focused = true;
656 focused_win = screen().focusControl().focusNew() ? &client : m_client;
656 657
657 client.saveBlackboxAttribs(m_blackbox_attrib); 658 client.saveBlackboxAttribs(m_blackbox_attrib);
658 m_clientlist.push_back(&client); 659 m_clientlist.push_back(&client);
@@ -674,7 +675,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
674 if (!focused_win) 675 if (!focused_win)
675 focused_win = screen().focusControl().lastFocusedWindow(*this); 676 focused_win = screen().focusControl().lastFocusedWindow(*this);
676 if (focused_win) 677 if (focused_win)
677 focused_win->focus(); 678 setCurrentClient(*focused_win, false);
678 } 679 }
679 frame().reconfigure(); 680 frame().reconfigure();
680} 681}
@@ -1553,9 +1554,8 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
1553 // focus new, OR if it's the only window on the workspace 1554 // focus new, OR if it's the only window on the workspace
1554 // but not on startup: focus will be handled after creating everything 1555 // but not on startup: focus will be handled after creating everything
1555 // we use m_focused as a signal to focus the window when mapped 1556 // we use m_focused as a signal to focus the window when mapped
1556 if (was_iconic && !Fluxbox::instance()->isStartup() && 1557 if (was_iconic && (screen().currentWorkspace()->numberOfWindows() == 1 ||
1557 (screen().focusControl().focusNew() || m_client->isTransient() || 1558 screen().focusControl().focusNew() || m_client->isTransient()))
1558 screen().currentWorkspace()->numberOfWindows() == 1))
1559 m_focused = true; 1559 m_focused = true;
1560 1560
1561 oplock = false; 1561 oplock = false;