Skip to content

Conversation

@HeikoKlare
Copy link
Contributor

In HiDPI scenarios with fractional monitor scales (such as 125% and 175%), some controls appear slightly cut off. The reason for this is inconsistent rounding of control sizes. The rounding is necessary during pixel/point conversion and leads to added or lost single pixels. One controls which obviously shows the behavior is the border of CTabFolders.

This change adapts the calculation in the following way:

  • It ensures that pixelToPoint and pointToPixel conversions for sizes round in opposite ways instead of rounding up in both directions as currently done. This ensures that sizes being set (via pointToPixel) are rounded up while sizes being retrieved (via pixelToPoint) are rounded down.
  • It extracts the pixelToPoint conversion for sizes that are calculated based on pixel values and are supposed to represent a conservative size (i.e., better be to high than to low).
  • It ensures that also the pixelToPoint conversion of rectangles takes the proper rounding method for sizes into account.

Fixes #2641

Before

cutoff_broken

After

cutoff_fixed

Note that the Manifest editor is shown because you can also see improper changes of the scaling when resizing that editor based on the Forms UI, in particular with cut off lines when resizing vertically.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 21, 2025

Test Results

  115 files  ±0    115 suites  ±0   10m 53s ⏱️ - 1m 21s
4 560 tests ±0  4 544 ✅ ±0  16 💤 ±0  0 ❌ ±0 
  311 runs  ±0    308 ✅ ±0   3 💤 ±0  0 ❌ ±0 

Results for commit b9e9aef. ± Comparison against base commit cf6ee39.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare changed the title [Win32] Fix cut off controls #2641 [Win32] Fix cut-off controls #2641 Oct 21, 2025
public void scaleDownRectangle() {
Rectangle valueAt200 = new Rectangle(100, 150, 10, 14);
Rectangle valueAt150 = new Rectangle(75, 113, 7, 10);
Rectangle valueAt150 = new Rectangle(75, 113, 8, 10);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this aligns the test values with the opposite scaleUpRectangle() method, which also makes the behavior appear more consistent again.

In HiDPI scenarios with fractional monitor scales (such as 125% and
175%), some controls appear slightly cut off. The reason for this is
inconsistent rounding of control sizes. The rounding is necessary during
pixel/point conversion and leads to added or lost single pixels. One
controls which obviously shows the behavior is the border of
CTabFolders.

This change adapts the calculation in the following way:
- It ensures that pixelToPoint and pointToPixel conversions for sizes
round in opposite ways instead of rounding up in both directions as
currently done. This ensures that sizes being set (via pointToPixel) are
rounded up while sizes being retrieved (via pixelToPoint) are rounded
down.
- It extracts the pixelToPoint conversion for sizes that are calculated
based on pixel values and are supposed to represent a conservative size
(i.e., better be to high than to low).
- It ensures that also the pixelToPoint conversion of rectangles takes
the proper rounding method for sizes into account.

Fixes eclipse-platform#2641
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.

Code lokes solid and matches the description. As this is a topic we are addressing over quite some time there is always a risk of breaking something. This PR fixes issues that were after the latest refactoring. As I didn't find any regression when testing it on different zoom levels, I would give this a go. It improves the visible behavior and we have more time to see, if we introduce any regression with this.

@akoch-yatta
Copy link
Contributor

With some further testing I noticed some issues regarding jface forms, but they appear in the same way on master. Therefor we need to investigate that separately and is not a blocker for this PR

@akoch-yatta akoch-yatta merged commit 55b5adf into eclipse-platform:master Oct 22, 2025
17 checks passed
@akoch-yatta akoch-yatta deleted the issue-2641 branch October 22, 2025 14:53
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.

Frames around part stacks are cut off [Win32] Parts of controls are cut off

2 participants