-
Notifications
You must be signed in to change notification settings - Fork 185
Make DPIZoomChangeHandlers concurrent R/W able #62 #1806
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
Merged
fedejeanne
merged 1 commit into
eclipse-platform:master
from
vi-eclipse:amartya4256/concurrently_put_handlers
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 just wanted to mention that his will leak classloaders and lead to bundles that are updated/uninstalled retained forever.
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.
Hm, interesting point, I hadn't seen it before. That would mean that some consumer registers a custom subclass of
Widgetby calling this method and then unloads the bundle that contained that custom subclass, right? If that's the case, some sort ofWeakHashMapcould help or simply offering aderegistermethod, right?One thing in advance, this method is part of
internalso I see this issue as having slightly lower priority.WDYT?
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes I don't know where an listener is registered globally, but if DPI awareness only works for "buildins" that would be really bad.
e.g. https://github.com/EclipseNebula/nebula offers a lot of nice and useful custom widgets.
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.
Every custom widget is based on SWT widget, so they inherit the awareness. If there is DPI relevant state in a custom widget, you can refresh that by reacting on a ZoomChanged event.
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.
Sure but why don't we use that in SWT directly?
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 answer is in the section DPI zoom update propagation of #1064 (comment). IIRC one of the key points was: guaranteeing the order in which the event is processed is important.
Uh oh!
There was an error while loading. Please reload this page.
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 can only see that we need different handlers for different classes what is possible and as far as I know ordering is also some kind of guaranteed where I would like to see an example where it is actually important.
And then the same question arise: If it really is important how are custom widgets supposed to do it?
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.
Can we move this discussion to vi-eclipse/Eclipse-Platform#232 ?
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.
Theoretically yes, but why not at the SWT repo where the code lives and where it actually is implemented and seem to cause issues now?
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.
What does "some kind of guaranteed" mean? You mean by order of registration for the event?
Order is e.g. important when internal state is updated a subclass relies upon. The easiest example for this is updating the nativeZoom in the Widget callback. I don't remember more examples out of my head. There are probably more examples about resources or resizing, but I would need to have a deeper look. I see it like the order of constructor execution: you always call super first, so the super class can make sure it adapt its provided state accordingly first.
One thing we could rethink is externalizing re-layouting, that is triggered inside of the callbacks currently. This was inherited from the initial approach and there were issues in the beginning when we tried to move that, but perhaps those were related to side effects, that we solved in the mean time.
Custom widgets are in my point of view quite different from the base widgets in SWT, e.g. they are extensions of existing widgets, a composition of existing widgets or just drawing directly on a GC.
If there is DPI relevant state in a custom widget, you can refresh that by reacting on a ZoomChanged event, that will be propagated additionally. If you directly refer to the order, then you can probably create issues when you have a hierarchy of custom widgets. We did e.g. a test run with nebula widgets and as far as I remember we only found issues where DPI relevant state was used.