Discussion:
[Xquartz-dev] Intermittent loss of input focus?
Richard Tobin
2015-08-12 12:11:16 UTC
Permalink
I was able to duplicate it after building and running the "Mail Status
Control.app" [1].
The short java program below seems to be sufficient. If you
don't set apple.awt.UIElement to true it steals focus from all
programs (as you'd expect); if you do then it only steals from X.

If I have it running in the background once a second, it only steals
focus the first time it runs after I click in an X window. I have
focus-follows-mouse set and just moving the cursor between X windows
doesn't make it steal focus.

Regarding Jeremy's comment "there must be *something* I could do put
XQuartz in a mode that would prevent this focus loss", it can't be
that all other applications explicitly do something for this. Either
they start up in some way that makes it happen automatically, or
there's something XQuartz does to *allow* its focus to be stolen. The
fact that it only happens after clicking in a window suggests that
it's the latter: when a window is selected in that way something must
happen that allows a single focus-stealing to happen, and it doesn't
happen when it's selected by focus-follows-mouse.

I hope this helps someone track it down.

Here's the program:

import javax.swing.*;

public class Javabg
{
public Javabg()
{
JPanel panel = new JPanel();
}

public static void main(String[] args)
{
System.setProperty("apple.awt.UIElement", "true");
new Javabg();
}
}

-- Richard
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
Loading...