<AWT Dev> <AWT dev>[10] Review request for JDK-8190767: [macos] if JFrame is maximized on OS X, all new JFrames will be maximized by default

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Jan 30 21:10:58 UTC 2018


Hi, Manajit.
Did you check that it works properly in jdk8?

I guess we need to set "WINDOW_FULLSCREENABLE" after we show the window 
for the first time, with one exception if the window is MAXIMIZED_BOTH.

On 29/01/2018 04:39, Manajit Halder wrote:
> Hi All,
> 
> Kindly review the fix for JDK10.
> 
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8190767
> 
> Webrev:
> http://cr.openjdk.java.net/~mhalder/8190767/webrev.00/
> 
> Problem:
> In this problem two unrelated windows are created (first window and 
> second window). If the second window is created when the first window is 
> in fullscreen then the second window will automatically be created in 
> fullscreen mode. This is the default behaviour with Cocoa windows. The 
> second window receives windowWillEnterFullScreen notification when the 
> first window is in fullscreen. windowWillEnterFullScreen notification is 
> system generated notification and there is no way to prevent it.
> 
> Above conclusion was made after debugging the issue to find out if there 
> is any way to prevent the windowWillEnterFullScreen notification and 
> also to find out if it generated due to some existing java (generic and 
> native) code.
> 
> I wrote a simple Mac OS X application with 2 windows and observed the 
> same behaviour. The second window is created in fullscreen mode if it is 
> created when the first window is in fullscreen. Whereas the second 
> window is displayed normal if the first window is in normal mode (not in 
> fullscreen mode). The only way found to prevent the second window going 
> to fullscreen is don’t set this behaviour for the second window.
> 
> Fix:
> The behaviour is normal on Mac OS. But if we want to prevent the second 
> (all windows except the primary window) window to automatically created 
> in fullscreen mode then the following fix can be applicable.
> 
> By default all the Frames are set the WINDOW_FULLSCREENABLE property and 
> by default all frames receives fullscreen event if the first frame is in 
> fullscreen when it is created. Due to this setting the second frame 
> which is created on button click goes to fullscreen on creation 
> automatically. Mac OS fullscreen event notifications are received in 
> case the first frame is in fullscreen and WINDOW_FULLSCREENABLE set for 
> the second frame.
> 
> Only the first frame should have the WINDOW_FULLSCREENABLE property set. 
> The frames created in this case were ownerless windows as mentioned 
> earlier. Therefore it is not possible to find out the owner of the 
> current frame, it is null for all the frames created. Hence the fix is 
> if the current frame is the first frame then set the property otherwise 
> don’t set the property WINDOW_FULLSCREENABLE.
> 
> Regards,
> Manajit


-- 
Best regards, Sergey.


More information about the awt-dev mailing list