JDK-8243457 : Result of getBestCursorSize depends on which screen is the Windows primary one
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 9,11,14,15
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2020-04-19
  • Updated: 2021-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
josm-found

A DESCRIPTION OF THE PROBLEM :
Assume a Windows system with two screens.
Screen 1 has set a scaling of 100%, screen 2 has set a scaling of 200%.
If screen 1 is set as the primary screen (in the Windows display settings), getBestCursorSize() returns
java.awt.Dimension[width=64,height=64]

If screen 2 is set as the secondary screen, getBestCursorSize() returns 32x32.
java.awt.Dimension[width=32,height=32]

As no screen resolution has changed, it is surprising that the result of getBestCursorSize changes.

This problem is closely related to JDK-8240568. If the primary screen has the greater scaling, the cursor is normal/double sized if the primary screen has the greater scaling, and is half/normal sized if the primary screen has the lesser scaling).


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set the respective Windows settings and run the submitted test program.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.awt.Dimension[width=64,height=64] in both cases, to support the greatest scaling value well.
ACTUAL -
java.awt.Dimension[width=32,height=32] in the case where the low-scaled screen is set as the primary one, java.awt.Dimension[width=64,height=64] otherwise.

---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.Toolkit;

public class BestCursorSize {
    public static void main(String[] args)
    {
        Dimension bestCursorSize = Toolkit.getDefaultToolkit().getBestCursorSize(32, 32);
        System.out.println("" + bestCursorSize);
    }
}

---------- END SOURCE ----------

FREQUENCY : always



Comments
This is how the WIndows itself reports this "global" information, it is reported for all screen.
23-04-2020

As per description, Result of getBestCursorSize depends on which screen is the Windows primary one and change even when no screen resolution is updated. Checked this for reported version with attached test case and could confirm the outcome. Issue does reproduce from JDK 9 and onwards and seems related to JDK-8240568.
23-04-2020