From dfdb8219fa74defd4608f3574128f95eb9fcde64 Mon Sep 17 00:00:00 2001 From: rathnor Date: Sun, 21 Dec 2003 15:24:28 +0000 Subject: more sloppy focus fixing --- ChangeLog | 2 ++ src/WinClient.cc | 6 ++++-- src/Window.cc | 24 ++++++++++++++---------- src/fluxbox.cc | 8 +++++--- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33df7c9..3e08429 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.7: *03/12/21: + * And another attempt at sloppy focus issues (Simon) + WinClient.cc Window.cc fluxbox.cc * Fixed "mozilla" input focus bug (Henrik) We must assume Passive when no input hint is set WinClient.cc diff --git a/src/WinClient.cc b/src/WinClient.cc index a3761f4..111e51d 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WinClient.cc,v 1.35 2003/12/21 13:57:38 fluxgen Exp $ +// $Id: WinClient.cc,v 1.36 2003/12/21 15:24:28 rathnor Exp $ #include "WinClient.hh" @@ -118,8 +118,10 @@ WinClient::~WinClient() { if (m_blackbox_hint != 0) XFree(m_blackbox_hint); - if (window()) + if (window()) { fluxbox->removeWindowSearch(window()); + fluxbox->removeRedirectEvent(None, window()); + } m_win = 0; } diff --git a/src/Window.cc b/src/Window.cc index edf88fc..4d407ad 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.254 2003/12/18 18:03:21 fluxgen Exp $ +// $Id: Window.cc,v 1.255 2003/12/21 15:24:28 rathnor Exp $ #include "Window.hh" @@ -1190,23 +1190,27 @@ bool FluxboxWindow::setInputFocus(long ignore_event) { } } + bool ret = false; + if (m_client->getFocusMode() == WinClient::F_LOCALLYACTIVE || m_client->getFocusMode() == WinClient::F_PASSIVE) { m_client->setInputFocus(RevertToPointerRoot, CurrentTime); - // People can ignore an event until the focus comes through - // this is most likely to be an EnterNotify for sloppy focus - if (ignore_event) - Fluxbox::instance()->addRedirectEvent( - &screen(), ignore_event, None, - FocusIn, m_client->window(), None); - // this may or may not send, but we've setInputFocus already, so return true m_client->sendFocus(); - return true; + ret = true; } else { - return m_client->sendFocus(); // checks if it should send or not + ret = m_client->sendFocus(); // checks if it should send or not } + + // People can ignore an event until the focus comes through + // this is most likely to be an EnterNotify for sloppy focus + if (ret && m_client->getFocusMode() != WinClient::F_NOINPUT && ignore_event != None) + Fluxbox::instance()->addRedirectEvent( + &screen(), ignore_event, None, + FocusIn, m_client->window(), None); + + return ret; } void FluxboxWindow::hide() { diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 3808893..3330c8c 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.211 2003/12/21 15:13:00 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.212 2003/12/21 15:24:28 rathnor Exp $ #include "fluxbox.hh" @@ -1946,7 +1946,8 @@ void Fluxbox::revertFocus(BScreen &screen, bool wait_for_end) { // when doFocusLast is set, we don't do exact sloppy focus - we // go to the last focused window, rather than the pointer window // i.e. we ignore any EnterNotify events until the focus sending arrives - ignore_event = EnterNotify; + if (screen.getFocusModel() != BScreen::CLICKTOFOCUS) + ignore_event = EnterNotify; } // if setting focus fails, or isn't possible, fallback correctly @@ -2004,13 +2005,14 @@ void Fluxbox::addRedirectEvent(BScreen *screen, } // So that an object may remove the ignore on its own +// stop_type of None means remove all redirects for this window void Fluxbox::removeRedirectEvent(long stop_type, Window stop_win) { RedirectEvents::iterator it = m_redirect_events.begin(); RedirectEvents::iterator it_end = m_redirect_events.end(); RedirectEvent *re = 0; for (; it != it_end; ++it) { re = *it; - if (re->stop_type == re->stop_type && re->stop_win == stop_win) { + if (re->stop_win == stop_win && (stop_type == None || stop_type == re->stop_type)) { m_redirect_events.erase(it); delete re; return; -- cgit v0.11.2