From 84ca1f2e2f82b66b417b8e25295e37cb07985f3d Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 6 Jul 2006 04:10:34 +0000 Subject: re-fixing the focus after fixing the crash bug --- ChangeLog | 3 +++ src/FocusControl.cc | 14 ++------------ src/Screen.cc | 10 ++++++---- src/Window.cc | 10 +++------- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5f91c4..65abab5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0rc3: +*06/07/06: + * Still trying to get the focus right: bug #1517750 (Mark) + FocusControl.cc Window.cc Screen.cc *06/07/05: * Fix crash on startup on some platforms (Simon) FbTk/FbString.cc diff --git a/src/FocusControl.cc b/src/FocusControl.cc index f0d1387..339541c 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -458,18 +458,8 @@ void FocusControl::setFocusedWindow(WinClient *client) { #endif // DEBUG // 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)) { - - if (!client && s_focused_fbwindow) - s_focused_fbwindow->setFocusFlag(false); - - } else { - s_focused_window = 0; - s_focused_fbwindow = 0; - } - + if (s_focused_fbwindow) + s_focused_fbwindow->setFocusFlag(false); if (client && client->fbwindow() && !client->fbwindow()->isIconic()) { // screen should be ok diff --git a/src/Screen.cc b/src/Screen.cc index 47599bc..df15250 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1365,11 +1365,10 @@ FluxboxWindow *BScreen::createWindow(Window client) { // always put on end of focused list, if it gets focused it'll get pushed up // there is only the one win client at this stage + focusControl().addFocusBack(*winclient); if (focusControl().focusNew()) - focusControl().addFocusFront(*winclient); - else - focusControl().addFocusBack(*winclient); - + FocusControl::setFocusedWindow(winclient); + // we also need to check if another window expects this window to the left // and if so, then join it. FluxboxWindow *otherwin = 0; @@ -1407,6 +1406,9 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) { return 0; } + if (focusControl().focusNew() || FocusControl::focusedWindow() == &client) + FocusControl::setFocusedWindow(&client); + m_clientlist_sig.notify(); return win; diff --git a/src/Window.cc b/src/Window.cc index 80b7ef6..03bde16 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -703,11 +703,9 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { m_workspacesig.notify(); m_layersig.notify(); - if (was_focused != 0) { + if (was_focused != 0) // already has focus, we're just assuming the state of the old window - setCurrentClient(*was_focused, false); - frame().setFocus(true); - } + FocusControl::setFocusedWindow(&client); frame().reconfigure(); @@ -776,10 +774,8 @@ 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 -- cgit v0.11.2