From f68c15cfa29a3eefc6e209ab1799e4d02c5cce40 Mon Sep 17 00:00:00 2001 From: rathnor Date: Sun, 14 Sep 2003 11:23:48 +0000 Subject: focus fixes --- ChangeLog | 3 +++ src/Window.cc | 39 ++++++++++++++++++--------------------- src/fluxbox.cc | 11 ++++++++--- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index a12ce2e..1370c25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 0.9.6: *03/09/14: + * Focus fixes (Simon) + Hopefully fixes mysterious instances of focus not being set right. + Window.cc fluxbox.cc * More optimization to reduce flicker in titlebar Screen.cc, FbWinFrame.cc/hh, TextButton.hh/cc, FbWindow.hh/cc *03/09/13: diff --git a/src/Window.cc b/src/Window.cc index b33bcbe..972a025 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.228 2003/09/14 10:13:06 fluxgen Exp $ +// $Id: Window.cc,v 1.229 2003/09/14 11:23:47 rathnor Exp $ #include "Window.hh" @@ -806,19 +806,17 @@ void FluxboxWindow::nextClient() { return; ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), m_client); + WinClient *client = 0; if (it == m_clientlist.end()) { - m_client = m_clientlist.front(); - return; + client = m_clientlist.front(); + } else { + it++; + if (it == m_clientlist.end()) + client = m_clientlist.front(); + else + client = *it; } - - it++; - if (it == m_clientlist.end()) - m_client = m_clientlist.front(); - else - m_client = *it; - m_client->raise(); - frame().setLabelButtonFocus(*m_labelbuttons[m_client]); - frame().setFocus(setInputFocus()); + setCurrentClient(*client, true); } void FluxboxWindow::prevClient() { @@ -826,18 +824,17 @@ void FluxboxWindow::prevClient() { return; ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), m_client); + WinClient *client = 0; if (it == m_clientlist.end()) { - m_client = m_clientlist.front(); - return; + client = m_clientlist.front(); + } else { + if (it == m_clientlist.begin()) + client = m_clientlist.back(); + else + client = *(--it); } - if (it == m_clientlist.begin()) - m_client = m_clientlist.back(); - else - m_client = *(--it); - m_client->raise(); - frame().setLabelButtonFocus(*m_labelbuttons[m_client]); - frame().setFocus(setInputFocus()); + setCurrentClient(*client, true); } diff --git a/src/fluxbox.cc b/src/fluxbox.cc index d83fe0b..2fbf56b 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.190 2003/09/12 22:55:33 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.191 2003/09/14 11:23:48 rathnor Exp $ #include "fluxbox.hh" @@ -852,7 +852,10 @@ void Fluxbox::handleEvent(XEvent * const e) { } } break; case FocusIn: { - if (e->xfocus.mode == NotifyUngrab || + + // a grab is something of a pseudo-focus event, so we ignore + // them, here we ignore some window receiving it + if (e->xfocus.mode == NotifyGrab || e->xfocus.detail == NotifyPointer) break; @@ -862,7 +865,7 @@ void Fluxbox::handleEvent(XEvent * const e) { } break; case FocusOut:{ - + // and here we ignore some window losing the special grab focus if (e->xfocus.mode == NotifyUngrab || e->xfocus.detail == NotifyPointer) break; @@ -871,6 +874,8 @@ void Fluxbox::handleEvent(XEvent * const e) { #ifdef DEBUG cerr<<__FILE__<<"("<<__FUNCTION__<<") Focus out is not a FluxboxWindow !!"<