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

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Apr 4 16:34:55 UTC 2018

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 
  - 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 < 
  - 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.

More information about the awt-dev mailing list