Skip to content
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

[win32] Use DPI dependent OS API calls #1506

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

akoch-yatta
Copy link
Contributor

This commit replaces the OS calls for OpenThemeData with calls to the dpi dependent equivalent OpenThemeDataForDpi. Therefor the handling of loading/unloading of theme in Display is refactored to be able to manage multiple DPI dependent variants of a theme in multi zoom environments. Without this change some widget can look inconsistent in a multi-zoom scenario on the non-primary monitor.

One example that is affected by that change can be found in the Manifest editor
Without PR
image
With PR
image

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Test Results

   486 files  ±0     486 suites  ±0   7m 52s ⏱️ -8s
 4 159 tests ±0   4 151 ✅ ±0   8 💤 ±0  0 ❌ ±0 
16 390 runs  ±0  16 298 ✅ ±0  92 💤 ±0  0 ❌ ±0 

Results for commit 6bda7b0. ± Comparison against base commit a4fe53b.

♻️ This comment has been updated with latest results.

@jukzi
Copy link
Contributor

jukzi commented Oct 8, 2024

is it possible to add a junit test, that shows/tests the changed behaviour?

@akoch-yatta akoch-yatta force-pushed the theme-dpi-dependent branch 2 times, most recently from d3cd69e to cb31fbe Compare October 9, 2024 07:11
@akoch-yatta
Copy link
Contributor Author

is it possible to add a junit test, that shows/tests the changed behaviour?

Hmm, depends a bit on what the test should achieve. A test for a realistic scenario would need two monitors with different zoom, which is not possible in the acccessible test environment. And even then, the usage of the replaced calls is only in drawing callback, so currently I don't see any helpful automated test here, we could add. But I am of course open for ideas.

@jukzi
Copy link
Contributor

jukzi commented Oct 9, 2024

May be some test that checks drawing for single monitor with different dpi settings works as expected. Would that make sense, or are there already such tests?
At least a snippet to reproduce the screenshot given in #1506 (comment) to demonstrate the change in a manual test should be possible.

Copy link
Contributor

@fedejeanne fedejeanne left a comment

Choose a reason for hiding this comment

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

Changes look good and the fix work.

I only have a minor comment regarding making the replaced methods private.

Other than that, this PR is good to go on my account.

Comment on lines +4587 to +4589
return OS.OpenThemeDataForDpi(hwnd, themeName, dpi);
} else {
return OS.OpenThemeData(hwnd, themeName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these 2 methods are now replaced by your new method, it would be worth declaring them private.

@fedejeanne
Copy link
Contributor

Other than that, this PR is good to go on my account.

I mean of course after Jörg's comments have been addressed.

This commit replaces the OS calls for OpenThemeData with calls to the dpi dependent equivalent OpenThemeDataForDpi. Therefor the handling of loading/unloading of theme in Display is refactored to be able to manage multiple DPI dependent variants of a theme in multi zoom environments

Contributes to eclipse-platform#62 nd eclipse-platform#131
@akoch-yatta
Copy link
Contributor Author

May be some test that checks drawing for single monitor with different dpi settings works as expected. Would that make sense, or are there already such tests? At least a snippet to reproduce the screenshot given in #1506 (comment) to demonstrate the change in a manual test should be possible.

I added Snippet383 to test that behavior for Button, Tree & Table.
image

An automated test for that would be quite difficult, because the changes affect internal custom drawing behavior which is hard to test. I would only see something like comparing screenshots for that use case.

@jukzi
Copy link
Contributor

jukzi commented Oct 11, 2024

i confirm the snippet looks better with the Patch, even though it looks a bit different for me:
image

Copy link
Contributor

@fedejeanne fedejeanne left a comment

Choose a reason for hiding this comment

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

Ignoring random failing tests: #1523

@fedejeanne fedejeanne merged commit 5dd0c28 into eclipse-platform:master Oct 11, 2024
10 of 14 checks passed
@akoch-yatta akoch-yatta deleted the theme-dpi-dependent branch October 11, 2024 13:23
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.

3 participants