From 1b3ae7566b59e092c1c079db56c7a8fe629ab3e4 Mon Sep 17 00:00:00 2001 From: Andreas Koch Date: Fri, 1 Aug 2025 07:47:27 +0200 Subject: [PATCH] [win32] Use deviceZoom in single zoom mapper This commit replaces the usage of the zoom attribute in methods in the SingleZoomCoordinateMapper that translate Point and Rectangle from and to display coordinates to use DPIUtil.getDeviceZoom() instead. The implementation was not consistent yet, as e.g. in SingleZoomCoordinateMapper#getCursorLocation or SingleZoomCoordinateMapper#setCursorLocation DPIUtil.getDeviceZoom() is already used. --- .../swt/widgets/SingleZoomCoordinateSystemMapper.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/SingleZoomCoordinateSystemMapper.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/SingleZoomCoordinateSystemMapper.java index 0ef2493a3d1..89ee9cfeb77 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/SingleZoomCoordinateSystemMapper.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/SingleZoomCoordinateSystemMapper.java @@ -77,22 +77,22 @@ public Rectangle mapMonitorBounds(Rectangle rect, int zoom) { @Override public Point translateFromDisplayCoordinates(Point point, int zoom) { - return Win32DPIUtils.pixelToPoint(point, zoom); + return Win32DPIUtils.pixelToPoint(point, DPIUtil.getDeviceZoom()); } @Override public Point translateToDisplayCoordinates(Point point, int zoom) { - return Win32DPIUtils.pointToPixel(point, zoom); + return Win32DPIUtils.pointToPixel(point, DPIUtil.getDeviceZoom()); } @Override public Rectangle translateFromDisplayCoordinates(Rectangle rect, int zoom) { - return Win32DPIUtils.pixelToPoint(rect, zoom); + return Win32DPIUtils.pixelToPoint(rect, DPIUtil.getDeviceZoom()); } @Override public Rectangle translateToDisplayCoordinates(Rectangle rect, int zoom) { - return Win32DPIUtils.pointToPixel(rect, zoom); + return Win32DPIUtils.pointToPixel(rect, DPIUtil.getDeviceZoom()); } @Override