Skip to content

Commit 1b98a2c

Browse files
committed
WIP
1 parent a0a0485 commit 1b98a2c

File tree

1 file changed

+10
-4
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+10
-4
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,8 +1582,11 @@ public Point getLocation() {
15821582
public void setLocation(Point location) {
15831583
if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
15841584
checkWidget ();
1585-
Point locationInPixels = getDisplay().translateToDisplayCoordinates(location, getZoom());
1586-
setLocationInPixels(locationInPixels.x, locationInPixels.y);
1585+
Monitor monitor = location instanceof MonitorAwarePoint monitorAwareLocation ? monitorAwareLocation.getMonitor() : null;
1586+
Point size = getSize();
1587+
MonitorAwareRectangle monAwareBounds = new MonitorAwareRectangle(location.x, location.y, size.x, size.y, monitor);
1588+
Rectangle boundsInPixels = getDisplay().translateToDisplayCoordinates(monAwareBounds, getZoom());
1589+
setLocationInPixels(boundsInPixels.x, boundsInPixels.y);
15871590
}
15881591

15891592
@Override
@@ -1595,8 +1598,11 @@ public void setLocation(int x, int y) {
15951598
public void setBounds(Rectangle rect) {
15961599
if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
15971600
checkWidget ();
1598-
Rectangle boundsInPixels = getDisplay().translateToDisplayCoordinates(rect, getZoom());
1599-
setBoundsInPixels(boundsInPixels.x, boundsInPixels.y, boundsInPixels.width, boundsInPixels.height);
1601+
int zoom = getZoom();
1602+
Rectangle boundsInPixels = getDisplay().translateToDisplayCoordinates(rect, zoom);
1603+
setLocationInPixels(boundsInPixels.x, boundsInPixels.y);
1604+
setSizeInPixels(boundsInPixels.width, boundsInPixels.height);
1605+
// setBoundsInPixels(boundsInPixels.x, boundsInPixels.y, DPIUtil.scaleUp(rect.width, zoom), DPIUtil.scaleUp(rect.height, zoom));
16001606
}
16011607

16021608
@Override

0 commit comments

Comments
 (0)