<Swing Dev> [11] RFR:JDK-8176359: Frame#setMaximizedbounds not working properly in multi screen environments

Krishna Addepalli krishna.addepalli at oracle.com
Thu Jul 5 11:38:21 UTC 2018


Hi Sergey,

1. If I add the scaling, the test will always fail, even though it passes for scale = 1, it will fail for other values (1.25, 1.5, 1.75).
2. Yes, I have added code to get the current screen on which the point lies, and use the scale of that screen.
3. Thanks for pointing that out, fixed it in the new webrev.

Here is the new webrev:  http://cr.openjdk.java.net/~kaddepalli/8176359/webrev02/

Thanks,
Krishna

-----Original Message-----
From: Sergey Bylokhov 
Sent: Saturday, June 30, 2018 1:40 AM
To: Krishna Addepalli <krishna.addepalli at oracle.com>; swing-dev at openjdk.java.net
Subject: Re: <Swing Dev> [11] RFR:JDK-8176359: Frame#setMaximizedbounds not working properly in multi screen environments

Hi, Krishna.
> 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.

I suggest to add it back. The case when the bug can be reproduced depends from the real screen resolution. If such resolution is set then the bug should not depend from the scales of the screens, because internally we will convert the scaled coordinates to the real pixels and it does not matter what scale is used in java.

There some questionable places in the fix:
  - 106 b = scaleBounds(b, currScaleX, currScaleY); Why the scale of the current screen is used? I guess we need to find on which screen this "b" 
is located and then use its scale. Check implementation of
WWindowPeer.setBounds()

  - Is it intentional to assign to "b" a values from "primaryDevBounds", which was not scaled? So in some cases the "b" will have scaled values and in some cases not.
     125                 b.width = primaryDevBounds.width;
     130                 b.height = primaryDevBounds.height;
     134                 b.x = primaryDevBounds.x;
     138                 b.y = primaryDevBounds.y;


--
Best regards, Sergey.



More information about the swing-dev mailing list