more sloppy focus fixing
rathnor rathnor
4 files changed,
25 insertions(+),
15 deletions(-)
M
src/WinClient.cc
→
src/WinClient.cc
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@
if (m_blackbox_hint != 0) XFree(m_blackbox_hint); - if (window()) + if (window()) { fluxbox->removeWindowSearch(window()); + fluxbox->removeRedirectEvent(None, window()); + } m_win = 0; }
M
src/Window.cc
→
src/Window.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ return (*it)->fbwindow()->setCurrentClient(**it, true);
} } + 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() {
M
src/fluxbox.cc
→
src/fluxbox.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@
// 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 @@ m_redirect_events.push_back(re);
} // 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;