Open akoch-yatta opened 1 week ago
470 files ±0 470 suites ±0 7m 42s :stopwatch: -31s 4 135 tests ±0 4 127 :white_check_mark: ±0 8 :zzz: ±0 0 :x: ±0 16 336 runs ±0 16 244 :white_check_mark: ±0 92 :zzz: ±0 0 :x: ±0
Results for commit a5fd2540. ± Comparison against base commit a29aa312.
:recycle: This comment has been updated with latest results.
From a functional perspective, the changes look good. I only have a nitpicky comment regarding readability: I see (at least) two responsibilities in this method:
- Determine and set the correct
zoom
value for themonitor
- Determine and set the bounds and clientArea of the
monitor
Their calculations seem to be completely independent, but the control flow mixes them up. Would is be possible to first do everything related to the
zoom
value (the OS call for retrievingresult
, validating theresult
and assigning it tomonitor.zoom
) and then do everything related to the bounds and the clientArea (calculate the values, retrieve the correctautoscaleZoom
and set the according values onmonitor
)?
@HeikoKlare I moved the code in the method a bit. Can you have a look again? Do you mean something like that?
I moved the code in the method a bit. Can you have a look again? Do you mean something like that?
Yes, thank you! I think this improves comprehensibility as the blocks in the method can be read kind of independently now.
Currently the monitor bounds are calculated using the static DPIUtil.deviceZoom attribute as zoom. In multi monitor setup with different zooms, this will result in wrong bounds for the non primary monitor.
There are two scenarios:
One example where you can construct an effect of it is with the CompletionProposalPopup. There, the clientArea of the monitor is used to make sure, maximum of 25% of the monitor is used by the popup. If the monitor is calculated with the wrong zoom, the popup will get bigger as expected, see
vs.
![Screenshot 2024-06-26 132134](https://github.com/eclipse-platform/eclipse.platform.swt/assets/119662019/af01b06b-49c4-45cf-a7c9-0955fc7fbd2a)
if the Monitor e.g. has 2160 pixels on a zoom of 200%, the primary monitor has a zoom of 100%. If the primary monitor zoom is used, the 2160 pixels will used as 2160 points. 25% of it is 540. As the popup will be initialized (correctly) with the zoom of 200% it will convert the 540 points back to 1080 pixels => that is bigger than it should be.
Conclusion: monitor zoom must be treated the same of the zoom of widgets.