Skip to content

Commit 05b9f73

Browse files
committed
[Win] Activate monitor-specific scaling before Display instantiation
Monitor-specific scaling needs to be activated before the display that is supposed to run in that mode is created. Currently, the scaling is activated in the Workbench based on an according preference after the Display has already been created. This change moves the evaluation of the experimental preference and the according initialization of monitor-specific scaling to before the Display is created inside the Workbench. Since the preference is now accessed at a point in time where no workspace may already be available, the preference was moved to the ConfigurationScope so that it is stored independent from the actual workspace.
1 parent de8c667 commit 05b9f73

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import org.eclipse.core.runtime.SubMonitor;
8282
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
8383
import org.eclipse.core.runtime.jobs.Job;
84+
import org.eclipse.core.runtime.preferences.ConfigurationScope;
8485
import org.eclipse.e4.core.contexts.ContextFunction;
8586
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
8687
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -687,8 +688,8 @@ private static void setRescaleAtRuntimePropertyFromPreference() {
687688
+ " is configured (e.g., via the INI), but the according preference should be preferred instead." //$NON-NLS-1$
688689
));
689690
} else {
690-
boolean rescaleAtRuntime = PrefUtil.getAPIPreferenceStore()
691-
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME);
691+
boolean rescaleAtRuntime = ConfigurationScope.INSTANCE.getNode(WorkbenchPlugin.PI_WORKBENCH)
692+
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, false);
692693
System.setProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY, Boolean.toString(rescaleAtRuntime));
693694
}
694695
}

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.eclipse.core.runtime.Platform;
4040
import org.eclipse.core.runtime.Platform.OS;
4141
import org.eclipse.core.runtime.RegistryFactory;
42+
import org.eclipse.core.runtime.preferences.ConfigurationScope;
4243
import org.eclipse.core.runtime.preferences.DefaultScope;
4344
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
4445
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -218,8 +219,8 @@ private void createHiDPISettingsGroup(Composite parent) {
218219
infoLabel.setLayoutData(GridDataFactory.defaultsFor(infoLabel).create());
219220
createLabel(group, ""); //$NON-NLS-1$
220221

221-
boolean initialStateRescaleAtRuntime = PrefUtil.getAPIPreferenceStore()
222-
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME);
222+
boolean initialStateRescaleAtRuntime = ConfigurationScope.INSTANCE.getNode(WorkbenchPlugin.PI_WORKBENCH)
223+
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, false);
223224
rescaleAtRuntime = createCheckButton(group, WorkbenchMessages.RescaleAtRuntimeEnabled, initialStateRescaleAtRuntime);
224225
}
225226

@@ -373,10 +374,17 @@ public boolean performOk() {
373374

374375
boolean isRescaleAtRuntimeChanged = false;
375376
if (rescaleAtRuntime != null) {
376-
boolean initialStateRescaleAtRuntime = PrefUtil.getAPIPreferenceStore()
377-
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME);
377+
IEclipsePreferences configurationScopeNode = ConfigurationScope.INSTANCE
378+
.getNode(WorkbenchPlugin.PI_WORKBENCH);
379+
boolean initialStateRescaleAtRuntime = configurationScopeNode
380+
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, false);
378381
isRescaleAtRuntimeChanged = initialStateRescaleAtRuntime != rescaleAtRuntime.getSelection();
379-
apiStore.setValue(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, rescaleAtRuntime.getSelection());
382+
configurationScopeNode.putBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME,
383+
rescaleAtRuntime.getSelection());
384+
try {
385+
configurationScopeNode.flush();
386+
} catch (BackingStoreException e) {
387+
}
380388
}
381389

382390
prefs.putBoolean(CTabRendering.USE_ROUND_TABS, useRoundTabs.getSelection());

0 commit comments

Comments
 (0)