-
Notifications
You must be signed in to change notification settings - Fork 143
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
Text in Dialog was cutoff due to invalid use of AdjustWindowRectEx #1707
base: master
Are you sure you want to change the base?
Text in Dialog was cutoff due to invalid use of AdjustWindowRectEx #1707
Conversation
Test Results 485 files ±0 485 suites ±0 11m 4s ⏱️ +14s For more details on these failures, see this check. Results for commit 35b3e3b. ± Comparison against base commit 950ca8a. ♻️ This comment has been updated with latest results. |
dfb91cd
to
4ef8a5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One first comment on the new usage of the Windows API method: The method has been introduced for Windows 10 1607 (https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-adjustwindowrectexfordpi#requirements). This means:
- We should guard its calls by a version check and use the old (non-DPI-aware) method if that method is not met (like, e.g., for
getSystemMetrics(ForDpi)
, as done inWidget#getSystemMetrics()
- We should load the native method dymically to avoid a linker error on platforms that do not provide that method. This is to avoid the issue that we had before that SWT actually required rather update-to-date Windows versions due to rather new methods being statically linked to. For example, take a look at how
GetSystemMetricsForDpi
is called inos.c
.
e5a2838
to
17f652f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing usages of that method with the DPI-dependent version makes sense.
I have updated the PR by merging the commits and fixing copy-paste errors in the documentation.
Still I am non-deterministically getting wrongly scaled versions of dialogs, e.g., this one completely missing the checkbox to not show that message again:
I also have a question regarding the DPI parameter of the newly adapted method, which may be related to the issue.
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
Outdated
Show resolved
Hide resolved
17f652f
to
fe1292c
Compare
AdjustWindowRectEx does not take DPI into account, leading to dialog windows being cut off. This change adjusts usages of that method to AdjustWindowRectExForDpi, passing the zoom level to retrieve correct coordinates and scaling accordingly.
fe1292c
to
35b3e3b
Compare
AdjustWindowRectEx does not take DPI into account. So using AdjustWindowRectExForDpi and passing the zoom level to retrieve correct coordinates and scaling accordingly.
How to Reproduce
Note
Replacing AdjustWindowRectEx in Decoration fixes the issue for dialogs but replacing all the non-dpi calls for AdjustWindowRectEx even though there is no visible difference (but slight difference in returned coordinates) right now but having it DPI dependent makes it consistent.