@@ -3157,7 +3157,7 @@ private Rectangle translateRectangleInPixelsInDisplayCoordinateSystem(int x, int
3157
3157
3158
3158
private Rectangle translateRectangleInPixelsInDisplayCoordinateSystem (int x , int y , int width , int height , Monitor monitorOfLocation , Monitor monitorOfArea ) {
3159
3159
Point topLeft = getPixelsFromPoint (monitorOfLocation , x , y );
3160
- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitorOfArea . zoom );
3160
+ int zoom = getApplicableMonitorZoom (monitorOfArea );
3161
3161
int widthInPixels = DPIUtil .scaleUp (width , zoom );
3162
3162
int heightInPixels = DPIUtil .scaleUp (height , zoom );
3163
3163
return new Rectangle (topLeft .x , topLeft .y , widthInPixels , heightInPixels );
@@ -3176,12 +3176,16 @@ private Rectangle translateRectangleInPointsInDisplayCoordinateSystem(int x, int
3176
3176
3177
3177
private Rectangle translateRectangleInPointsInDisplayCoordinateSystem (int x , int y , int widthInPixels , int heightInPixels , Monitor monitorOfLocation , Monitor monitorOfArea ) {
3178
3178
Point topLeft = getPointFromPixels (monitorOfLocation , x , y );
3179
- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitorOfArea . zoom );
3179
+ int zoom = getApplicableMonitorZoom (monitorOfArea );
3180
3180
int width = DPIUtil .scaleDown (widthInPixels , zoom );
3181
3181
int height = DPIUtil .scaleDown (heightInPixels , zoom );
3182
3182
return new Rectangle (topLeft .x , topLeft .y , width , height );
3183
3183
}
3184
3184
3185
+ private int getApplicableMonitorZoom (Monitor monitor ) {
3186
+ return DPIUtil .getZoomForAutoscaleProperty (isRescalingAtRuntime () ? monitor .zoom : getDeviceZoom ());
3187
+ }
3188
+
3185
3189
long messageProc (long hwnd , long msg , long wParam , long lParam ) {
3186
3190
switch ((int )msg ) {
3187
3191
case SWT_RUNASYNC : {
@@ -5480,21 +5484,21 @@ private Monitor getContainingMonitorInPixelsCoordinate(int xInPixels, int yInPix
5480
5484
}
5481
5485
5482
5486
private Rectangle getMonitorClientAreaInPixels (Monitor monitor ) {
5483
- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitor . zoom );
5487
+ int zoom = getApplicableMonitorZoom (monitor );
5484
5488
int widthInPixels = DPIUtil .scaleUp (monitor .clientWidth , zoom );
5485
5489
int heightInPixels = DPIUtil .scaleUp (monitor .clientHeight , zoom );
5486
5490
return new Rectangle (monitor .clientX , monitor .clientY , widthInPixels , heightInPixels );
5487
5491
}
5488
5492
5489
5493
private Point getPixelsFromPoint (Monitor monitor , int x , int y ) {
5490
- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitor . zoom );
5494
+ int zoom = getApplicableMonitorZoom (monitor );
5491
5495
int mappedX = DPIUtil .scaleUp (x - monitor .clientX , zoom ) + monitor .clientX ;
5492
5496
int mappedY = DPIUtil .scaleUp (y - monitor .clientY , zoom ) + monitor .clientY ;
5493
5497
return new Point (mappedX , mappedY );
5494
5498
}
5495
5499
5496
5500
private Point getPointFromPixels (Monitor monitor , int x , int y ) {
5497
- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitor . zoom );
5501
+ int zoom = getApplicableMonitorZoom (monitor );
5498
5502
int mappedX = DPIUtil .scaleDown (x - monitor .clientX , zoom ) + monitor .clientX ;
5499
5503
int mappedY = DPIUtil .scaleDown (y - monitor .clientY , zoom ) + monitor .clientY ;
5500
5504
return new Point (mappedX , mappedY );
0 commit comments