JDK-6395346 : Need to make Java process High-DPI-aware on Windows Vista
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2006-03-08
  • Updated: 2017-05-16
  • Resolved: 2006-05-26
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.
6 b86Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Running Mustang on Windows Vista (current build 5308) with non-default dpi
setting will cause Java applications to be scaled by the window display manager,
making the contents of Java-created windows blurry. The OS also reports the dpi of 96 to
the unaware apps.

Java process needs to signal to the OS that it's high-dpi aware to prevent this
from happening.

Here are some relevant screenshots:

EVALUATION More clarifications on the fix: On Windows Vista we need to signal to the OS that our application is High-DPI aware by calling a Win32 function ::SetProcessDPIAware(). But since calling this method changes the "high dpi-awareness" property of the process we need to be careful when we can safely call it without inadvertenly changing parent's process status. We have determined that we could only call it when a java process is started from one of our known launchers (java, javaw, javaws, etc), and not in case of java plugin, or other embedded scenarios. We've also added the following public property for controlling dpi-awareness: Property usage: -Dsun.java2d.dpiaware=[true|false] This property flag overrides the default behavior in regards to marking Java process High DPI aware on Windows Vista. By default the process is only marked as High DPI aware if it is started from one of the standard launchers (java.exe, javaw.exe, jconsole.exe, etc). If the property is set to "true", the java process will be marked as DPI aware regardless of the way it was launched. If the property is set to "false", the java process will not be marked as DPI aware. Note that High DPI-awareness is inherited from the parent process, so the java process started by the java plugin will inherit it from the browser. This means that there is no need for changing the default for plugin using the property. This property is ignored on any OS other than Windows Vista.

SUGGESTED FIX http://javaweb.sfbay/jcg/1.6.0-mustang/2D/6395346/

SUGGESTED FIX old suggested fix removed

EVALUATION There's a not well-documented call Win32 API call SetProcessDPIAware() which signals that the process should not be scaled by the window manager. Calling this function makes java applications look much better, especially in Windows look and feel where we scale the font size according to the os-reported DPI.