<AWT Dev> RFR: JDK-8194327 [macos] AWT windows have incorrect main/key window behaviors

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Mon Apr 9 23:06:05 UTC 2018

Hi, Alan.
I just found a few side effects in the test.
  - All other tests(actually all java applications) which are executed 
after the new test will show colorPanel(until it will not be closed 
  - If the Finder will be opened in full screen(or in the location where 
the test will show the test windows) then the test will fail. Maybe it 
is better to use some other application to deactivate the test? Can we 
implement it using other java application?(you can run the same 
TestMainKeyWindow.main() and pass some flag to it)

On 05/04/2018 16:15, Alan Snyder wrote:
> Thank you for your comments. Here is the updated webrev:
> http://cr.openjdk.java.net/~serb/alans/8194327/webrev.01/
> Alan
>> On Apr 4, 2018, at 9:34 AM, Sergey Bylokhov 
>> <Sergey.Bylokhov at oracle.com <mailto:Sergey.Bylokhov at oracle.com>> wrote:
>> Hi, Alan.
>> A few comments about the test:
>> - It is a mac specific and JtregNativeJdk should compile it on mac only
>> - It should close all windows at the end, currently it leaves Finder 
>> opened.
>> - it tries to use NSWindowStyleMask/NSWindowStyleMaskTitled which are 
>> available in  >10.12. We only plan to move to 10.9 soon. So the test 
>> should skip it or use NSInteger/NSTitledWindowMask for macOS < 
>> MAC_OS_X_VERSION_10_12.
>> - It looks like other tests in JtregNativeJdk.gmk use libtest+Some 
>> useful name, I suggest to use the same instead of bugid(same for the 
>> test name "Test.java").
>> On 02/04/2018 19:35, Alan Snyder wrote:
>>> Please review the following change to the macOS AWT.
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8194327
>>> Webrev: http://cr.openjdk.java.net/~serb/alans/8194327/webrev.00/
>>> The goal of this change is to allow a Java desktop application on 
>>> macOS to properly coexist with a native utility panel, such as the 
>>> native color chooser.
>>> The native color chooser is an example of a window that can become 
>>> the key (focused) window but cannot become the main window.
>>> If the previously active window is a Java frame, it should resign key 
>>> window status (lose focus), but retain the main window status.
>>> A window that is main but not key does not own the keyboard focus, 
>>> but it appears active, and if it is using the screen menu bar,
>>> it may be invoked to process a menu item action (if the menu item is 
>>> not already handled by the key window).
>>> The current macOS AWT does not support this combination of window 
>>> states. A Java window is either key and main, or neither.
>>> When the color chooser becomes key (obtains focus), the Java frame 
>>> resigns both key and main status.
>>> This change allows the key window status to be resigned while 
>>> retaining the main window status, with the appropriate behavior.
>>> Note that with this change, it remains impossible to implement a Java 
>>> window that behaves like the native color chooser (i.e., can become 
>>> key but not main).
>>> That would require a much bigger change.
>>>   Alan
>> -- 
>> Best regards, Sergey.

Best regards, Sergey.

More information about the awt-dev mailing list