diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java index 20dfbd5f2ad..409913812ed 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java @@ -250,7 +250,7 @@ public static Frame new_Frame (final Composite parent) { parent.getDisplay().asyncExec(() -> { if (parent.isDisposed()) return; - final Rectangle clientArea = DPIUtil.scaleUp(parent.getClientArea(), DPIUtil.getZoomForAutoscaleProperty(parent.nativeZoom)); // To Pixels + final Rectangle clientArea = DPIUtil.scaleUp(parent.getClientArea(), parent.nativeZoom); // To Pixels EventQueue.invokeLater(() -> { frame.setSize (clientArea.width, clientArea.height); frame.validate (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java index 46c9bc47b22..acf7a43665a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java @@ -491,7 +491,7 @@ private void drag(Event dragEvent) { hwndDrag = 0; topControl = null; if (image != null) { - int zoom = DPIUtil.getZoomForAutoscaleProperty(nativeZoom); + int zoom = nativeZoom; imagelist = new ImageList(SWT.NONE, zoom); imagelist.add(image); topControl = control.getShell(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java index 0d3f32e137e..6fcc5ecf35f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java @@ -281,7 +281,7 @@ int DragEnter_64(long pDataObject, int grfKeyState, long pt, long pdwEffect) { } int DragEnter(long pDataObject, int grfKeyState, int pt_x, int pt_y, long pdwEffect) { - int zoom = DPIUtil.getZoomForAutoscaleProperty(nativeZoom); + int zoom = nativeZoom; pt_x = DPIUtil.scaleDown(pt_x, zoom);// To Points pt_y = DPIUtil.scaleDown(pt_y, zoom);// To Points selectedDataType = null; @@ -349,7 +349,7 @@ int DragOver_64(int grfKeyState, long pt, long pdwEffect) { } int DragOver(int grfKeyState, int pt_x, int pt_y, long pdwEffect) { - int zoom = DPIUtil.getZoomForAutoscaleProperty(nativeZoom); + int zoom = nativeZoom; pt_x = DPIUtil.scaleDown(pt_x, zoom);// To Points pt_y = DPIUtil.scaleDown(pt_y, zoom);// To Points if (iDataObject == null) return COM.S_FALSE; @@ -405,7 +405,7 @@ int Drop_64(long pDataObject, int grfKeyState, long pt, long pdwEffect) { int Drop(long pDataObject, int grfKeyState, int pt_x, int pt_y, long pdwEffect) { try { - int zoom = DPIUtil.getZoomForAutoscaleProperty(nativeZoom); + int zoom = nativeZoom; pt_x = DPIUtil.scaleDown(pt_x, zoom);// To Points pt_y = DPIUtil.scaleDown(pt_y, zoom);// To Points DNDEvent event = new DNDEvent(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java index 44012702f64..c40b6f49a88 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java @@ -15,7 +15,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.DPIUtil.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.widgets.*; @@ -147,7 +146,7 @@ Image getDragSourceImage(DragSourceEvent event) { data.transparentPixel = shdi.crColorKey << 8; } Display display = control.getDisplay(); - dragSourceImage = new Image(display, new AutoScaleImageDataProvider(display, data, DPIUtil.getZoomForAutoscaleProperty(control.nativeZoom))); + dragSourceImage = new Image(display, new AutoScaleImageDataProvider(display, data, control.nativeZoom)); OS.SelectObject (memHdc, oldMemBitmap); OS.DeleteDC (memHdc); OS.DeleteObject (memDib); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java index a9faebd531c..144dd3ef08e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java @@ -151,7 +151,7 @@ public void dragOver(DropTargetEvent event) { int effect = checkEffect(event.feedback); long handle = table.handle; Point coordinates = new Point(event.x, event.y); - coordinates = DPIUtil.scaleUp(table.toControl(coordinates), DPIUtil.getZoomForAutoscaleProperty(table.nativeZoom)); // To Pixels + coordinates = DPIUtil.scaleUp(table.toControl(coordinates), table.nativeZoom); // To Pixels LVHITTESTINFO pinfo = new LVHITTESTINFO(); pinfo.x = coordinates.x; pinfo.y = coordinates.y; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java index 3e084e64549..ced88f95609 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java @@ -15,7 +15,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.DPIUtil.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.widgets.*; @@ -146,7 +145,7 @@ Image getDragSourceImage(DragSourceEvent event) { data.transparentPixel = shdi.crColorKey << 8; } Display display = control.getDisplay (); - dragSourceImage = new Image (display, new AutoScaleImageDataProvider(display, data, DPIUtil.getZoomForAutoscaleProperty(control.nativeZoom))); + dragSourceImage = new Image (display, new AutoScaleImageDataProvider(display, data, control.nativeZoom)); OS.SelectObject (memHdc, oldMemBitmap); OS.DeleteDC (memHdc); OS.DeleteObject (memDib); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java index 1da890787a3..4b8afe7b772 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java @@ -165,7 +165,7 @@ public void dragOver(DropTargetEvent event) { int effect = checkEffect(event.feedback); long handle = tree.handle; Point coordinates = new Point(event.x, event.y); - coordinates = DPIUtil.scaleUp(tree.toControl(coordinates), DPIUtil.getZoomForAutoscaleProperty(tree.nativeZoom)); // To Pixels + coordinates = DPIUtil.scaleUp(tree.toControl(coordinates), tree.nativeZoom); // To Pixels TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = coordinates.x; lpht.y = coordinates.y; diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java index dc40d634afb..a6a73a93c08 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java @@ -810,7 +810,7 @@ protected int GetWindow(long phwnd) { return COM.S_OK; } RECT getRect() { - Rectangle area = DPIUtil.scaleUp(getClientArea(), DPIUtil.getZoomForAutoscaleProperty(nativeZoom)); // To Pixels + Rectangle area = DPIUtil.scaleUp(getClientArea(), nativeZoom); // To Pixels RECT rect = new RECT(); rect.left = area.x; rect.top = area.y; @@ -987,14 +987,14 @@ private int OnInPlaceDeactivate() { return COM.S_OK; } private int OnPosRectChange(long lprcPosRect) { - Point size = DPIUtil.scaleUp(getSize(), DPIUtil.getZoomForAutoscaleProperty(nativeZoom)); // To Pixels + Point size = DPIUtil.scaleUp(getSize(), nativeZoom); // To Pixels setExtent(size.x, size.y); return COM.S_OK; } private void onPaint(Event e) { if (state == STATE_RUNNING || state == STATE_INPLACEACTIVE) { SIZE size = getExtent(); - Rectangle area = DPIUtil.scaleUp(getClientArea(), DPIUtil.getZoomForAutoscaleProperty(nativeZoom)); // To Pixels + Rectangle area = DPIUtil.scaleUp(getClientArea(), nativeZoom); // To Pixels RECT rect = new RECT(); if (getProgramID().startsWith("Excel.Sheet")) { //$NON-NLS-1$ rect.left = area.x; rect.right = area.x + (area.height * size.cx / size.cy); @@ -1369,7 +1369,7 @@ void setBorderSpace(RECT newBorderwidth) { setBounds(); } void setBounds() { - int zoom = DPIUtil.getZoomForAutoscaleProperty(nativeZoom); + int zoom = nativeZoom; Rectangle area = DPIUtil.scaleDown(frame.getClientArea(), zoom); // To Pixels setBounds(DPIUtil.scaleDown(borderWidths.left, zoom), DPIUtil.scaleDown(borderWidths.top, zoom), diff --git a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/Win32AutoscaleTestBase.java b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/Win32AutoscaleTestBase.java index 2ce05ff4f62..0a7614e2b1c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/Win32AutoscaleTestBase.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/Win32AutoscaleTestBase.java @@ -42,7 +42,7 @@ public void tearDownTest() { protected void changeDPIZoom (int nativeZoom) { DPIUtil.setDeviceZoom(nativeZoom); - float scalingFactor = 1f * DPIUtil.getZoomForAutoscaleProperty(nativeZoom) / DPIUtil.getZoomForAutoscaleProperty(shell.nativeZoom); + float scalingFactor = 1f * nativeZoom / shell.nativeZoom; DPIZoomChangeRegistry.applyChange(shell, nativeZoom, scalingFactor); } } \ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java index c1228581c46..e4a933fed91 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java @@ -175,7 +175,7 @@ public int getLeading() { } private int getZoom() { - return DPIUtil.getZoomForAutoscaleProperty(nativeZoom); + return nativeZoom; } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java index 43eabea38f2..9c1932a19a7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java @@ -3932,7 +3932,7 @@ void init(Drawable drawable, GCData data, long hDC) { } Image image = data.image; if (image != null) { - data.hNullBitmap = OS.SelectObject(hDC, Image.win32_getHandle(image, DPIUtil.getZoomForAutoscaleProperty(data.nativeZoom))); + data.hNullBitmap = OS.SelectObject(hDC, Image.win32_getHandle(image, data.nativeZoom)); image.memGC = this; } int layout = data.layout; @@ -5160,7 +5160,7 @@ private static int sin(int angle, int length) { } private int getZoom() { - return DPIUtil.getZoomForAutoscaleProperty(data.nativeZoom); + return data.nativeZoom; } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java index afed0488e7e..2efd5278fad 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java @@ -2333,7 +2333,7 @@ public void setBackground(Color color) { } private int getZoom() { - return DPIUtil.getZoomForAutoscaleProperty(initialNativeZoom); + return initialNativeZoom; } /** * Returns a string containing a concise, human-readable diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index e09684600af..26697a96504 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -776,11 +776,11 @@ private int getNativeZoom(GC gc) { } private int getZoom(GC gc){ - return DPIUtil.getZoomForAutoscaleProperty(getNativeZoom(gc)); + return getNativeZoom(gc); } private int getZoom() { - return DPIUtil.getZoomForAutoscaleProperty(nativeZoom); + return nativeZoom; } void drawInPixels (GC gc, int x, int y) { 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 03c32a4c72d..b3027ed2875 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 @@ -4905,7 +4905,7 @@ LRESULT WM_DPICHANGED (long wParam, long lParam) { if (newNativeZoom != oldNativeZoom) { DPIUtil.setDeviceZoom (newNativeZoom); - float scalingFactor = 1f * DPIUtil.getZoomForAutoscaleProperty(newNativeZoom) / DPIUtil.getZoomForAutoscaleProperty(oldNativeZoom); + float scalingFactor = 1f * newNativeZoom / oldNativeZoom; DPIZoomChangeRegistry.applyChange(this, newNativeZoom, scalingFactor); RECT rect = new RECT (); @@ -4914,14 +4914,14 @@ LRESULT WM_DPICHANGED (long wParam, long lParam) { return LRESULT.ZERO; } } else { - int newZoom = DPIUtil.getZoomForAutoscaleProperty (newNativeZoom); - int oldZoom = DPIUtil.getZoomForAutoscaleProperty (nativeZoom); + int newZoom = newNativeZoom; + int oldZoom = nativeZoom; if (newZoom != oldZoom) { // Throw the DPI change event if zoom value changes Event event = new Event(); event.type = SWT.ZoomChanged; event.widget = this; - event.detail = DPIUtil.getZoomForAutoscaleProperty(newNativeZoom); + event.detail = newNativeZoom; event.doit = true; notifyListeners(SWT.ZoomChanged, event); return LRESULT.ZERO; 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 bf8020b1ef5..33d21e51c1d 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 @@ -2657,7 +2657,7 @@ GC createNewGC(long hDC, GCData data) { } int getZoom() { - return DPIUtil.getZoomForAutoscaleProperty(nativeZoom); + return nativeZoom; } private static void handleDPIChange(Widget widget, int newZoom, float scalingFactor) {