Skip to content

Commit 4959087

Browse files
committed
Adapt Win32 launcher DPI awareness and autoscale configuration
Eclipse products use monitor-specific scaling by default for several releases. The products apply that scaling to the window created for the workbench and adapt the DPI awareness for the UI thread of that window. The whole process was still executed in "System" DPI awareness (used before monitor-specific scaling was available) as defined by the Equinox launcher's manifest. Since SWT also still used non-monitor-specific scaling as default, the splash screen initialized by the Equinox launcher was still processed without monitor-specific scaling. With SWT using monitor-specific scaling on Windows by default, a fitting process DPI awareness ("PerMonitorV2") must be used by Equinox native launcher to have a proper splash screen experience. In addition, this will adapt the Equinox launcher to the current defaults of Eclipse products and of the JDK itself (which by default uses PerMonitorV2 as well). As with monitor-specific scaling the default swt.autoScale value on Windows changes from "integer" to "quarter", this behavior is also adapted to align with the implementation in SWT's DPIUtil. If monitor-specific scaling is deactivated via system property, the swt.autoScale value still defaults to "integer", also conforming to SWT behavior.
1 parent 57fa623 commit 4959087

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

features/org.eclipse.equinox.executable.feature/library/win32/eclipse.exe.manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<asmv3:application>
1111
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
1212
<ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</ms_windowsSettings:dpiAware>
13+
<ms_windowsSettings:dpiAwareness xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</ms_windowsSettings:dpiAwareness>
1314
</asmv3:windowsSettings>
1415
</asmv3:application>
1516
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">

features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,12 @@ int showSplash( const _TCHAR* featureImage )
318318
case AUTOSCALE_FALSE:
319319
dpiX = 96;
320320
break;
321+
case AUTOSCALE_DEFAULT:
321322
case AUTOSCALE_QUARTER:
322323
dpiX = ((dpiX + 12) / 24) * 24;
323324
break;
324325
case AUTOSCALE_EXACT:
325326
break;
326-
case AUTOSCALE_DEFAULT:
327327
case AUTOSCALE_INTEGER:
328328
dpiX = ((int)((dpiX + 24) / 96 )) * 96;
329329
break;
@@ -699,8 +699,15 @@ static void CALLBACK detectJvmExit( HWND hwnd, UINT uMsg, UINT id, DWORD dwTime
699699
void processVMArgs(_TCHAR **vmargs[] ) {
700700
_TCHAR** arg;
701701
for (arg = *vmargs; *arg != NULL; arg++) {
702+
// see org.eclipse.swt.internal.DPIUtil.getZoomForAutoscaleProperty()
703+
if (_tcsncmp(*arg, _T("-Dswt.autoScale.updateOnRuntime="), 32) == 0) {
704+
_TCHAR* value = *arg + 32;
705+
if (_tcsicmp(value, _T("false")) == 0) {
706+
/* when monitor-specific scaling is disabled, default is "integer" */
707+
autoScaleValue = AUTOSCALE_INTEGER;
708+
}
709+
}
702710
if (_tcsncmp(*arg, _T("-Dswt.autoScale="), 16) == 0) {
703-
// see org.eclipse.swt.internal.DPIUtil.getZoomForAutoscaleProperty()
704711
_TCHAR* value = *arg + 16;
705712
if (_tcsicmp(value, _T("false")) == 0) {
706713
autoScaleValue = AUTOSCALE_FALSE;

0 commit comments

Comments
 (0)