-
Notifications
You must be signed in to change notification settings - Fork 147
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
Calculate chevron size in CTabFolderRenderer without Device#getDPI() #1754
Conversation
...eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
Outdated
Show resolved
Hide resolved
...eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
Outdated
Show resolved
Hide resolved
...eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
Outdated
Show resolved
Hide resolved
...les/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
Show resolved
Hide resolved
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.
Looks good on Linux/GTK. I don't see any noticable difference to existing appearance.
In the following screenshot, the left is existing and the right is with this PR:
Screenshots are taken at 100% monitor scaling. Looks the same (blurry scaled) with other display scalings, both before and after the change.
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.
@BeckerWdf I just saw that you originally introduced the scaling logic for the chevrons several years ago. Do you still remember that code and have an opinion on these changes or should we just move on?
...eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
Show resolved
Hide resolved
...eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
Outdated
Show resolved
Hide resolved
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.
You mean this change: f25be5b? |
Yes, that change. |
Sorry. I don't remember the details. Just also read the bugzilla. |
...eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
Outdated
Show resolved
Hide resolved
...eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
Outdated
Show resolved
Hide resolved
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.
Looks good now. Can you squash the commits please?
cdf8c61
to
d47b00b
Compare
The chevron font size is currently determined using Device#getDPI(). This value is static across the application lifecyle, always returns the DPI for the primary monitor at application startup. The font does thus not adapt properly to other zoom values. This change replaces the logic to calculate the chevron font size to use a scaled version of the font used for CTabItem. It also adds a listener for the zoom change event to trigger redraw.
d47b00b
to
164c0f4
Compare
getDPI always returns the points for primary monitor and can produce faulty behavior. Replacing the logic to calculate the chevron font size. Visibly 70% size of the font used for CTabItem is now used. Also adjusting the indent and adding the ZoomChange event to trigger redraw during DPI change.
NOTE: Needs to be tested on linux and macOS
Steps to Reproduce
Before Fix
After Fix
Scenarios Tested yet:
Case Quarter no args
150 -> 100 OK OK
150 -> 200 OK OK