diff --git a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java index 7926fb9e16c..759580dc17b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/ControlWin32Tests.java @@ -100,11 +100,11 @@ public void testCorrectScaleUpUsingDifferentSetBoundsMethod() { button.setBounds(new Rectangle(0, 47, 200, 47)); assertEquals("Control::setBounds(Rectangle) doesn't scale up correctly", - new Rectangle(0, 82, 350, 83), button.getBoundsInPixels()); + new Rectangle(0, 82, 350, 82), button.getBoundsInPixels()); button.setBounds(0, 47, 200, 47); assertEquals("Control::setBounds(int, int, int, int) doesn't scale up correctly", - new Rectangle(0, 82, 350, 83), button.getBoundsInPixels()); + new Rectangle(0, 82, 350, 82), button.getBoundsInPixels()); } record FontComparison(int originalFontHeight, int currentFontHeight) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java index 685f0e09be0..02d640a3847 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java @@ -460,6 +460,11 @@ public void setHeight(float height) { this.residualHeight = height - this.height; } + public static Rectangle.OfFloat from(Rectangle rectangle) { + if(rectangle instanceof Rectangle.OfFloat rectangleOfFloat) return rectangleOfFloat; + return new Rectangle.OfFloat(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + } + } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java index 1a5746e7478..131993d9697 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java @@ -127,15 +127,15 @@ public Rectangle getBounds () { Rectangle getBoundsInPixels () { if (image != null) { Rectangle rect = Win32DPIUtils.pointToPixel(image.getBounds(), getZoom()); - return new Rectangle (getXInPixels(), getYInPixels(), rect.width, rect.height); + return new Rectangle.OfFloat (getXInPixels(), getYInPixels(), rect.width, rect.height); } if (width == 0) { int [] buffer = new int [1]; if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) { - return new Rectangle (getXInPixels(), getYInPixels(), buffer [0], getHeightInPixels()); + return new Rectangle.OfFloat (getXInPixels(), getYInPixels(), buffer [0], getHeightInPixels()); } } - return new Rectangle (getXInPixels(), getYInPixels(), getWidthInPixels(), getHeightInPixels()); + return new Rectangle.OfFloat (getXInPixels(), getYInPixels(), getWidthInPixels(), getHeightInPixels()); } /** @@ -185,7 +185,7 @@ public Image getImage () { */ public Point getLocation () { checkWidget(); - return new Point (x, y); + return new Point.OfFloat (x, y); } /** @@ -221,15 +221,15 @@ public Point getSize () { Point getSizeInPixels () { if (image != null) { Rectangle rect = Win32DPIUtils.pointToPixel(image.getBounds(), getZoom()); - return new Point (rect.width, rect.height); + return new Point.OfFloat (rect.width, rect.height); } if (width == 0) { int [] buffer = new int [1]; if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) { - return new Point (buffer [0], getHeightInPixels()); + return new Point.OfFloat (buffer [0], getHeightInPixels()); } } - return new Point (getWidthInPixels(), getHeightInPixels()); + return new Point.OfFloat (getWidthInPixels(), getHeightInPixels()); } private int getWidthInPixels() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java index 1c9a0657202..f06a2cff50b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java @@ -667,7 +667,7 @@ public void clearSelection () { if ((style & SWT.SIMPLE) != 0 && (style & SWT.H_SCROLL) != 0) { height += getSystemMetrics (OS.SM_CYHSCROLL); } - return new Point (width, height); + return new Point.OfFloat (width, height); } /** @@ -960,7 +960,7 @@ Point getCaretLocationInPixels () { point.x = OS.GET_X_LPARAM (caretPos); point.y = OS.GET_Y_LPARAM (caretPos); OS.MapWindowPoints (hwndText, handle, point, 1); - return new Point (point.x, point.y); + return new Point.OfFloat (point.x, point.y); } /** @@ -1283,11 +1283,11 @@ String getSegmentsText (String text, Event event) { public Point getSelection () { checkWidget (); if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) != 0) { - return new Point (0, OS.GetWindowTextLength (handle)); + return new Point.OfFloat (0, OS.GetWindowTextLength (handle)); } int [] start = new int [1], end = new int [1]; OS.SendMessage (handle, OS.CB_GETEDITSEL, start, end); - return new Point (untranslateOffset (start [0]), untranslateOffset (end [0])); + return new Point.OfFloat (untranslateOffset (start [0]), untranslateOffset (end [0])); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java index 32c3bfc0f26..72d0feb2ae7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java @@ -221,7 +221,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int zoom = getZoom(); size = Win32DPIUtils.pointToPixel(layout.computeSize (this, DPIUtil.pixelToPoint(wHint, zoom), DPIUtil.pixelToPoint(hHint, zoom), changed), zoom); } else { - size = new Point (wHint, hHint); + size = new Point.OfFloat (wHint, hHint); } } else { size = minimumSize (wHint, hHint, changed); @@ -236,7 +236,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { */ int zoom = getZoom(); Rectangle trim = Win32DPIUtils.pointToPixel(computeTrim (0, 0, DPIUtil.pixelToPoint(size.x, zoom), DPIUtil.pixelToPoint(size.y, zoom)), zoom); - return new Point (trim.width, trim.height); + return new Point.OfFloat (trim.width, trim.height); } /** @@ -356,7 +356,7 @@ int applyThemeBackground () { public void drawBackground (GC gc, int x, int y, int width, int height, int offsetX, int offsetY) { checkWidget (); int zoom = getZoom(); - Rectangle rectangle = Win32DPIUtils.pointToPixel(new Rectangle(x, y, width, height), zoom); + Rectangle rectangle = Win32DPIUtils.pointToPixel(new Rectangle.OfFloat(x, y, width, height), zoom); offsetX = Win32DPIUtils.pointToPixel(offsetX, zoom); offsetY = Win32DPIUtils.pointToPixel(offsetY, zoom); drawBackgroundInPixels(gc, rectangle.x, rectangle.y, rectangle.width, rectangle.height, offsetX, offsetY); @@ -886,7 +886,7 @@ Point minimumSize (int wHint, int hHint, boolean changed) { width = Math.max (width, rect.x - clientArea.x + rect.width); height = Math.max (height, rect.y - clientArea.y + rect.height); } - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override @@ -1539,7 +1539,7 @@ LRESULT WM_PAINT (long wParam, long lParam) { Event event = new Event (); event.gc = gc; - event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle(ps.left, ps.top, width, height), getZoom())); + event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(ps.left, ps.top, width, height), getZoom())); sendEvent (SWT.Paint, event); if (data.focusDrawn && !isDisposed ()) updateUIState (); gc.dispose (); @@ -1622,7 +1622,7 @@ LRESULT WM_PAINT (long wParam, long lParam) { if ((style & (SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.TRANSPARENT)) == 0) { drawBackground (gc.handle, rect); } - event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top), zoom)); + event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top), zoom)); event.count = count - 1 - i; sendEvent (SWT.Paint, event); } @@ -1632,7 +1632,7 @@ LRESULT WM_PAINT (long wParam, long lParam) { OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom); drawBackground (gc.handle, rect); } - event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle(ps.left, ps.top, width, height), zoom)); + event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(ps.left, ps.top, width, height), zoom)); sendEvent (SWT.Paint, event); } // widget could be disposed at this point @@ -1707,7 +1707,7 @@ LRESULT WM_PRINTCLIENT (long wParam, long lParam) { GC gc = createNewGC(wParam, data); Event event = new Event (); event.gc = gc; - event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top), getZoom())); + event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top), getZoom())); sendEvent (SWT.Paint, event); event.gc = null; gc.dispose (); 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 be5a77eb33e..cd763f5135f 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 @@ -631,7 +631,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int border = getBorderWidthInPixels (); width += border * 2; height += border * 2; - return new Point (width, height); + return new Point.OfFloat (width, height); } Widget computeTabGroup () { @@ -1210,7 +1210,7 @@ Rectangle getBoundsInPixels () { OS.MapWindowPoints (0, hwndParent, rect, 2); int width = rect.right - rect.left; int height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } int getCodePage () { @@ -1381,7 +1381,7 @@ Point getLocationInPixels () { OS.GetWindowRect (topHandle (), rect); long hwndParent = parent == null ? 0 : parent.handle; OS.MapWindowPoints (0, hwndParent, rect, 2); - return new Point (rect.left, rect.top); + return new Point.OfFloat (rect.left, rect.top); } /** @@ -1537,7 +1537,7 @@ Point getSizeInPixels () { OS.GetWindowRect (topHandle (), rect); int width = rect.right - rect.left; int height = rect.bottom - rect.top; - return new Point (width, height); + return new Point.OfFloat (width, height); } /** @@ -2450,7 +2450,7 @@ public void redraw (int x, int y, int width, int height, boolean all) { checkWidget (); int zoom = getZoom(); if (width <= 0 || height <= 0) return; - Rectangle rectangle = Win32DPIUtils.pointToPixel(new Rectangle(x, y, width, height), zoom); + Rectangle rectangle = Win32DPIUtils.pointToPixel(new Rectangle.OfFloat(x, y, width, height), zoom); RECT rect = new RECT (); OS.SetRect (rect, rectangle.x, rectangle.y, rectangle.x + rectangle.width, rectangle.y + rectangle.height); @@ -3186,7 +3186,7 @@ void setBackgroundPixel (int pixel) { * */ public void setBounds(int x, int y, int width, int height) { - setBounds(new Rectangle(x, y, width, height)); + setBounds(new Rectangle.OfFloat(x, y, width, height)); } void setBoundsInPixels (int x, int y, int width, int height) { @@ -3264,7 +3264,7 @@ public void setBounds (Rectangle rect) { checkWidget (); if (rect == null) error (SWT.ERROR_NULL_ARGUMENT); int zoom = autoScaleDisabled ? parent.getZoom() : getZoom(); - setBoundsInPixels(Win32DPIUtils.pointToPixel(rect, zoom)); + setBoundsInPixels(Win32DPIUtils.pointToPixel(Rectangle.OfFloat.from(rect), zoom)); } void setBoundsInPixels (Rectangle rect) { @@ -4029,7 +4029,7 @@ void subclass () { public Point toControl (int x, int y) { checkWidget (); int zoom = getZoom(); - Point displayPointInPixels = getDisplay().translateToDisplayCoordinates(new Point(x, y), zoom); + Point displayPointInPixels = getDisplay().translateToDisplayCoordinates(new Point.OfFloat(x, y), zoom); final Point controlPointInPixels = toControlInPixels(displayPointInPixels.x, displayPointInPixels.y); return Win32DPIUtils.pixelToPoint(controlPointInPixels, zoom); } @@ -4038,7 +4038,7 @@ Point toControlInPixels (int x, int y) { POINT pt = new POINT (); pt.x = x; pt.y = y; OS.ScreenToClient (handle, pt); - return new Point (pt.x, pt.y); + return new Point.OfFloat (pt.x, pt.y); } /** @@ -4098,7 +4098,7 @@ Point toDisplayInPixels (int x, int y) { POINT pt = new POINT (); pt.x = x; pt.y = y; OS.ClientToScreen (handle, pt); - return new Point (pt.x, pt.y); + return new Point.OfFloat (pt.x, pt.y); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java index 3c5e4154162..dd679be9563 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java @@ -194,7 +194,7 @@ protected void checkSubclass () { if (hHint != SWT.DEFAULT) height = hHint; height += border * 2; width += border * 2; - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override @@ -557,7 +557,7 @@ public int getItemCount () { Point [] getItemSizesInPixels () { int count = (int)OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); - Point [] sizes = new Point [count]; + Point [] sizes = new Point.OfFloat [count]; REBARBANDINFO rbBand = new REBARBANDINFO (); rbBand.cbSize = REBARBANDINFO.sizeof; rbBand.fMask = OS.RBBIM_CHILDSIZE; @@ -572,9 +572,9 @@ public int getItemCount () { rect.right += margins.cxRightWidth; if (!isLastItemOfRow(i)) rect.right += separator; if ((style & SWT.VERTICAL) != 0) { - sizes [i] = new Point (rbBand.cyChild, rect.right - rect.left); + sizes [i] = new Point.OfFloat (rbBand.cyChild, rect.right - rect.left); } else { - sizes [i] = new Point (rect.right - rect.left, rbBand.cyChild); + sizes [i] = new Point.OfFloat (rect.right - rect.left, rbBand.cyChild); } } return sizes; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java index c6fdbf273e7..6c6e3f00d44 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java @@ -201,7 +201,7 @@ Point computeSizeInPixels (int wHint, int hHint) { } else { width += parent.getMargin (index); } - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override @@ -242,9 +242,9 @@ Rectangle getBoundsInPixels () { int width = rect.right - rect.left; int height = rect.bottom - rect.top; if ((parent.style & SWT.VERTICAL) != 0) { - return new Rectangle (rect.top, rect.left, height, width); + return new Rectangle.OfFloat (rect.top, rect.left, height, width); } - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } Rectangle getClientArea () { @@ -272,7 +272,7 @@ Rectangle getClientArea () { OS.SendMessage (hwnd, OS.RB_GETBANDINFO, index, rbBand); width = width - rbBand.cxHeader + 1; } - return new Rectangle (x, y, Math.max (0, width), Math.max (0, height)); + return new Rectangle.OfFloat (x, y, Math.max (0, width), Math.max (0, height)); } /** @@ -396,9 +396,9 @@ Point getPreferredSizeInPixels () { OS.SendMessage (hwnd, OS.RB_GETBANDINFO, index, rbBand); int width = rbBand.cxIdeal + parent.getMargin (index); if ((parent.style & SWT.VERTICAL) != 0) { - return new Point (rbBand.cyMaxChild, width); + return new Point.OfFloat (rbBand.cyMaxChild, width); } - return new Point (width, rbBand.cyMaxChild); + return new Point.OfFloat (width, rbBand.cyMaxChild); } /** @@ -502,9 +502,9 @@ Point getSizeInPixels() { int width = rect.right - rect.left; int height = rect.bottom - rect.top; if ((parent.style & SWT.VERTICAL) != 0) { - return new Point (height, width); + return new Point.OfFloat (height, width); } - return new Point (width, height); + return new Point.OfFloat (width, height); } /** @@ -623,9 +623,9 @@ Point getMinimumSizeInPixels () { rbBand.fMask = OS.RBBIM_CHILDSIZE; OS.SendMessage (hwnd, OS.RB_GETBANDINFO, index, rbBand); if ((parent.style & SWT.VERTICAL) != 0) { - return new Point (rbBand.cyMinChild, rbBand.cxMinChild); + return new Point.OfFloat (rbBand.cyMinChild, rbBand.cxMinChild); } - return new Point (rbBand.cxMinChild, rbBand.cyMinChild); + return new Point.OfFloat (rbBand.cxMinChild, rbBand.cyMinChild); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java index 2a247320d95..e880b0e296d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java @@ -249,7 +249,7 @@ protected void checkSubclass () { int border = getBorderWidthInPixels (); width += border * 2; height += border * 2; - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java index a97697a7a02..812ca2f3509 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java @@ -311,7 +311,7 @@ Control computeTabRoot () { OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); } } - return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); + return new Rectangle.OfFloat (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } void createAccelerators () { @@ -415,11 +415,11 @@ void fixDecorations (Decorations newDecorations, Control control, Menu [] menus) if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) { int width = maxRect.right - maxRect.left; int height = maxRect.bottom - maxRect.top; - return new Rectangle (maxRect.left, maxRect.top, width, height); + return new Rectangle.OfFloat (maxRect.left, maxRect.top, width, height); } int width = lpwndpl.right - lpwndpl.left; int height = lpwndpl.bottom - lpwndpl.top; - return new Rectangle (lpwndpl.left, lpwndpl.top, width, height); + return new Rectangle.OfFloat (lpwndpl.left, lpwndpl.top, width, height); } return super.getBoundsInPixels (); } @@ -431,7 +431,7 @@ void fixDecorations (Decorations newDecorations, Control control, Menu [] menus) lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) { - return new Rectangle (0, 0, oldWidth, oldHeight); + return new Rectangle.OfFloat (0, 0, oldWidth, oldHeight); } int width = lpwndpl.right - lpwndpl.left; int height = lpwndpl.bottom - lpwndpl.top; @@ -455,7 +455,7 @@ void fixDecorations (Decorations newDecorations, Control control, Menu [] menus) adjustWindowRectEx(rect, bits1, hasMenu, bits2); width = Math.max (0, width - (rect.right - rect.left)); height = Math.max (0, height - (rect.bottom - rect.top)); - return new Rectangle (0, 0, width, height); + return new Rectangle.OfFloat (0, 0, width, height); } return super.getClientAreaInPixels (); } @@ -547,9 +547,9 @@ public Image getImage () { lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) { - return new Point (maxRect.left, maxRect.top); + return new Point.OfFloat (maxRect.left, maxRect.top); } - return new Point (lpwndpl.left, lpwndpl.top); + return new Point.OfFloat (lpwndpl.left, lpwndpl.top); } return super.getLocationInPixels (); } @@ -622,11 +622,11 @@ String getNameText () { if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) { int width = maxRect.right - maxRect.left; int height = maxRect.bottom - maxRect.top; - return new Point (width, height); + return new Point.OfFloat (width, height); } int width = lpwndpl.right - lpwndpl.left; int height = lpwndpl.bottom - lpwndpl.top; - return new Point (width, height); + return new Point.OfFloat (width, height); } return super.getSizeInPixels (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index 86af0e48be2..d97622f3c46 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -1600,13 +1600,13 @@ Rectangle getBoundsInPixels () { if (OS.GetSystemMetrics (OS.SM_CMONITORS) < 2) { int width = OS.GetSystemMetrics (OS.SM_CXSCREEN); int height = OS.GetSystemMetrics (OS.SM_CYSCREEN); - return new Rectangle (0, 0, width, height); + return new Rectangle.OfFloat (0, 0, width, height); } int x = OS.GetSystemMetrics (OS.SM_XVIRTUALSCREEN); int y = OS.GetSystemMetrics (OS.SM_YVIRTUALSCREEN); int width = OS.GetSystemMetrics (OS.SM_CXVIRTUALSCREEN); int height = OS.GetSystemMetrics (OS.SM_CYVIRTUALSCREEN); - return new Rectangle (x, y, width, height); + return new Rectangle.OfFloat (x, y, width, height); } /** @@ -1675,13 +1675,13 @@ Rectangle getClientAreaInPixels () { OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0); int width = rect.right - rect.left; int height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } int x = OS.GetSystemMetrics (OS.SM_XVIRTUALSCREEN); int y = OS.GetSystemMetrics (OS.SM_YVIRTUALSCREEN); int width = OS.GetSystemMetrics (OS.SM_CXVIRTUALSCREEN); int height = OS.GetSystemMetrics (OS.SM_CYVIRTUALSCREEN); - return new Rectangle (x, y, width, height); + return new Rectangle.OfFloat (x, y, width, height); } Control getControl (long handle) { @@ -1743,13 +1743,13 @@ Rectangle fitRectangleBoundsIntoMonitorWithCursor(RECT rect) { } rectWidth = monitorBoundsRightEnd - rect.left; } - return new Rectangle(rect.left, rect.top, rectWidth, rectHeight); + return new Rectangle.OfFloat(rect.left, rect.top, rectWidth, rectHeight); } Point getCursorLocationInPixels () { POINT pt = new POINT (); OS.GetCursorPos (pt); - return new Point (pt.x, pt.y); + return new Point.OfFloat (pt.x, pt.y); } /** @@ -1767,7 +1767,7 @@ Point getCursorLocationInPixels () { public Point [] getCursorSizes () { checkDevice (); return new Point [] { - new Point (OS.GetSystemMetrics (OS.SM_CXCURSOR), OS.GetSystemMetrics (OS.SM_CYCURSOR))}; + new Point.OfFloat (OS.GetSystemMetrics (OS.SM_CXCURSOR), OS.GetSystemMetrics (OS.SM_CYCURSOR))}; } /** @@ -2032,8 +2032,8 @@ public int getIconDepth () { public Point [] getIconSizes () { checkDevice (); return new Point [] { - new Point (OS.GetSystemMetrics (OS.SM_CXSMICON), OS.GetSystemMetrics (OS.SM_CYSMICON)), - new Point (OS.GetSystemMetrics (OS.SM_CXICON), OS.GetSystemMetrics (OS.SM_CYICON)), + new Point.OfFloat (OS.GetSystemMetrics (OS.SM_CXSMICON), OS.GetSystemMetrics (OS.SM_CYSMICON)), + new Point.OfFloat (OS.GetSystemMetrics (OS.SM_CXICON), OS.GetSystemMetrics (OS.SM_CYICON)), }; } @@ -2222,8 +2222,8 @@ Monitor getMonitor (long hmonitor) { OS.GetMonitorInfo (hmonitor, lpmi); Monitor monitor = new Monitor (); monitor.handle = hmonitor; - Rectangle boundsInPixels = new Rectangle(lpmi.rcMonitor_left, lpmi.rcMonitor_top, lpmi.rcMonitor_right - lpmi.rcMonitor_left,lpmi.rcMonitor_bottom - lpmi.rcMonitor_top); - Rectangle clientAreaInPixels = new Rectangle(lpmi.rcWork_left, lpmi.rcWork_top, lpmi.rcWork_right - lpmi.rcWork_left, lpmi.rcWork_bottom - lpmi.rcWork_top); + Rectangle boundsInPixels = new Rectangle.OfFloat(lpmi.rcMonitor_left, lpmi.rcMonitor_top, lpmi.rcMonitor_right - lpmi.rcMonitor_left,lpmi.rcMonitor_bottom - lpmi.rcMonitor_top); + Rectangle clientAreaInPixels = new Rectangle.OfFloat(lpmi.rcWork_left, lpmi.rcWork_top, lpmi.rcWork_right - lpmi.rcWork_left, lpmi.rcWork_bottom - lpmi.rcWork_top); int [] dpiX = new int[1]; int [] dpiY = new int[1]; int result = OS.GetDpiForMonitor (monitor.handle, OS.MDT_EFFECTIVE_DPI, dpiX, dpiY); @@ -3051,14 +3051,14 @@ public Point map (Control from, Control to, int x, int y) { Point mapInPixels (Control from, Control to, int x, int y) { if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - if (from == to) return new Point (x, y); + if (from == to) return new Point.OfFloat (x, y); long hwndFrom = from != null ? from.handle : 0; long hwndTo = to != null ? to.handle : 0; POINT point = new POINT (); point.x = x; point.y = y; OS.MapWindowPoints (hwndFrom, hwndTo, point, 1); - return new Point (point.x, point.y); + return new Point.OfFloat (point.x, point.y); } /** @@ -3153,7 +3153,7 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei Rectangle mapInPixels (Control from, Control to, int x, int y, int width, int height) { if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - if (from == to) return new Rectangle (x, y, width, height); + if (from == to) return new Rectangle.OfFloat (x, y, width, height); long hwndFrom = from != null ? from.handle : 0; long hwndTo = to != null ? to.handle : 0; RECT rect = new RECT (); @@ -3162,7 +3162,7 @@ Rectangle mapInPixels (Control from, Control to, int x, int y, int width, int he rect.right = x + width; rect.bottom = y + height; OS.MapWindowPoints (hwndFrom, hwndTo, rect, 2); - return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); + return new Rectangle.OfFloat (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } Point translateFromDisplayCoordinates(Point point, int zoom) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java index d7511ea77ce..3ebf778e8b3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java @@ -175,7 +175,7 @@ static int checkStyle (int style) { if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; Rectangle trim = computeTrimInPixels (0, 0, width, height); - return new Point (trim.width, trim.height); + return new Point.OfFloat (trim.width, trim.height); } @Override @@ -789,7 +789,7 @@ LRESULT WM_PAINT (long wParam, long lParam) { if (hooks (SWT.Paint) || filters (SWT.Paint)) { Event event = new Event (); event.gc = gc; - event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle(rect.left, rect.top, width, height), getZoom())); + event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(rect.left, rect.top, width, height), getZoom())); sendEvent (SWT.Paint, event); event.gc = null; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java index 357fa87b9cc..54940ae2c24 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java @@ -256,7 +256,7 @@ String fixText (boolean enabled) { int x = CLIENT_INSET, y = tm.tmHeight + offsetY; int width = Math.max (0, rect.right - CLIENT_INSET * 2); int height = Math.max (0, rect.bottom - y - CLIENT_INSET); - return new Rectangle (x, y, width, height); + return new Rectangle.OfFloat (x, y, width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java index f23863896fb..670c7b73742 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java @@ -144,7 +144,7 @@ static int checkStyle (int style) { if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; width += border * 2; height += border * 2; - return new Point (width, height); + return new Point.OfFloat (width, height); } if (isImageMode) { Rectangle rect = Win32DPIUtils.scaleBounds(image.getBounds(), this.getZoom(), 100); @@ -179,7 +179,7 @@ static int checkStyle (int style) { if (hHint != SWT.DEFAULT) height = hHint; width += border * 2; height += border * 2; - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java index 92b992cb558..a59ef548f04 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java @@ -188,7 +188,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int border = getBorderWidthInPixels (); width += border * 2; height += border * 2; - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java index 0297d320214..11d4adc0456 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java @@ -265,7 +265,7 @@ static int checkStyle (int style) { if ((style & SWT.H_SCROLL) != 0) { height += getSystemMetrics (OS.SM_CYHSCROLL); } - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java index 3a6428e4a58..2d176a7cc48 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java @@ -1188,7 +1188,7 @@ public void setEnabled (boolean enabled) { * */ public void setLocation (int x, int y) { - setLocation(new Point(x, y)); + setLocation(new Point.OfFloat(x, y)); } void setLocationInPixels (int x, int y) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java index d853c154027..be8d12f5bf5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java @@ -344,7 +344,7 @@ public int getAccelerator () { int y = info2.top - info1.top; int width = info2.right - info2.left; int height = info2.bottom - info2.top; - return new Rectangle (x, y, width, height); + return new Rectangle.OfFloat (x, y, width, height); } else { long hMenu = parent.handle; RECT rect1 = new RECT (); @@ -359,7 +359,7 @@ public int getAccelerator () { int y = rect2.top - rect1.top + 2; int width = rect2.right - rect2.left; int height = rect2.bottom - rect2.top; - return new Rectangle (x, y, width, height); + return new Rectangle.OfFloat (x, y, width, height); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java index a720997c004..6fa9f21a2f7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java @@ -14,9 +14,9 @@ package org.eclipse.swt.widgets; -import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.win32.*; /** * Instances of the receiver represent an unselectable @@ -131,7 +131,7 @@ static int checkStyle (int style) { } if (wHint != SWT.DEFAULT) width = wHint + (border * 2); if (hHint != SWT.DEFAULT) height = hHint + (border * 2); - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java index 85f2ea48cc6..5ba5b8f8174 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java @@ -137,7 +137,7 @@ static int checkStyle (int style) { } if (wHint != SWT.DEFAULT) width = wHint + (border * 2); if (hHint != SWT.DEFAULT) height = hHint + (border * 2); - return new Point (width, height); + return new Point.OfFloat (width, height); } void drawBand (int x, int y, int width, int height) { @@ -244,7 +244,7 @@ LRESULT WM_KEYDOWN (long wParam, long lParam) { OS.SetCursorPos (cursorPt.x, cursorPt.y); Event event = new Event (); - event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle(newX, newY, width, height), getZoom())); + event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(newX, newY, width, height), getZoom())); sendSelectionEvent (SWT.Selection, event, true); if (isDisposed ()) return LRESULT.ZERO; if (event.doit) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java index d1557658cfe..d01f8b9a86e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java @@ -160,7 +160,7 @@ static int checkStyle (int style) { } if (wHint != SWT.DEFAULT) width = wHint + (border * 2); if (hHint != SWT.DEFAULT) height = hHint + (border * 2); - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java index 5f55c9f850f..4e1b250355a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java @@ -205,7 +205,7 @@ Rectangle getBounds () { width = getSystemMetrics (OS.SM_CXVSCROLL); height = rect.bottom - rect.top; } - return new Rectangle (x, y, width, height); + return new Rectangle.OfFloat (x, y, width, height); } /** @@ -370,7 +370,7 @@ Point getSizeInPixels () { width = getSystemMetrics (OS.SM_CXVSCROLL); height = rect.bottom - rect.top; } - return new Point (width, height); + return new Point.OfFloat (width, height); } /** @@ -439,7 +439,7 @@ Rectangle getThumbBoundsInPixels () { rect.right = x + width; rect.bottom = y + height; OS.MapWindowPoints (0, parent.handle, rect, 2); - return new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); + return new Rectangle.OfFloat(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } /** @@ -499,7 +499,7 @@ Rectangle getThumbTrackBoundsInPixels () { rect.right = x + width; rect.bottom = y + height; OS.MapWindowPoints (0, parent.handle, rect, 2); - return new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); + return new Rectangle.OfFloat(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java index e6d4dd8fc01..242b0a93107 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java @@ -121,7 +121,7 @@ long callWindowProc (long hwnd, int msg, long wParam, long lParam) { public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget (); int zoom = getZoom(); - Rectangle rectangle = Win32DPIUtils.pointToPixel(new Rectangle(x, y, width, height), zoom); + Rectangle rectangle = Win32DPIUtils.pointToPixel(new Rectangle.OfFloat(x, y, width, height), zoom); return Win32DPIUtils.pixelToPoint(computeTrimInPixels(rectangle.x, rectangle.y, rectangle.width, rectangle.height), zoom); } @@ -135,7 +135,7 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) { if (horizontalBar != null) rect.bottom += getSystemMetrics (OS.SM_CYHSCROLL); if (verticalBar != null) rect.right += getSystemMetrics (OS.SM_CXVSCROLL); int nWidth = rect.right - rect.left, nHeight = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, nWidth, nHeight); + return new Rectangle.OfFloat (rect.left, rect.top, nWidth, nHeight); } @Override @@ -227,7 +227,7 @@ Rectangle getClientAreaInPixels () { x = -rect.left; y = -rect.top; } - return new Rectangle (x, y, width, height); + return new Rectangle.OfFloat (x, y, width, height); } /** 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 da1e195fa23..f9d2b480314 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 @@ -924,7 +924,7 @@ public int getAlpha () { OS.GetWindowRect (handle, rect); int width = rect.right - rect.left; int height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } ToolTip getCurrentToolTip () { @@ -1017,7 +1017,7 @@ public int getImeInputMode () { if (OS.IsIconic (handle)) return super.getLocationInPixels (); RECT rect = new RECT (); OS.GetWindowRect (handle, rect); - return new Point (rect.left, rect.top); + return new Point.OfFloat (rect.left, rect.top); } @Override @@ -1064,7 +1064,7 @@ Point getMaximumSizeInPixels () { height = Math.min (height, rect.bottom - rect.top); } } - return new Point (width, height); + return new Point.OfFloat (width, height); } /** @@ -1105,7 +1105,7 @@ Point getMinimumSizeInPixels () { height = Math.max (height, rect.bottom - rect.top); } } - return new Point (width, height); + return new Point.OfFloat (width, height); } /** @@ -1157,7 +1157,7 @@ public Shell getShell () { OS.GetWindowRect (handle, rect); int width = rect.right - rect.left; int height = rect.bottom - rect.top; - return new Point (width, height); + return new Point.OfFloat (width, height); } /** @@ -1580,7 +1580,7 @@ public void setLocation(Point location) { @Override public void setLocation(int x, int y) { - setLocation(new Point(x, y)); + setLocation(new Point.OfFloat(x, y)); } @Override @@ -1598,7 +1598,7 @@ public void setBounds(Rectangle rect) { @Override public void setBounds(int x, int y, int width, int height) { - setBounds(new Rectangle(x, y, width, height)); + setBounds(new Rectangle.OfFloat(x, y, width, height)); } @Override @@ -2276,7 +2276,7 @@ Rectangle getClientRectInWindow () { RECT clientRect = new RECT (); OS.GetClientRect (handle, clientRect); - return new Rectangle( + return new Rectangle.OfFloat( clientWindowLT.x + clientRect.left, clientWindowLT.y + clientRect.top, clientRect.right - clientRect.left, diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java index ff3f52d0b84..2ba458d90a4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java @@ -189,7 +189,7 @@ static int checkStyle (int style) { } if (wHint != SWT.DEFAULT) width = wHint + (border * 2); if (hHint != SWT.DEFAULT) height = hHint + (border * 2); - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java index b8d14dc4b7f..49a6e33fe22 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java @@ -301,7 +301,7 @@ void addVerifyListener (VerifyListener listener) { } Rectangle trim = computeTrimInPixels (0, 0, width, height); - return new Point (trim.width, trim.height); + return new Point.OfFloat (trim.width, trim.height); } @Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { @@ -340,7 +340,7 @@ void addVerifyListener (VerifyListener listener) { height += 2; } width += getSystemMetrics (OS.SM_CXVSCROLL); - return new Rectangle (x, y, width, height); + return new Rectangle.OfFloat (x, y, width, height); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java index 445ab74aecd..74c7864cf4e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java @@ -210,7 +210,7 @@ protected void checkSubclass () { rect.top -= border; rect.bottom += border; int newWidth = rect.right - rect.left; int newHeight = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, newWidth, newHeight); + return new Rectangle.OfFloat (rect.left, rect.top, newWidth, newHeight); } void createItem (TabItem item, int index) { @@ -316,7 +316,7 @@ Control findThemeControl () { OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, rect); int width = rect.right - rect.left; int height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } /** @@ -523,7 +523,7 @@ Point minimumSize (int wHint, int hHint, boolean flushCache) { height = Math.max (height, size.y); } } - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java index 7153b569a2c..5ebb1e3f012 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java @@ -199,7 +199,7 @@ Rectangle getBoundsInPixels() { if (index == -1) return new Rectangle (0, 0, 0, 0); RECT itemRect = new RECT (); OS.SendMessage (parent.handle, OS.TCM_GETITEMRECT, index, itemRect); - return new Rectangle(itemRect.left, itemRect.top, itemRect.right - itemRect.left, itemRect.bottom - itemRect.top); + return new Rectangle.OfFloat(itemRect.left, itemRect.top, itemRect.right - itemRect.left, itemRect.bottom - itemRect.top); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java index 19795ce63f4..7704b6daa64 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java @@ -1484,7 +1484,7 @@ public void clearAll () { if ((style & SWT.H_SCROLL) != 0) { height += getSystemMetrics (OS.SM_CYHSCROLL); } - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override @@ -3484,7 +3484,7 @@ void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd, long lParam, Event if (drawHot) event.detail |= SWT.HOT; if (drawSelected) event.detail |= SWT.SELECTED; if (drawBackground) event.detail |= SWT.BACKGROUND; - Rectangle bounds = Win32DPIUtils.pixelToPoint(new Rectangle (cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top), getZoom()); + Rectangle bounds = Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat (cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top), getZoom()); event.setBounds (bounds); gc.setClipping (bounds); sendEvent (SWT.EraseItem, event); @@ -7297,7 +7297,7 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long lParam) { if (image != null) { Rectangle rect = Win32DPIUtils.pointToPixel(image.getBounds(), getZoom()); RECT imageRect = item.getBounds (pinfo.iItem, pinfo.iSubItem, false, true, false, false, hDC); - Point size = imageList == null ? new Point (rect.width, rect.height) : imageList.getImageSize (); + Point size = imageList == null ? new Point.OfFloat (rect.width, rect.height) : imageList.getImageSize (); int y = imageRect.top + Math.max (0, (imageRect.bottom - imageRect.top - size.y) / 2); int zoom = getZoom(); rect = Win32DPIUtils.pixelToPoint(rect, zoom); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java index 2d2f01686d1..e7836485229 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java @@ -227,7 +227,7 @@ Rectangle getBoundsInPixels () { if (itemIndex == -1) return new Rectangle (0, 0, 0, 0); RECT rect = getBounds (itemIndex, 0, true, false, false); int width = rect.right - rect.left, height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } /** @@ -253,7 +253,7 @@ Rectangle getBoundsInPixels (int index) { if (itemIndex == -1) return new Rectangle (0, 0, 0, 0); RECT rect = getBounds (itemIndex, index, true, true, true); int width = rect.right - rect.left, height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } RECT getBounds (int row, int column, boolean getText, boolean getImage, boolean fullText) { @@ -599,7 +599,7 @@ Rectangle getImageBoundsInPixels (int index) { if (itemIndex == -1) return new Rectangle (0, 0, 0, 0); RECT rect = getBounds (itemIndex, index, false, true, false); int width = rect.right - rect.left, height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } /** @@ -705,7 +705,7 @@ Rectangle getTextBoundsInPixels (int index) { rect.right = rect.right - Table.INSET; int width = Math.max (0, rect.right - rect.left); int height = Math.max (0, rect.bottom - rect.top); - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } void redraw () { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java index 537ca150583..010ee0326db 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java @@ -748,7 +748,7 @@ public void clearSelection () { if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; Rectangle trim = computeTrimInPixels (0, 0, width, height); - return new Point (trim.width, trim.height); + return new Point.OfFloat (trim.width, trim.height); } @Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { @@ -1030,7 +1030,7 @@ Point getCaretLocationInPixels () { OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]); } } - return new Point (OS.GET_X_LPARAM (caretPos), OS.GET_Y_LPARAM (caretPos)); + return new Point.OfFloat (OS.GET_X_LPARAM (caretPos), OS.GET_Y_LPARAM (caretPos)); } /** @@ -1313,7 +1313,7 @@ public Point getSelection () { checkWidget (); int [] start = new int [1], end = new int [1]; OS.SendMessage (handle, OS.EM_GETSEL, start, end); - return new Point (untranslateOffset (start [0]), untranslateOffset (end [0])); + return new Point.OfFloat (untranslateOffset (start [0]), untranslateOffset (end [0])); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java index 53a799007ff..22ae8142c1a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java @@ -213,7 +213,7 @@ void clearSizeCache(boolean changed) { int count = (int)OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0); if (count == this._count && wHint == this._wHint && hHint == this._hHint) { // Return already cached values calculated previously - return new Point (_width, _height); + return new Point.OfFloat (_width, _height); } this._count = count; this._wHint = wHint; @@ -279,7 +279,7 @@ void clearSizeCache(boolean changed) { */ this._width = width; this._height = height; - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java index 3effd4b3c96..f104c4905bd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java @@ -245,7 +245,7 @@ Rectangle getBoundsInPixels () { OS.SendMessage (hwnd, OS.TB_GETITEMRECT, index, rect); int width = rect.right - rect.left; int height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } /** 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 0401ba86413..603de141d87 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 @@ -205,7 +205,7 @@ Point adjustMoveCursor () { OS.ClientToScreen (parent.handle, pt); } OS.SetCursorPos (pt.x, pt.y); - return new Point (pt.x, pt.y); + return new Point.OfFloat (pt.x, pt.y); } Point adjustResizeCursor () { @@ -280,7 +280,7 @@ Point adjustResizeCursor () { resizeCursor = newCursor; } - return new Point (pt.x, pt.y); + return new Point.OfFloat (pt.x, pt.y); } static int checkStyle (int style) { @@ -320,7 +320,7 @@ Rectangle computeBounds () { if (rectBottom > yMax) yMax = rectBottom; } - return new Rectangle (xMin, yMin, xMax - xMin, yMax - yMin); + return new Rectangle.OfFloat (xMin, yMin, xMax - xMin, yMax - yMin); } Rectangle [] computeProportions (Rectangle [] rects) { @@ -341,7 +341,7 @@ Rectangle computeBounds () { } else { height = 100; } - result [i] = new Rectangle (x, y, width, height); + result [i] = new Rectangle.OfFloat (x, y, width, height); } } return result; @@ -414,7 +414,7 @@ void drawRectangles (Rectangle [] rects, boolean stippled) { Rectangle [] result = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { Rectangle current = rectangles [i]; - result [i] = new Rectangle (current.x, current.y, current.width, current.height); + result [i] = Rectangle.OfFloat.from(current); } return result; } @@ -556,7 +556,7 @@ public boolean open () { if (mouseDown) { POINT pt = new POINT (); OS.GetCursorPos (pt); - cursorPos = new Point (pt.x, pt.y); + cursorPos = new Point.OfFloat (pt.x, pt.y); } else { if ((style & SWT.RESIZE) != 0) { cursorPos = adjustResizeCursor (); @@ -799,7 +799,7 @@ void resizeRectangles (int xChange, int yChange) { Rectangle [] newRects = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { Rectangle proportion = proportions[i]; - newRects[i] = new Rectangle ( + newRects[i] = new Rectangle.OfFloat ( proportion.x * bounds.width / 100 + bounds.x, proportion.y * bounds.height / 100 + bounds.y, proportion.width * bounds.width / 100, @@ -856,7 +856,7 @@ void setRectanglesInPixels (Rectangle [] rectangles) { for (int i = 0; i < rectangles.length; i++) { Rectangle current = rectangles [i]; if (current == null) error (SWT.ERROR_NULL_ARGUMENT); - this.rectangles [i] = new Rectangle (current.x, current.y, current.width, current.height); + this.rectangles [i] = Rectangle.OfFloat.from(current); } proportions = computeProportions (rectangles); } @@ -996,7 +996,7 @@ LRESULT wmKeyDown (long hwnd, long wParam, long lParam) { Rectangle [] rectsToErase = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { Rectangle current = rectangles [i]; - rectsToErase [i] = new Rectangle (current.x, current.y, current.width, current.height); + rectsToErase [i] = Rectangle.OfFloat.from(current); } Event event = new Event (); event.setLocation(DPIUtil.pixelToPoint(oldX + xChange, getZoom()), DPIUtil.pixelToPoint(oldY + yChange, getZoom())); @@ -1116,7 +1116,7 @@ LRESULT wmMouse (int message, long wParam, long lParam) { Rectangle [] rectsToErase = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { Rectangle current = rectangles [i]; - rectsToErase [i] = new Rectangle (current.x, current.y, current.width, current.height); + rectsToErase [i] = new Rectangle.OfFloat (current.x, current.y, current.width, current.height); } Event event = new Event (); int zoom = getZoom(); 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 b5d05dcb34f..9d4d713c75e 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 @@ -530,7 +530,7 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long wParam, long lParam) { data.device = display; GC gc = createNewGC(hDC, data); RECT iconRect = item.getBounds (index, false, true, false, false, true, hDC); // Pixels - gc.setClipping (Win32DPIUtils.pixelToPoint(new Rectangle(iconRect.left, iconRect.top, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top), zoom)); + gc.setClipping (Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(iconRect.left, iconRect.top, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top), zoom)); gc.drawImage (image, 0, 0, bounds.width, bounds.height, DPIUtil.pixelToPoint(iconRect.left, zoom), DPIUtil.pixelToPoint(iconRect.top, zoom), size.x, size.y); OS.SelectClipRgn (hDC, 0); gc.dispose (); @@ -1865,7 +1865,7 @@ long CompareFunc (long lParam1, long lParam2, long lParamSort) { if ((style & SWT.H_SCROLL) != 0) { height += getSystemMetrics (OS.SM_CYHSCROLL); } - return new Point (width, height); + return new Point.OfFloat (width, height); } @Override @@ -3059,7 +3059,7 @@ public boolean getHeaderVisible () { Point getImageSize () { if (imageList != null) return imageList.getImageSize (); - return new Point (0, getItemHeightInPixels ()); + return new Point.OfFloat (0, getItemHeightInPixels ()); } long getBottomItem () { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java index 36158c18041..04174a41bd5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java @@ -382,7 +382,7 @@ Rectangle getBoundsInPixels () { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); RECT rect = getBounds (0, true, false, false); int width = rect.right - rect.left, height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } /** @@ -408,7 +408,7 @@ Rectangle getBoundsInPixels (int index) { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); RECT rect = getBounds (index, true, true, true); int width = rect.right - rect.left, height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } RECT getBounds (int index, boolean getText, boolean getImage, boolean fullText) { @@ -824,7 +824,7 @@ Rectangle getImageBoundsInPixels (int index) { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); RECT rect = getBounds (index, false, true, false); int width = rect.right - rect.left, height = rect.bottom - rect.top; - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } /** @@ -923,7 +923,7 @@ Rectangle getTextBoundsInPixels (int index) { rect.right = rect.right - Tree.INSET + 1; // Add 1 px margin to avoid truncation of text seen with "Segoe UI" font int width = Math.max (0, rect.right - rect.left); int height = Math.max (0, rect.bottom - rect.top); - return new Rectangle (rect.left, rect.top, width, height); + return new Rectangle.OfFloat (rect.left, rect.top, width, height); } /** 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 6297100ff16..6802b13746f 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 @@ -2362,7 +2362,7 @@ LRESULT wmPaint (long hwnd, long wParam, long lParam) { OS.SetMetaRgn (hDC); Event event = new Event (); event.gc = gc; - event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle(rect.left, rect.top, width, height), getZoom())); + event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(rect.left, rect.top, width, height), getZoom())); sendEvent (SWT.Paint, event); // widget could be disposed at this point event.gc = null;