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 a5f1012a56..c4c95379ec 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 @@ -1283,7 +1283,7 @@ public void setData(String key, Object value) { if (autoScaleDisabled) { this.nativeZoom = 100; } else { - this.nativeZoom = (int) getData(DATA_SHELL_ZOOM); + this.nativeZoom = getShellZoom(); } } } @@ -4817,6 +4817,13 @@ int getZoom() { return super.getZoom(); } +int getShellZoom() { + if (getData(DATA_SHELL_ZOOM) instanceof Integer shellZoom) { + return shellZoom; + } + return nativeZoom; +} + abstract TCHAR windowClass (); abstract long windowProc (); @@ -5503,7 +5510,7 @@ LRESULT WM_SETCURSOR (long wParam, long lParam) { if (control == null) return null; Cursor cursor = control.findCursor (); if (cursor != null) { - OS.SetCursor (Cursor.win32_getHandle(cursor, DPIUtil.getZoomForAutoscaleProperty(getNativeZoom()))); + OS.SetCursor (Cursor.win32_getHandle(cursor, DPIUtil.getZoomForAutoscaleProperty(getShellZoom()))); return LRESULT.ONE; } } 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 57cb5a4ee5..7ed302aa9b 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 @@ -2719,7 +2719,7 @@ LRESULT WM_SETCURSOR (long wParam, long lParam) { RECT rect = new RECT (); OS.GetClientRect (handle, rect); if (OS.PtInRect (rect, pt)) { - OS.SetCursor (Cursor.win32_getHandle(cursor, DPIUtil.getZoomForAutoscaleProperty(getNativeZoom()))); + OS.SetCursor (Cursor.win32_getHandle(cursor, DPIUtil.getZoomForAutoscaleProperty(getShellZoom()))); switch (msg) { case OS.WM_LBUTTONDOWN: case OS.WM_RBUTTONDOWN: diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java index 0401ba8641..af34660cfb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java @@ -823,7 +823,7 @@ public void setCursor(Cursor newCursor) { checkWidget(); clientCursor = newCursor; if (newCursor != null) { - if (inEvent) OS.SetCursor (Cursor.win32_getHandle(clientCursor, DPIUtil.getZoomForAutoscaleProperty(getNativeZoom()))); + if (inEvent) OS.SetCursor (Cursor.win32_getHandle(clientCursor, DPIUtil.getZoomForAutoscaleProperty(parent != null ? parent.getShellZoom() : getNativeZoom()))); } } @@ -892,7 +892,7 @@ long transparentProc (long hwnd, long msg, long wParam, long lParam) { break; case OS.WM_SETCURSOR: if (clientCursor != null) { - OS.SetCursor (Cursor.win32_getHandle(clientCursor, DPIUtil.getZoomForAutoscaleProperty(getNativeZoom()))); + OS.SetCursor (Cursor.win32_getHandle(clientCursor, DPIUtil.getZoomForAutoscaleProperty(parent != null ? parent.getShellZoom() : getNativeZoom()))); return 1; } if (resizeCursor != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java index ebad3f7425..dfb0cfd089 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java @@ -4665,7 +4665,7 @@ void setCursor () { * is IDC_ARROW. */ Cursor cursor = findCursor (); - long hCursor = cursor == null ? OS.LoadCursor (0, OS.IDC_ARROW) : Cursor.win32_getHandle(cursor, DPIUtil.getZoomForAutoscaleProperty(getNativeZoom())); + long hCursor = cursor == null ? OS.LoadCursor (0, OS.IDC_ARROW) : Cursor.win32_getHandle(cursor, DPIUtil.getZoomForAutoscaleProperty(getShellZoom())); OS.SetCursor (hCursor); }