-
Notifications
You must be signed in to change notification settings - Fork 145
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
Use monitor-aware coordinates in multi-zoom coordinate system #1711
Use monitor-aware coordinates in multi-zoom coordinate system #1711
Conversation
Test Results 494 files ± 0 494 suites ±0 9m 17s ⏱️ -34s Results for commit 9a1c825. ± Comparison against base commit d441a95. This pull request removes 6 and adds 10 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
fd6873d
to
6cbb93d
Compare
d1645d4
to
144227b
Compare
144227b
to
64c848a
Compare
@amartya4256 I see this PR is a WiP (based on the commit text), which is fine for me, but please add some description to the PR (the issue that is fixed, intended result, how to test it, etc). For the moment I can only do an initial review of the coding standards and so on. |
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java
Show resolved
Hide resolved
...g.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MultiZoomCoordinateSystemMapper.java
Outdated
Show resolved
Hide resolved
...g.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MultiZoomCoordinateSystemMapper.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
Outdated
Show resolved
Hide resolved
64c848a
to
e4cfebc
Compare
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.
I played around a bit with it and this is what I found
When rescaling at runtime is deactivated
- Moving the workbench window between 2 monitors with different zoom rescales the menu bar according to the zoom of the monitor.
IIRC this is expected so I do not consider it a bug.
When rescaling at runtime is activated
No findings
e4cfebc
to
4a11d0b
Compare
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java
Outdated
Show resolved
Hide resolved
...g.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MultiZoomCoordinateSystemMapper.java
Outdated
Show resolved
Hide resolved
8cbb1d0
to
983b271
Compare
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.
No testing and in-depth review from my side so far, but at least one important point from my side: please mark the new classes as "not API" (i.e., "noreference"), as we should not make them public API (at least for now).
Please also improve the commit message to shortly explain the reasons for the change and what it does, so that people can later on generally understand what the commit does. Please also add that commit description to the PR description, in the based case with some how-to-test information.
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java
Show resolved
Hide resolved
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.
Looks better, I only found some unnecessary empty lines.
Let me know when this PR is ready to be tested again. If you (plan to) make more changes please don't squash the commits so I can review better. You (or I) can squash the commits once the PR has been approved by me and @HeikoKlare
...g.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MultiZoomCoordinateSystemMapper.java
Outdated
Show resolved
Hide resolved
7454691
to
5b103b1
Compare
I tested and found this: When rescaling at runtime is deactivated
To reproduce:
When rescaling at runtime is activated
In the video you can see that:
My setup
PrioritizationI can live with both issues so I suggest we merge this PR and leave the findings for another release. @HeikoKlare WDYT? |
Is the issue with rescaling at runtime being deactivated really an issue introduced by this PR? I don't see how this could be related, so would be good to check that. Otherwise it might be an independent regression for which we need to open an issue and address separately as soon as possible. |
When the rescaling at runtime is deactivated it still uses the old singlezoom mapper. So I don't think that this PR could have caused this issue. |
It's not --> vi-eclipse/Eclipse-Platform#191 |
@amartya4256 can you please update the commit message as requested in #1711 (review)?
|
...eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/CoordinateSystemMapperTests.java
Outdated
Show resolved
Hide resolved
...eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/CoordinateSystemMapperTests.java
Outdated
Show resolved
Hide resolved
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.
Some minor comments regarding documentation of new API.
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java
Outdated
Show resolved
Hide resolved
5b103b1
to
880a4dc
Compare
880a4dc
to
7a58782
Compare
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.
Thank you, @amartya4256!
The changes now look fine to me. I have also tested the changes and found the behavior of the multi-zoom coordinate mapping much better now. It's only corner cases (right at the border between two monitors with different scalings) that sometimes behave a bit "unexpected", but at least it behaves rather "consistently" (e.g., regarding a preview of a detach operation and the final result). And those corner cases are not easy to resolve anyway, so it's fine like it is. In particular, dragging things to another monitor now behaves eben better than without monitor-specific scaling, where, for example, a detach operation moved to another monitor with different zoom value leads to unexpected positioning.
In addition, this change is safe in the sense that it only affected the multi-zoom coordinate system mapper, which is used by the experimental monitor-specific scaling mode on Windows. So no effects regarding existing behavior of "ordinary" functionality are to be expected.
With recent change 7a58782, I adapted the equals/hashcode implementations for Point/Rectangle and MonitorAwarePoint/MonitorAwareRectangle, as otherwise they would not take the monitor into account.
00f047a
to
fcb53e6
Compare
This commit contributes to the use of monitor-aware Points and Rectangles for the translation between points and pixels coordinates in the Display Coordinate System. Since the Display Coordinate System can have different scales (zoom) in different monitors, it is designed to be not continuous in the points coordinates. Hence when we manipulate the coordinates of a Point or a Rectangle object, it might end up in a region which is between two monitors in the point coordinate system, which we consider a gap. So, we need the context of the monitor on which those points and rectangles were created in the first place to evaluate the scaling factor. If the context is not available or the coordinates were updated to an irrelevant value, a fallback method tries to evaluate the right monitor for the coordinates and evaluates the scaled value with that. Contributes to eclipse-platform#62 and eclipse-platform#127
fcb53e6
to
9a1c825
Compare
This PR contributes to the use of MonitorAware Points and Rectangles for the translation between points and pixels coordinates in the Display Coordinate System. Since the Display Coordinate System can have different scales (zoom) in different area, it is designed to be not continuous in the points coordinates. Hence when we manipulate the coordinates of a Point or a Rectangle object, it might end up in a region which is between the 2 monitors in the point coordinate system, which we consider a gap. So, we need the context of the monitor on which those points and rectangles were created in the first place to evaluate the scaling factor. If the context is not available or the coordinates were updated to an irrelevant value, a fallback method tries to evaluate the right monitor for the coordinates and evaluates the scaled value with that.
Contributes to #62 and #127