diff options
4 files changed, 23 insertions, 19 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java index 7ae45281a5..ba046e6aca 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java @@ -338,12 +338,7 @@ int computeLeftMargin () { boolean hasImage = image != null, hasText = true; if (hasImage) { if (image != null) { - // There exists a possibility of DPI change - if (image.setZoom(this.currentDeviceZoom)) { - _setImage(image); - updateImageList(); - } - Rectangle rect = image.getBounds(getShell().currentDeviceZoom); + Rectangle rect = image.getBounds(this.currentDeviceZoom); width = rect.width; if (hasText && text.length () != 0) { width += MARGIN * 2; @@ -1081,13 +1076,12 @@ public void setText (String string) { @Override public boolean setZoom (int zoom) { boolean refreshed = super.setZoom (zoom); + this.currentDeviceZoom = zoom; // Refresh the image if(image != null) { refreshed = image.setZoom (zoom); - if (refreshed) { - _setImage (image); - updateImageList(); - } + _setImage (image); + updateImageList(); } return refreshed; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index 3499e184b5..a7247ce0cf 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -2025,6 +2025,18 @@ Dialog getModalDialog () { return modalDialog; } +/** + * @since 3.108 + */ +@Override +protected int getDeviceZoom() { + /* Win8.1 and above we pick zoom for the primary monitor zoom. */ + if (OS.WIN32_VERSION >= OS.VERSION (6, 3)) { + return getPrimaryMonitor().getZoom(); + } + return super.getDeviceZoom(); +} + Monitor getMonitor (long /*int*/ hmonitor) { MONITORINFO lpmi = new MONITORINFO (); lpmi.cbSize = MONITORINFO.sizeof; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java index 6067693e39..aa0a5b3a1e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -129,14 +129,13 @@ static int checkStyle (int style) { } @Override -boolean refreshControlForDPIChange() { +public boolean setZoom (int zoom) { boolean refreshed = false; + this.currentDeviceZoom = zoom; // Refresh image on DPI change if(image != null) { refreshed = image.setZoom (this.currentDeviceZoom); - if (refreshed) { - setImage (image); - } + setImage (image); } return refreshed; } @@ -161,8 +160,6 @@ boolean refreshControlForDPIChange() { boolean drawImage = (bits & OS.SS_OWNERDRAW) == OS.SS_OWNERDRAW; if (drawImage) { if (image != null) { - // There exists a possibility of DPI change -// if (image.setZoom(this.currentDeviceZoom)) setImage (image); Rectangle rect = image.getBounds(this.currentDeviceZoom); width += rect.width; height += rect.height; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java index d3f6407e3e..d50dbb18a3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -46,7 +46,8 @@ import org.eclipse.swt.internal.win32.*; */ public abstract class Widget { /** - * s + * Specify current zoom level for the widget. + * * @since 3.108 */ protected int currentDeviceZoom = DPIUtil.getDeviceZoom(); |