Skip to content

[Win32] Correct DPI context awareness value retrieval#2985

Merged
HeikoKlare merged 1 commit intoeclipse-platform:masterfrom
vi-eclipse:proper-dpiawareness-retrieval
Jan 20, 2026
Merged

[Win32] Correct DPI context awareness value retrieval#2985
HeikoKlare merged 1 commit intoeclipse-platform:masterfrom
vi-eclipse:proper-dpiawareness-retrieval

Conversation

@HeikoKlare
Copy link
Copy Markdown
Contributor

@HeikoKlare HeikoKlare commented Jan 20, 2026

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 20, 2026

Test Results (win32)

   34 files     34 suites   5m 20s ⏱️
4 636 tests 4 563 ✅ 73 💤 0 ❌
  170 runs    167 ✅  3 💤 0 ❌

Results for commit 3b1df74.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare force-pushed the proper-dpiawareness-retrieval branch 3 times, most recently from 38147cf to 1036eec Compare January 20, 2026 11:01
@HeikoKlare HeikoKlare marked this pull request as ready for review January 20, 2026 11:08
@HeikoKlare HeikoKlare force-pushed the proper-dpiawareness-retrieval branch from 1036eec to 07bf6ce Compare January 20, 2026 11:36
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.
@HeikoKlare HeikoKlare force-pushed the proper-dpiawareness-retrieval branch from 07bf6ce to 3b1df74 Compare January 20, 2026 12:45
Copy link
Copy Markdown
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.

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.

@HeikoKlare HeikoKlare merged commit c23ac22 into eclipse-platform:master Jan 20, 2026
17 checks passed
@HeikoKlare HeikoKlare deleted the proper-dpiawareness-retrieval branch January 20, 2026 13:08
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.

Correct DPI context awareness value retrieval

2 participants