Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,13 @@ public void update() {
// run the legacy workbench once
returnCode[0] = workbench.runUI();

if (AUTOSCALE_ADAPTATION.isMonitorSpecificScalingDisabledForIncompatibility()) {
display.asyncExec(() -> {
MessageDialog.openError(null, WorkbenchMessages.RescaleAtRuntimeIncompatibilityTitle,
NLS.bind(WorkbenchMessages.RescaleAtRuntimeIncompatibilityDescription));
});
}

if (returnCode[0] == PlatformUI.RETURN_OK) {
// run the e4 event loop and instantiate ... well, stuff
if (serviceListener.get() != null) {
Expand All @@ -694,18 +701,6 @@ public void update() {
return returnCode[0];
}

private static void setRescaleAtRuntimePropertyFromPreference() {
if (System.getProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY) != null) {
WorkbenchPlugin.log(Status.warning(SWT_RESCALE_AT_RUNTIME_PROPERTY
+ " is configured (e.g., via the INI), but the according preference should be preferred instead." //$NON-NLS-1$
));
} else {
boolean rescaleAtRuntime = ConfigurationScope.INSTANCE.getNode(WorkbenchPlugin.PI_WORKBENCH)
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, true);
System.setProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY, Boolean.toString(rescaleAtRuntime));
}
}

private static void setSearchContribution(MApplication app, boolean enabled) {
for (MTrimContribution contribution : app.getTrimContributions()) {
if ("org.eclipse.ui.ide.application.trimcontribution.QuickAccess".contains(contribution //$NON-NLS-1$
Expand Down Expand Up @@ -771,7 +766,7 @@ public static Display createDisplay() {
Display.setAppName(applicationName);
}

setRescaleAtRuntimePropertyFromPreference();
AUTOSCALE_ADAPTATION.setRescaleAtRuntimePropertyFromPreference();

// create the display
Display newDisplay = Display.getCurrent();
Expand Down Expand Up @@ -3673,6 +3668,8 @@ protected String createId() {
private static class AutoscaleAdaptation {
private static final String SWT_AUTOSCALE = "swt.autoScale"; //$NON-NLS-1$

private boolean incompatibleMonitorSpecificScalingDisabled;

private final String initialAutoScaleValue;

public AutoscaleAdaptation() {
Expand All @@ -3683,5 +3680,26 @@ public void runWithInitialAutoScaleValue(Runnable runnable) {
DPIUtil.runWithAutoScaleValue(initialAutoScaleValue, runnable);
}

public void setRescaleAtRuntimePropertyFromPreference() {
if (System.getProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY) != null) {
WorkbenchPlugin.log(Status.warning(SWT_RESCALE_AT_RUNTIME_PROPERTY
+ " is configured (e.g., via the INI), but the according preference should be preferred instead." //$NON-NLS-1$
));
} else {
boolean rescaleAtRuntime = ConfigurationScope.INSTANCE.getNode(WorkbenchPlugin.PI_WORKBENCH)
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, true);
System.setProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY, Boolean.toString(rescaleAtRuntime));
}

if (DPIUtil.isMonitorSpecificScalingActive() && !DPIUtil.isSetupCompatibleToMonitorSpecificScaling()) {
incompatibleMonitorSpecificScalingDisabled = true;
System.setProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY, Boolean.toString(false));
}
}

public boolean isMonitorSpecificScalingDisabledForIncompatibility() {
return incompatibleMonitorSpecificScalingDisabled;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public class WorkbenchMessages extends NLS {

public static String RescaleAtRuntimeDescription;

public static String RescaleAtRuntimeDisabledDescription;

public static String RescaleAtRuntimeIncompatibilityTitle;

public static String RescaleAtRuntimeIncompatibilityDescription;

public static String RescaleAtRuntimeEnabled;

public static String RescaleAtRuntimeSettingChangeWarningTitle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ArrayContentProvider;
Expand All @@ -65,7 +66,9 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.DPIUtil;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
Expand Down Expand Up @@ -222,7 +225,15 @@ private void createRescaleAtRuntimeCheckButton(Composite parent) {
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, true);
rescaleAtRuntime = createCheckButton(parent, WorkbenchMessages.RescaleAtRuntimeEnabled,
initialStateRescaleAtRuntime);
rescaleAtRuntime.setToolTipText(WorkbenchMessages.RescaleAtRuntimeDescription);
if (!DPIUtil.isSetupCompatibleToMonitorSpecificScaling()) {
rescaleAtRuntime.setEnabled(false);
Font font = parent.getFont();
Composite note = createNoteComposite(font, parent, WorkbenchMessages.Preference_note,
WorkbenchMessages.RescaleAtRuntimeDisabledDescription);
note.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create());
} else {
rescaleAtRuntime.setToolTipText(WorkbenchMessages.RescaleAtRuntimeDescription);
}
}

private void createThemeIndependentComposits(Composite comp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,10 @@ ThemeChangeWarningTitle = Theme Changed
RescaleAtRuntimeSettingChangeWarningTitle = DPI Setting Changed
RescaleAtRuntimeSettingChangeWarningText = Restart for the DPI setting changes to take effect
RescaleAtRuntimeDescription = Activating this option will dynamically scale all windows according to the monitor they are currently in
RescaleAtRuntimeDisabledDescription = Incompatible value for system property "swt.autoScale" is defined
RescaleAtRuntimeEnabled = Use monitor-specific UI &scaling
RescaleAtRuntimeIncompatibilityTitle = Monitor-Specific Scaling Deactivated
RescaleAtRuntimeIncompatibilityDescription = Monitor-specific scaling is currently active but an incompatible "swt.autoScale" value is defined. For this reason, monitor-specific scaling has been disabled. Please review your auto-scaling configuration.
# --- Workbench -----
WorkbenchPreference_openMode=Open mode
WorkbenchPreference_doubleClick=D&ouble click
Expand Down
Loading