diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java index 36b8b7a01f..bcfd141fe0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java @@ -82,6 +82,7 @@ public abstract class Control extends Widget implements Drawable { /** Cache for currently processed DPI change event to be able to cancel it if a new one is triggered */ Event currentDpiChangeEvent; + private static final String DATA_SHELL_ZOOM = "SHELL_ZOOM"; /** * Prevents uninitialized instances from being created outside the package. */ @@ -1260,6 +1261,15 @@ public Cursor getCursor () { return cursor; } +@Override +public Object getData(String key) { + if (DATA_SHELL_ZOOM.equals(key)) { + Shell shell = getShell(); + return shell == null ? null : shell.nativeZoom; + } + return super.getData(key); +} + /** * Returns true if the receiver is detecting * drag gestures, and false otherwise. 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 ad2d66abf4..ac9cea0833 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 @@ -134,7 +134,6 @@ public abstract class Widget { static final int AUTO_TEXT_DIRECTION = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; private static final String DATA_AUTOSCALE_DISABLED = "AUTOSCALE_DISABLED"; - private static final String DATA_NATIVE_ZOOM = "NATIVE_ZOOM"; /* Initialize the Common Controls DLL */ static { @@ -189,7 +188,6 @@ public Widget (Widget parent, int style) { display = parent.display; reskinWidget (); notifyCreationTracker(); - this.setData(DATA_NATIVE_ZOOM, this.nativeZoom); registerDPIChangeListener(); } @@ -2727,9 +2725,7 @@ int getZoom() { } void handleDPIChange(Event event, float scalingFactor) { - int newZoom = event.detail; - this.nativeZoom = newZoom; - this.setData(DATA_NATIVE_ZOOM, newZoom); + this.nativeZoom = event.detail; } int getSystemMetrics(int nIndex) {