-
Notifications
You must be signed in to change notification settings - Fork 187
[win32] Use deviceZoom in single zoom mapper #2379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[win32] Use deviceZoom in single zoom mapper #2379
Conversation
This commit replaces the usage of the zoom attribute in methods in the SingleZoomCoordinateMapper that translate Point and Rectangle from and to display coordinates to use DPIUtil.getDeviceZoom() instead. The implementation was not consistent yet, as e.g. in SingleZoomCoordinateMapper#getCursorLocation or SingleZoomCoordinateMapper#setCursorLocation DPIUtil.getDeviceZoom() is already used.
0bac779 to
1b3ae75
Compare
HeikoKlare
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change definitely makes sense. As a follow up, we should remove the obsolete zoom parameter of those methods.
I wonder if the mapMonitorBounds() method is not affected in the same way?
One consumer is the Display#getMonitor() method:
eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
Line 2233 in 9baef58
| monitor.setBounds(coordinateSystemMapper.mapMonitorBounds(boundsInPixels, autoscaleZoom)); |
Shouldn't those bounds also be scaled according to the device zoom instead of the zoom of that specific monitor in case of a single zoom mapper? Otherwise with a 100% primary monitor and a 200% secondary monitor, I would expect the bounds of the secondary monitor, scaled with 200% instead of 100%, to be wrong.
Yes, I thought about that, but wanted to come up with a test for that. But I think we will need to adapt those as well. |
Alright, we can also keep that for a separate PR and merge this one as is. |
|
I would propose to do that separately and merge this PR as is. I will test the original behavior to add a proper test set for mapMonitorBounds to ensure the correct behavior. |
This PR replaces the usage of the zoom attribute in methods in the
SingleZoomCoordinateMapperthat translatePointandRectanglefrom and to display coordinates to useDPIUtil.getDeviceZoom()instead. As each widget inherits its zoom fromDPIUtil.getDeviceZoom()when theSingleZoomCoordinateMapperis involved, the behavior is not changed in most scenarios. but this PR fixes the scenarios, if a widget is scaled to a different zoom, e.g. by utilizingwidget.setData("AUTOSCALE_DISABLED", true)the current implementation will break all conversions. One important factor in the CoordinateMapper implementation is to have a consistent translation from and to display coordinates. In theMultiZoomCoordinateSystemMapperthis is achieved by extracting the Monitor (zoom) out of the coordinate to translate. InSingleZoomCoordinateMapper, the implementation was not consistent yet, as e.g. inSingleZoomCoordinateMapper#getCursorLocationorSingleZoomCoordinateMapper#setCursorLocationDPIUtil.getDeviceZoom()is already used.