#107 NXT command line queries get focus on Mac

open
nobody
None
5
2010-03-03
2010-03-03
Jonathan Kilgour
No

When you run FunctionQuery and other command line NXT utilities on Mac, they appear like GUIs in the Mac in the sense that an explicit Java process appears in the tool bar, and window focus is grabbed. This is not really an issue until you start looping such commands - then focus is taken from your working application at each iteration.

Tests: simple java programs do not steal focus in this way; simple programs with a GUI component do steal focus; simple programs that start one extra thread do not steal focus; in NXT the call that causes the "GUI-type" behaviour is new NiteMetaData(String metadata). I have searched for GUI-type calls, and drilled down into this code to see which call is causing this behaviour, thus far without success. I noted that finalizeLayerHierarchy's first 4 calls (excluding getObjectSets) cause the problem to appear, and uncommenting one of those, we see that the setLayers call is causing it, then further down to getElements, then finally to the call at line 2494 to new NiteElement. This has various further calls even in the construction of its arguments, but none appear to have any GUI-related content. May go further into this if time permits.

Discussion