Skip to content

Commit b608609

Browse files
HeikoKlarefedejeanne
authored andcommitted
[Win32] Only scale menu item images on monitor-specific scaling #2537
The current mechanism to adapt the size of menu item images based on Windows system metrics, primary monitor zoom at startup and the current monitor zoom ensures that menu item images always fit to the required size for that menu. Since menus and their sizes are managed by the OS, adapting the image size as currently implemented leads to the best fitting image sizes. However, this behavior is incompatible with the assumptions one could previously make on the sizes of those images. In particular, depending on the used auto-scale mode different kinds of scaling for those images were in place. To achieve the best solution for all cases, this change results in the following: - When monitor-specific scaling is enabled, menu item images are properly scaled as required for the menu. This is independent of whether any other additional legacy settings regarding auto-scaling is made, which will be overwritten by this. - When monitor-specific scaling is disabled, the previous behavior is restored such that images are just scaled depending on the auto-scale mode but do not take into account which size is actually needed for that menu. Fixes #2537
1 parent 2d95f10 commit b608609

File tree

1 file changed

+3
-0
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+3
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,9 @@ private long getMenuItemIconSelectedBitmapHandle() {
907907
}
908908

909909
private int adaptZoomForMenuItem(int currentZoom, Image image) {
910+
if (!display.isRescalingAtRuntime()) {
911+
return DPIUtil.getZoomForAutoscaleProperty(currentZoom);
912+
}
910913
int primaryMonitorZoomAtAppStartUp = Win32DPIUtils.getPrimaryMonitorZoomAtStartup();
911914
/*
912915
* Windows has inconsistent behavior when setting the size of MenuItem image and

0 commit comments

Comments
 (0)