[Win32] Correct DPI context awareness value retrieval#2985
Merged
HeikoKlare merged 1 commit intoeclipse-platform:masterfrom Jan 20, 2026
Merged
Conversation
Contributor
Test Results (win32) 34 files 34 suites 5m 20s ⏱️ Results for commit 3b1df74. ♻️ This comment has been updated with latest results. |
38147cf to
1036eec
Compare
1036eec to
07bf6ce
Compare
The DPI_AWARENESS_CONTEXT values are currently defined as constants, but they are actually defined as typedefed handles instead of compile time constants in Windows' windef.h. So the constants defined in SWT may not fit the actual values as used by the OS. This currently seems to be the case for the System awareness value, which does not fit the OS value. This change adapts the definition of the values to retrieve the actual current values from the OS instead of hardcoding them in constants.
07bf6ce to
3b1df74
Compare
akoch-yatta
approved these changes
Jan 20, 2026
Contributor
akoch-yatta
left a comment
There was a problem hiding this comment.
LGTM. Tested with this PR and master to compare setting a (thread) dpi awareness context with the same or a different one than the process dpi awareness. Fetching the values from the header hardens to implementation to ensure better compatibility with different windows version.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The DPI_AWARENESS_CONTEXT values are currently defined as constants, but they are actually defined as typedefed handles instead of compile time constants in Windows' windef.h. So the constants defined in SWT may not fit the actual values as used by the OS. This currently seems to be the case for the System awareness value, which does not fit the OS value.
This change adapts the definition of the values to retrieve the actual current values from the OS instead of hardcoding them in constants.
Can, e.g., be tested with different values passed to
-Dorg.eclipse.swt.internal.win32.dpiAwareness, such as "system" or "permonitorv2". For me "system" did not work before this change.