diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc index ae52908f..b9d5e987 100644 --- a/src/FbTk/EventManager.cc +++ b/src/FbTk/EventManager.cc @@ -179,9 +179,7 @@ void EventManager::dispatch(Window win, XEvent &ev, bool parent) { evhand->exposeEvent(ev.xexpose); break; case EnterNotify: - if (ev.xcrossing.mode != NotifyGrab && - ev.xcrossing.mode != NotifyUngrab) - evhand->enterNotifyEvent(ev.xcrossing); + evhand->enterNotifyEvent(ev.xcrossing); break; case LeaveNotify: if (ev.xcrossing.mode != NotifyGrab && diff --git a/src/Window.cc b/src/Window.cc index 3c32d0e4..4e2aed17 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -2716,12 +2716,21 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) { - // ignore grab activates, or if we're not visible - if (ev.mode == NotifyGrab || ev.mode == NotifyUngrab || - !isVisible()) { + static FluxboxWindow *s_last_really_entered = 0; + + if (ev.mode == NotifyUngrab && s_last_really_entered == this) { + // if this results from an ungrab, only act if the window really changed. + // otherwise we might pollute the focus which could have been assigned + // by alt+tab (bug #597) return; } + // ignore grab activates, or if we're not visible + if (ev.mode == NotifyGrab || !isVisible()) { + return; + } + + s_last_really_entered = this; if (ev.window == frame().window()) Fluxbox::instance()->keys()->doAction(ev.type, ev.state, 0, Keys::ON_WINDOW, m_client);