Skip to content

Commit c35c568

Browse files
committed
[Win32] Enable monitor-specific scaling by default
By now, SWT had monitor-specific scaling on Windows disabled by default and used the existing, single-zoom HiDPI support. There are good reasons to now change the default of SWT to have monitor-specific scaling enabled: - Eclipse applications default to have monitor-specific scaling enabled for several months now, so SWT and Eclipse default behaviors are different - With default JVM settings, pure SWT application have no proper scaling as the existing HiDPI support requires DPI awareness "System" to function properly whereas the JVM default is "PerMonitorV2" and requires the application to scale on its own. So by default, SWT applications currently have no scaling at all - The feature has matured throughout the last year with it being the default for Eclipse application for several months now. This change adapts the SWT default to enable monitor-specific scaling on Windows.
1 parent 577b1d6 commit c35c568

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ public static boolean isCustomAutoScale() {
125125
return System.getProperty (SWT_AUTOSCALE) != null;
126126
}
127127

128+
public static String getEffectiveAutoScaleValue() {
129+
return autoScaleValue.toString();
130+
}
131+
128132
/**
129133
* Returns {@code true} only if the current setup is compatible
130134
* with monitor-specific scaling. Returns {@code false} if:
@@ -168,7 +172,7 @@ public static boolean isMonitorSpecificScalingActive() {
168172
return false;
169173
}
170174
String updateOnRuntimeValue = System.getProperty(SWT_AUTOSCALE_UPDATE_ON_RUNTIME);
171-
return "force".equalsIgnoreCase(updateOnRuntimeValue) || "true".equalsIgnoreCase(updateOnRuntimeValue);
175+
return !"false".equalsIgnoreCase(updateOnRuntimeValue);
172176
}
173177

174178
public static int pixelToPoint(int size, int zoom) {
@@ -465,10 +469,7 @@ public static int getZoomForAutoscaleProperty (int nativeDeviceZoom) {
465469

466470
public static void runWithAutoScaleValue(String autoScaleValue, Runnable runnable) {
467471
AutoScale initialAutoScaleValue = DPIUtil.autoScaleValue;
468-
// This method is used to adapt to the autoscale value used by the Equinox launcher,
469-
// which currently defaults to "integer". So we need to use explicit "integer" default here
470-
// until the Equinox launcher is adapted.
471-
DPIUtil.autoScaleValue = AutoScaleCalculation.parseFrom(autoScaleValue == null ? "integer" : autoScaleValue);
472+
DPIUtil.autoScaleValue = AutoScaleCalculation.parseFrom(autoScaleValue);
472473
DPIUtil.deviceZoom = getZoomForAutoscaleProperty(nativeDeviceZoom);
473474
try {
474475
runnable.run();

0 commit comments

Comments
 (0)