I have updated the fix a little bit:
http://cr.openjdk.java.net/~alexsch/8065739/webrev.01
- maximized sizes are set when window is created if frame state is
MAXIMIZED_BOTH
However there is a problem with the case:
-----------------
Frame frame = new Frame();
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setVisible(true);
-----------------
The frame with maximized sizes is created, the frame state is
isZoomed() is false and the frame state
is set to NORMAL in the checkZoom(). The
LWCToolkit.flushNativeSelectors() before isMaximized() does not help.
So I preserved the isVisible() check in the checkZoom() for this
particular case.
Thanks,
Alexandr.
On 4/8/2015 5:54 PM, Alexander Scherbatiy wrote:
Hello,
Could you review the fix:
bug: https://bugs.openjdk.java.net/browse/JDK-8065739
webrev: http://cr.openjdk.java.net/~alexsch/8065739/webrev.00
Use case:
------------
Frame frame = new Frame();
frame.pack();
frame.setBounds(screenBounds);
frame.setVisible(true);
------------
The frame is in the normal state but Mac OS X treats a frame with
screen bounds as zoomed.
The setVisible() method calls unmaximize() method to return the
zoomed window to the normal state.
The native zoom() method sets the initial sizes for the window which
are zero because of the pack() call.
There is already checkZoom() method which synchronizes native window
zoom state and and the frame extended state when a frame is resized by
mouse.
However it can't be always used for the synchronization between
native window zoom state and setBounds() call because of the following
case:
-----------------
Frame frame = new Frame();
frame.setBounds(smallBounds);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setVisible(true);
-----------------
This is the valid scenario where the frame should be maximized.
The solution synchronizes the zoom and the frame state only when the
native window is zoomed.
In opposite case we need to return from the zoomed sizes to previous
sizes which are the same as for the zoomed window.
Thanks,
Alexandr.