I got irritated enough with some focus issues to dump a few hours into
tracing them down tonite, and I've got a possible solution.

For me, the immediate trigger for this was that the result of setting
Firefox's ui.context_menus.after_mouseup pref to true (making the
context menu come up on mouseup, rather than mousedown) is that it
momentarily popped up, then disappeared.  It turns out that the fix
for that _also_ fixes the case several of us have seen where the
urlbar dropdown flickers in and out of existence depending on where
your mouse is.  And it may also do something on some of the other
weird focus cases people have seen.

It turned out in investigation I could hack around it by f.focus'ing
the window (and I think SloppyFocus would happen to make it work too).
So if you still have odd bugs with focus or the like (after the input
and EWMH fixes last year) that f.focus hacks around, it's possible
these changes will fix that too.


After an impressive amount of tracing, this turns out to be the result
of several things all conspiring, but one of the more non-obvious is
that the context menu _is_ a separate X window, but is _not_ a _child_
of the main firefox window.  Rather, it's a totally different window
which is a child of the root, and has the override_redirect flag on it
to make sure the WM ignores it.  And then FF does a bunch of its own
weird focus handling to move stuff over there.

But, because we're told to ignore it, we never Enter it and so move
ourselves over to it; we only Leave the main window, so the upshot is
that while FF tries to move the focus over, we "win" and move the
focus to the root.  Which FF then sees and decides "oh, you must want
to get rid of the menu".

So it turns in my best understanding that we actually need to be a
little smarter about how we interpret the Leave events and shift the
focus up to the root.  I've got a change up in a branch at
<https://code.launchpad.net/~fullermd/ctwm/focus> which fixes things
for me.  Some broader testing would be good; especially from people
running with multiple Screen's (:0.0, :0.1, etc; not Xinerama-ish
mode), since that has its own case with Leave's.


    This seems to be a "bug" (at least very bad interaction) that goes
    all the way back to twm   :)


-- 
Matthew Fuller     (MF4839)   |  fulle...@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.

Reply via email to