Skip to content

Conversation

@HeikoKlare
Copy link
Contributor

Currently, the runtime rescaling of shells/widgets on Windows is tied to a property in the DPIUtil class. Since that class is internal, the property can only be set via a VM argument at startup but cannot be changed or at least retrieved during runtime from outside the SWT bundle.

This change reduces the DPIUtil property to a global setting that may be used to set the behavior for a whole application (in particular an SWT application) but move the actual state handling for runtime rescaling behavior to the Display class. This allow to retrieve and change the value directly on the Display, on which also the DPI awareness for the UI thread is initialized. As a side effect, it improves testability as a properly configured display can be used instead of changing the global state of DPIUtil.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 23, 2024

Test Results

   478 files  ±0     478 suites  ±0   9m 21s ⏱️ + 2m 30s
 4 147 tests ±0   4 139 ✅ ±0   8 💤 ±0  0 ❌ ±0 
16 354 runs  ±0  16 262 ✅ ±0  92 💤 ±0  0 ❌ ±0 

Results for commit 4952b46. ± Comparison against base commit 7a8fda3.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare marked this pull request as ready for review July 23, 2024 12:59
Copy link
Contributor

@akoch-yatta akoch-yatta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like inlining that logic into Display. Especially as it makes it possible to change the setting on runtime

@HeikoKlare HeikoKlare force-pushed the display-rescaleatruntime branch from 41e26ca to 784ffc7 Compare July 23, 2024 13:33
Currently, the runtime rescaling of shells/widgets on Windows is tied to
a property in the DPIUtil class. Since that class is internal, the
property can only be set via a VM argument at startup but cannot be
changed or at least retrieved during runtime from outside the SWT
bundle.

This change reduces the DPIUtil property to a global setting that may be
used to set the behavior for a whole application (in particular an SWT
application) but move the actual state handling for runtime rescaling
behavior to the Display class. This allow to retrieve and change the
value directly on the Display, on which also the DPI awareness for the
UI thread is initialized. As a side effect, it improves testability as a
properly configured display can be used instead of changing the global
state of DPIUtil.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants