Skip to content

Commit 74efba4

Browse files
committed
Correct activation of monitor-specific rescaling on Windows
The activation of monitor-specific rescaling on Windows currently relies on the method Display#setRescalingAtRuntime(), which was found to not take the full intended effect. This change thus replaces the call to that method based on the value of the according experimental preference by setting the according system property to activate that behavior in a proper way. It also removes the obsolete activation of Edge when the experimental preference is set, as Edge has been enabled by default.
1 parent 904bdd7 commit 74efba4

File tree

1 file changed

+12
-7
lines changed
  • bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal

1 file changed

+12
-7
lines changed

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/Workbench.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ public final class Workbench extends EventManager implements IWorkbench, org.ecl
298298

299299
private static final String EDGE_USER_DATA_FOLDER = "org.eclipse.swt.internal.win32.Edge.userDataFolder"; //$NON-NLS-1$
300300

301+
private static final String SWT_RESCALE_AT_RUNTIME_PROPERTY = "swt.autoScale.updateOnRuntime"; //$NON-NLS-1$
302+
301303
private static final class StartupProgressBundleListener implements ServiceListener {
302304

303305
private final SubMonitor subMonitor;
@@ -586,7 +588,7 @@ public static int createAndRunWorkbench(final Display display, final WorkbenchAd
586588
int orientation = store.getInt(IPreferenceConstants.LAYOUT_DIRECTION);
587589
Window.setDefaultOrientation(orientation);
588590
}
589-
setRescaleAtRuntimePropertyFromPreference(display);
591+
setRescaleAtRuntimePropertyFromPreference();
590592
if (obj instanceof E4Application) {
591593
E4Application e4app = (E4Application) obj;
592594
E4Workbench e4Workbench = e4app.createE4Workbench(getApplicationContext(), display);
@@ -680,12 +682,15 @@ public void update() {
680682
return returnCode[0];
681683
}
682684

683-
private static void setRescaleAtRuntimePropertyFromPreference(final Display display) {
684-
boolean rescaleAtRuntime = PrefUtil.getAPIPreferenceStore()
685-
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME);
686-
if (rescaleAtRuntime) {
687-
display.setRescalingAtRuntime(rescaleAtRuntime);
688-
System.setProperty("org.eclipse.swt.browser.DefaultType", "edge"); //$NON-NLS-1$ //$NON-NLS-2$
685+
private static void setRescaleAtRuntimePropertyFromPreference() {
686+
if (System.getProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY) != null) {
687+
WorkbenchPlugin.log(StatusUtil.newStatus(IStatus.WARNING, SWT_RESCALE_AT_RUNTIME_PROPERTY
688+
+ " is configured (e.g., via the INI), but the according preference should be preferred instead.", //$NON-NLS-1$
689+
new RuntimeException()));
690+
} else {
691+
boolean rescaleAtRuntime = PrefUtil.getAPIPreferenceStore()
692+
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME);
693+
System.setProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY, Boolean.toString(rescaleAtRuntime));
689694
}
690695
}
691696

0 commit comments

Comments
 (0)