<Swing Dev>  RFR:JDK-8176359: Frame#setMaximizedbounds not working properly in multi screen environments
krishna.addepalli at oracle.com
Fri Jun 22 13:23:20 UTC 2018
As per your comments, I have modified the patch to use Region.clipScale to do appropriate scaling calculation and adjustment.
Also, while running the testcase, I discovered that the -Dsun.java2d.uiScale=1.25 will uniformly apply the scaling across all the screens, whereas if the underlying monitor is not scaled, the results will be different.
Hence I modified the test to remove the uiScale settings related tests.
Here is the updated webrev: http://cr.openjdk.java.net/~kaddepalli/8176359/webrev01/
From: Krishna Addepalli
Sent: Wednesday, June 13, 2018 6:49 PM
To: swing-dev at openjdk.java.net
Subject: RE: <Swing Dev>  RFR:JDK-8176359: Frame#setMaximizedbounds not working properly in multi screen environments
One more question I forgot to ask:
4. For running the test in different scaling modes, I have been manually changing the scaling values in the OS settings. However, I also have applied the -Dsun.java.uiScale vm parameter to run in different scaling modes. Is this equivalent to running the test in different scaling modes?
From: Krishna Addepalli
Sent: Wednesday, June 13, 2018 5:47 PM
To: HYPERLINK "mailto:swing-dev at openjdk.java.net"swing-dev at openjdk.java.net
Subject: <Swing Dev>  RFR:JDK-8176359: Frame#setMaximizedbounds not working properly in multi screen environments
As per our conversation, please review a fix for
The problem is that when the secondary monitor is larger than the primary monitor, and the window needs to maximize onto the secondary screen, it results in wrong window sizes.
The root cause is in WFramePeer::adjustMaximizedBounds, which tries to compensate the window bounds appropriately, but it is not adequate. It solves another related bug: JDK-6699851, but the requirement is that, for a window to be maximized even on a secondary screen, it still needs to provide the dimensions of the primary screen, and the Window Manager automatically compensates for the difference.
The proposed fix addresses this problem in both cases, but there are some more problems that were discovered on the way:
1. The window bounds seem random (or atleast seem so), when maximized bounds that are larger than the primary screen bounds, but are smaller than the secondary screen bounds are provided. Unfortunately, there is no clear document/information regarding the way it is adjusted. The best I could get is this: https://blogs.msdn.microsoft.com/oldnewthing/20150501-00/?p=44964
2. Scaling provides a new dimension of problems, and it seems hard to satisfy all the cases - due to the floating point computations. The proposed fix works for 100, 125, 150 and 175 % scalings, but again, it depends on the resolution of the monitors.
3. I have written a test case which tries to display maximized windows on each screen and tests if the bounds are proper. When I set the screen bounds as maximizedBounds, and then query the frame bounds post displaying the screen, they are not the same. However, I found that the contentPane bounds are closer, but still not exactly same. Is there something I'm missing?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swing-dev