@@ -300,18 +300,9 @@ public Shell (Display display, int style) {
300
300
if (handle != 0 && !embedded ) {
301
301
state |= FOREIGN_HANDLE ;
302
302
}
303
-
304
- int shellNativeZoom ;
305
- if (parent != null ) {
306
- shellNativeZoom = parent .nativeZoom ;
307
- } else {
308
- int mappedDPIZoom = getMonitor ().getZoom ();
309
- shellNativeZoom = mappedDPIZoom ;
310
- }
311
- this .nativeZoom = shellNativeZoom ;
312
-
313
303
reskinWidget ();
314
304
createWidget ();
305
+ this .nativeZoom = DPIUtil .mapDPIToZoom (OS .GetDpiForWindow (this .handle ));
315
306
}
316
307
317
308
/**
@@ -2728,26 +2719,6 @@ LRESULT WM_WINDOWPOSCHANGING (long wParam, long lParam) {
2728
2719
return result ;
2729
2720
}
2730
2721
2731
- @ Override
2732
- LRESULT WM_WINDOWPOSCHANGED (long wParam , long lParam ) {
2733
- LRESULT result = super .WM_WINDOWPOSCHANGED (wParam , lParam );
2734
- // When the process is started with System DPI awareness and
2735
- // only the thread is PerMonitorV2 aware, there are some scenarios, when the
2736
- // OS does not send a DPI change event when a child Shell is positioned and
2737
- // opened on another monitor as its parent Shell. To work around that limitation
2738
- // this check is added to trigger a dpi change event if an unexpected DPI value is
2739
- // detected.
2740
- if (display .isRescalingAtRuntime ()) {
2741
- int dpiForWindow = DPIUtil .mapDPIToZoom (OS .GetDpiForWindow (getShell ().handle ));
2742
- if (dpiForWindow != nativeZoom ) {
2743
- WINDOWPOS lpwp = new WINDOWPOS ();
2744
- OS .MoveMemory (lpwp , lParam , WINDOWPOS .sizeof );
2745
- handleMonitorSpecificDpiChange (dpiForWindow , new Rectangle (lpwp .x , lpwp .y , lpwp .cx , lpwp .cy ));
2746
- }
2747
- }
2748
- return result ;
2749
- }
2750
-
2751
2722
private static void handleDPIChange (Widget widget , int newZoom , float scalingFactor ) {
2752
2723
if (!(widget instanceof Shell shell )) {
2753
2724
return ;
0 commit comments