diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java index 6cb9cf52dd9..9b4744d2c01 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java @@ -300,18 +300,9 @@ public Shell (Display display, int style) { if (handle != 0 && !embedded) { state |= FOREIGN_HANDLE; } - - int shellNativeZoom; - if (parent != null) { - shellNativeZoom = parent.nativeZoom; - } else { - int mappedDPIZoom = getMonitor().getZoom(); - shellNativeZoom = mappedDPIZoom; - } - this.nativeZoom = shellNativeZoom; - reskinWidget(); createWidget (); + this.nativeZoom = DPIUtil.mapDPIToZoom(OS.GetDpiForWindow(this.handle)); } /** @@ -2728,26 +2719,6 @@ LRESULT WM_WINDOWPOSCHANGING (long wParam, long lParam) { return result; } -@Override -LRESULT WM_WINDOWPOSCHANGED (long wParam, long lParam) { - LRESULT result = super.WM_WINDOWPOSCHANGED(wParam, lParam); - // When the process is started with System DPI awareness and - // only the thread is PerMonitorV2 aware, there are some scenarios, when the - // OS does not send a DPI change event when a child Shell is positioned and - // opened on another monitor as its parent Shell. To work around that limitation - // this check is added to trigger a dpi change event if an unexpected DPI value is - // detected. - if (display.isRescalingAtRuntime()) { - int dpiForWindow = DPIUtil.mapDPIToZoom(OS.GetDpiForWindow(getShell().handle)); - if (dpiForWindow != nativeZoom) { - WINDOWPOS lpwp = new WINDOWPOS (); - OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof); - handleMonitorSpecificDpiChange(dpiForWindow, new Rectangle(lpwp.x, lpwp.y, lpwp.cx, lpwp.cy)); - } - } - return result; -} - private static void handleDPIChange(Widget widget, int newZoom, float scalingFactor) { if (!(widget instanceof Shell shell)) { return;