-
Notifications
You must be signed in to change notification settings - Fork 182
Design improvement for scaling win32 widgets #62 #2483
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
base: master
Are you sure you want to change the base?
Design improvement for scaling win32 widgets #62 #2483
Conversation
Test Results 118 files ±0 118 suites ±0 10m 7s ⏱️ -55s For more details on these failures, see this check. Results for commit d43db71. ± Comparison against base commit 2edab10. ♻️ This comment has been updated with latest results. |
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 am a bit confused by this change, as it introduces a mixture of event processing and direct method calls for DPI change processing. I expected the following order of changes according to what we have discussed:
- Replace
CommonWidgetsDPIChangeHandler
: use listeners instead - Replace
DPIZoomChangeRegistry
: make direct calls ofhandleDPIChange
for the native controls instead - Replace direct
handleDPIChange
calls: use listeners instead - Make the listener calls asynchronous (may be combined with the previous step)
This change seems to be a mixture of the first three. Can we please split that up and make the changes in a more incremental, comprehensive way?
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
Outdated
Show resolved
Hide resolved
...les/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
Show resolved
Hide resolved
@HeikoKlare I think we have mixed up things. With this PR we just wanted to move to Event driven architecture and not make it asynchronous. I understand that both the terms go hand in hand but we must note that the event model in SWT is synchronous and if an event is sent by a caller, at first the stub is executed and the caller waits for the event to be processed and then moves forward. Hence, this PR doesn't implement asynchrony. That's also the reason why I called notifyListeners instead of calling handleDpiChange because every widget registers to a listener then they must receive the DPI_CHANGE event also through listeners and not by some other widget calling handleDPIChange on them. The follow up PR would implement asynchrony while calling notifyListeners by the following:
and notifyListeners will be replaced by this method. |
So from what you are proposing and what I think how we could do it, I devised the following order:
(The only problem I see is in the first step. If we handle ZoomChangedEvent for Common widgets like StyledText, etc, they are not scaled in the hierarchical order. I need to test if it could cause any trouble.) |
Sounds good, I would just try to split the first step into the adaptation of common/custom widgets and the adaptation of the native part to keep it as small as possible.
But since everything stays synchronous, it should not matter whether you call a registry or whether you send an event. |
3bf732f
to
70e8d3f
Compare
@HeikoKlare As per our discussion, Replacing CommonWidgetZoomChangeHandler with ZoomChanged Event handler is not possible since the Common widgets need to call for the handleDPIChange for their associated widgets which is win32 specific code and we cannot call notifyListeners on these widgets without making them register to ZoomChanged event as they still use DPIZoomChangeRegistry. Hence, the following is necessary to make it work all together:
For the next step, i.e. asynchrony, we will replace these notifyListeners with a |
70e8d3f
to
991af26
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.
It looks OK to me but there are still some unresolved discussions with @HeikoKlare .
Other than that, it's fine ✔️
991af26
to
a770ed0
Compare
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
Outdated
Show resolved
Hide resolved
This commit improves thes design implementation for widgets in win32 by moving away from DPIZoomChangeRegistry to an event-driven design using ZoomChanged event and inheritance.
a770ed0
to
d43db71
Compare
} | ||
|
||
DPIZoomChangeRegistry.applyChange(decorations.getMenuBar(), newZoom, scalingFactor); | ||
Menu menuBar = getMenuBar(); | ||
if(menuBar != null) { |
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.
Add a space between if and (
DPIZoomChangeRegistry.applyChange(menu, newZoom, scalingFactor); | ||
if (menus != null) { | ||
for (Menu menu : menus) { | ||
if(menu != null) { |
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.
Add a space between if and (
Event event = new Event(); | ||
event.type = SWT.ZoomChanged; | ||
event.widget = this; | ||
event.detail = DPIUtil.getZoomForAutoscaleProperty(zoom); |
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.
This one mustn't be the autoscale zoom. Isn't it stored as native zoom?
This PR improves the design implementation for widgets in win32 by moving away from DPIZoomChangeRegistry to an event-driven design using ZoomChanged event and inheritance.