-
Notifications
You must be signed in to change notification settings - Fork 187
Take MonitorAware out of the geometry hierarchy with as few other changes as possible
#1905
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
Conversation
… remove equality.
…ere that the monitor was being used.
…t preserved for internal use.
…nitor` initialized to null. In some cases I think we can easily pre-populate `monitor`, but I'm leaving that out on purpose to match existing behavior.
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.
I understand that there seems to be an issue regarding equality. But please first read the explanations given in #1711 (comment) and #1711 (comment). Removing the hierarchy between point/rectangle and their monitor-aware specialization breaks the monitor-specific UI scaling. Not everything is covered by tests, so probably we need to add some tests for the coordinate system at shell level (as it's currently limited to the mappers themselves) to better cover the necessary behavior at shell level.
Can you give examples (in the best case, reproducing tests) that demonstrate the actual issue we need to discuss about?
Point topLeft = shell.getLocation();
// one way to get an offset
Point offset = new Point(topLeft.x + 5, topLeft.x + 5);
// another way to get the exact same point
topLeft.x += 5;
topLeft.y += 5;
Point otherOffset = topLeft;
// the two points are not equal, but only on Windows
assertThat(offset).isEqualTo(otherOffset) //failsThat would be easy to fix by changing the You're maintaining this project and have brought it back to life, the onus is on me not on you. Feel free to
If there is any possible way to resolve the scaling issue (which fwiw has not been a problem for me or my users who are heavily in multimonitor windows setups) in either a more encapsulated way (what I tried to do here) or a more explicit way (create public API which demand a |
|
As said, I am totally fine with fixing issues regaring equality. Maybe we could just consider, e.g., a Point and MonitorAwarePoint symetrically equal if their x/y values are equal, as that's what is expected everywhere else than in the coordinate system (as no consumer should know or at least care about monitor-aware implementations).
The monitor-aware implementations are not part of the API, so no one is supposed to instantiate or should need to otherwise care about them.
Out of curiousity: since when are you using monitor-specific scaling without facing an issue with the coordinate system across monitors? First chance to test the experimental feature was just recently with the 2024-12 release.
Yes, it would of course be best to carry everything properly via the API. Actually, it is of course possible to develop a better designed solution. The problem is that such a solution would require significant changes of the API and of every consumer (inside Eclipse and outside). That's why we chose the current approach, which, as far as we are aware of, works in a sufficient way without changes of the API and consumers. Only thing that seem to be an issue is the implementation of quality of the affected classes. |
If That would address all my concerns except the fact that sometimes some other SWT method will behave differently depending on whether it is a
This means I haven't used it at all, but I also haven't had a problem (nor has a customer made a request) which drove me to desire this feature. My lack of experience or need doesn't invalidate the experience and needs of other users in the ecosystem, of course! But every user uses the coordinate system, monitor-specific scaling on Windows seems a niche interest compared to that.
My goal with this PR was to try to trace where these magic points were created to where they were consumed, to see if there was a way to connect these points using internal API, and thus avoid all these issues. And based on this, I still worry that this API is going to cause bugs because And this where I want to emphasize that you don't owe me an explanation! But if you have more time to give, am I correct about the following?
If I am correct about this, then I would consider shrinking the scope, and taking an approach something like this:
If a new coordinate system is required to do this correctly, but it's too much work to add a new coordinate system, then maybe the feature is just too much work 🤷 |
I completely agree with this point.
No, this is not correct. I think the news on the feature sufficiently describes what it does: https://eclipse.dev/eclipse/news/4.34/platform.html#rescale-on-runtime-preference
I don't get this point. There is no "coordinate system vs. monitor-specific scaling". If you do not enable monitor-specific scaling, there won't be any of those monitor-aware points/rectangles at all and everything remains as it was. If you think monitor-specific scaling is not important or relevant, feel free to not use it. But you can we sure that we don't invest person years for a feature that is "a niche" :-) |
The main thing I want to say is thanks for bringing SWT back to life! For now I'm going to stay on SWT 4.34, and hope that by the time the Skija stuff lands maybe
So far, If a Point has a Lines 21 to 24 in de99b2d
I understand the difference between pixels and points, but I don't understand which thing |
This PR follows a very simple recipe
PointandRectanglehow they were before Use monitor-aware coordinates in multi-zoom coordinate system #1711MonitorAwareclasses not extend anything, and have no concept of equalityCoordinateSystemMapperTestsare still passing.