@@ -3157,7 +3157,7 @@ private Rectangle translateRectangleInPixelsInDisplayCoordinateSystem(int x, int
31573157
31583158private Rectangle translateRectangleInPixelsInDisplayCoordinateSystem (int x , int y , int width , int height , Monitor monitorOfLocation , Monitor monitorOfArea ) {
31593159 Point topLeft = getPixelsFromPoint (monitorOfLocation , x , y );
3160- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitorOfArea . zoom );
3160+ int zoom = getApplicableMonitorZoom (monitorOfArea );
31613161 int widthInPixels = DPIUtil .scaleUp (width , zoom );
31623162 int heightInPixels = DPIUtil .scaleUp (height , zoom );
31633163 return new Rectangle (topLeft .x , topLeft .y , widthInPixels , heightInPixels );
@@ -3176,12 +3176,16 @@ private Rectangle translateRectangleInPointsInDisplayCoordinateSystem(int x, int
31763176
31773177private Rectangle translateRectangleInPointsInDisplayCoordinateSystem (int x , int y , int widthInPixels , int heightInPixels , Monitor monitorOfLocation , Monitor monitorOfArea ) {
31783178 Point topLeft = getPointFromPixels (monitorOfLocation , x , y );
3179- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitorOfArea . zoom );
3179+ int zoom = getApplicableMonitorZoom (monitorOfArea );
31803180 int width = DPIUtil .scaleDown (widthInPixels , zoom );
31813181 int height = DPIUtil .scaleDown (heightInPixels , zoom );
31823182 return new Rectangle (topLeft .x , topLeft .y , width , height );
31833183}
31843184
3185+ private int getApplicableMonitorZoom (Monitor monitor ) {
3186+ return DPIUtil .getZoomForAutoscaleProperty (isRescalingAtRuntime () ? monitor .zoom : getDeviceZoom ());
3187+ }
3188+
31853189long messageProc (long hwnd , long msg , long wParam , long lParam ) {
31863190 switch ((int )msg ) {
31873191 case SWT_RUNASYNC : {
@@ -5480,21 +5484,21 @@ private Monitor getContainingMonitorInPixelsCoordinate(int xInPixels, int yInPix
54805484}
54815485
54825486private Rectangle getMonitorClientAreaInPixels (Monitor monitor ) {
5483- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitor . zoom );
5487+ int zoom = getApplicableMonitorZoom (monitor );
54845488 int widthInPixels = DPIUtil .scaleUp (monitor .clientWidth , zoom );
54855489 int heightInPixels = DPIUtil .scaleUp (monitor .clientHeight , zoom );
54865490 return new Rectangle (monitor .clientX , monitor .clientY , widthInPixels , heightInPixels );
54875491}
54885492
54895493private Point getPixelsFromPoint (Monitor monitor , int x , int y ) {
5490- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitor . zoom );
5494+ int zoom = getApplicableMonitorZoom (monitor );
54915495 int mappedX = DPIUtil .scaleUp (x - monitor .clientX , zoom ) + monitor .clientX ;
54925496 int mappedY = DPIUtil .scaleUp (y - monitor .clientY , zoom ) + monitor .clientY ;
54935497 return new Point (mappedX , mappedY );
54945498}
54955499
54965500private Point getPointFromPixels (Monitor monitor , int x , int y ) {
5497- int zoom = DPIUtil . getZoomForAutoscaleProperty (monitor . zoom );
5501+ int zoom = getApplicableMonitorZoom (monitor );
54985502 int mappedX = DPIUtil .scaleDown (x - monitor .clientX , zoom ) + monitor .clientX ;
54995503 int mappedY = DPIUtil .scaleDown (y - monitor .clientY , zoom ) + monitor .clientY ;
55005504 return new Point (mappedX , mappedY );
0 commit comments