more sloppy focus fixing

This commit is contained in:
rathnor 2003-12-21 15:24:28 +00:00
parent 8192e8bc2a
commit dfdb8219fa
4 changed files with 25 additions and 15 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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() {

View file

@ -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;