<AWT Dev> [9] Review Request: 8168307 Toolkit.getScreenSize() returns incorrect size on unix in multiscreen systems

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Thu Mar 2 09:11:30 UTC 2017

The fix looks good to me.


On 2/28/2017 8:21 PM, Sergey Bylokhov wrote:
> Hi, Alexander.
>> The XToolkit.getDefaultScreenWidth()/getDefaultScreenHeight() methods are supposed to return the width/height in the user space.
>> Could you rename them and the screenWidth/screenHeight variables to emphasize the fact that now they work with values in the device space?
> The fix is updated:
> http://cr.openjdk.java.net/~serb/8168307/webrev.02
>> Thanks,
>> Alexandr.
>> On 2/13/2017 8:58 PM, Sergey Bylokhov wrote:
>>> To me it also looks strange and causes an unpredictable behavior when the main/default screen is on the right. But I guess it is too late to fix in jdk9, I’ll file a bug for jdk10 to investigate it.
>>>> Hello Sergey,
>>>> Main screen on Windows and Mac OS always has (0,0) coordinates. On Linux main screen may be shifted, e.g. if it is located to the right of secondary one  (800,0).
>>>> I think that it is feasible to unify Linux main screen behavior with Mac OS and Windowsa and make it always located at (0,0).
>>>> Thanks,
>>>> Alexander.
>>>> On 02/13/2017 12:18 PM, Sergey Bylokhov wrote:
>>>>> Hello,
>>>>> Please review the fix for jdk9.
>>>>> Toolkit.getSreenSize() returns the size which is different from the size of the main screen(as it is specified).
>>>>> Since jdk5 on linux it is return the size of the virtual screen(which includes all displays) in pixels. It was discussed in JDK-XXXXXXX, but since support of HiDPI was introduced it is return something different: «the size of the virtual screen in pixels divide by the scale factor of the main screen». So right now the result of this method does not match to the virtual screen size in the users space, it also does not match the size of the virtual screen in pixels, and also does not match to the size of the main screen.
>>>>> This is a request to unify behavior of such methods between linux/windows/macOS in multi-screen environment.
>>>>> No new issues were found by jtreg/jck.
>>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8168307
>>>>> Webrev can be found at: http://cr.openjdk.java.net/~serb/8168307/webrev.01

More information about the awt-dev mailing list