You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[macOS Silicon] Table and Tree item height gets smaller when setting the font #677
This occurs on Mac Silicon (aarch64) only, presumably because Eclipse on that platform uses a later Apple SDK. I've tested on Mac Mini M1 with Monterey and Ventura.
Edit - also occurs on Mac Intel. It depends on which macOS SDK is used to create the launcher binary (eclipse or java).
Setting a table or tree font to the same font reduces the item height.
Create a simple table with some rows
The item height of the rows is 25:
Set the table's font to its current font (table.setFont(table.getFont()))
The item height of the rows is now 18:
Expected behaviour: should use the height of the target SDK. On aarch64 this is the 25 pixel item height. On Intel it is 18.
If I change the above condition either to one of the below , we see the expected behaviour but not sure about the exact purpose of set. Does someone has any idea on when exactly set needs to be evaluated?
if (widget.rowHeight () < height) {
widget.setRowHeight (height);
if (set && widget.rowHeight () < height) {
widget.setRowHeight (height);
Table and Tree row heights are initially set to 25 on Mac aarch64 and then set to 18 when resetting the font. With a List widget the row height is initially 24 and then 17 when resetting the font.
I have a doubt about whether the initial row height is wrong and should be as it is on intel Mac. But there are these earlier bug reports:
This is because eclipse launcher SDK version
On x86_64 SDK used is 10.14
On aarch64 SDK used is 11
But the way forward is to use latest SDK and update SWT to MacOS 11 SDK.
So I guess the higher row height values are correct for aarch64?
@tmssngr For apps that use -Dorg.eclipse.swt.internal.carbon.smallFonts (like Eclipse IDE), the change in 611accb brings back the old behavior, as an immediate remedy to the problem without the need of further configuration.
For apps that don't specify smallFonts, the appearance depends on their macOS version. Newer versions of macOS have a taller native height that matters here. To consistently bring back the old behavior, specify -Dorg.eclipse.swt.internal.cocoa.useNativeItemHeight=false when launching your app.
I'm not sure I fully understand all. Older versions of SWT (e.g. used in SmartGit 23.1.2) show table and tree rows quite narrow on my M1 Mac Mini with macOS 14.4. Newer versions of SWT (e.g. used in SmartGit 24.1 preview) show a much larger row height. We don't have the mentioned properties set. Do you mean, that the larger row height in newer SWT builds is now the correct behavior for macOS 14.4, and if a user wants to have a narrower row-height, he needs to set the mentioned properties?
@tmssngr Yes, I'm afraid that's the case, but setting a property will do the trick.
Anyhow, I'm just a Eclipse IDE user whose eyes couldn't bear looking at these oversized list items, so I'm glad I could contribute to resolving this issue.
There always has been bigger row heights in SWT since the later macOS versions. However, when a call to setItemHeight is made (by setting the control's font or image or something else), the row heights shrink, as the snippet here demonstrates. The commit of @kohlschuetter corrects this anomaly.
@Phillipus Ah, so there was even another difference between plain and owner-drawn trees.
On MacOS we were setting the display's system font (a slightly different one) to have all digits the same width. So it looks like our problem of the increased row-heights is a slightly different problem than this one covered in this ticket. Sorry for the noise.
As the snippet in this issue shows, when a Tree/Table/List control is first created it has the native row height (larger on later macOS). Thereafter, a change to the control's font/image/whatever triggers a re-calculation of the row height. This is where the row height shrinks because it doesn't take into account the initial native row height when calculating the row height based upon the current font.
Eclipse uses the -Dorg.eclipse.swt.internal.carbon.smallFonts property and this triggers the recalculation of row heights immediately after the control is created. This is why Eclipse users always saw smaller row heights.
Now that the recalculation anomaly has been fixed there is consistency between the initial row heights and the re-calculated ones, so no more unexpected row height shrinkage. However, this means that row heights are bigger by default because that's how they are initially created.
I think SmartGit Preview is seeing bigger row heights because of the erroneous padding added in this commit.
You could try using the latest SWT build with the new fix in and add the -Dorg.eclipse.swt.internal.cocoa.useNativeItemHeight=false setting to SmartGit's Info.plist file (I think that's where you set these properties?).
I might be the odd one out here, but is there a way to get both small fonts, but the bigger spacing back after the fix? 😇 I see my ini file having -Dorg.eclipse.swt.internal.carbon.smallFonts set. I've tried adding -Dorg.eclipse.swt.internal.cocoa.useNativeItemHeight=true (I also tried false) to get the bigger spacing back, but don't see any effect.
Activity
Phillipus commentedon May 18, 2023
Snippet to reproduce (ensure not to use the argument
-Dorg.eclipse.swt.internal.carbon.smallFonts):elsazac commentedon Jun 15, 2023
I am able to reproduce the issue in Apple M1 Pro Ventura 13.4
Eclipse SDK
Version: 2023-06 (4.28)
Build id: I20230605-0440
OS: Mac OS X, v.13.4, aarch64 / cocoa
Java vendor: Eclipse Adoptium
Java runtime version: 17.0.6+10
Java version: 17.0.6
elsazac commentedon Jun 30, 2023
@Phillipus
Can you also add what should be the expected behaviour?
Phillipus commentedon Jun 30, 2023
Added to OP.
elsazac commentedon Jul 14, 2023
I am investigating on this issue and these are my findings.
eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
Lines 2832 to 2833 in 1a939af
If I change the above condition either to one of the below , we see the expected behaviour but not sure about the exact purpose of
set. Does someone has any idea on when exactlysetneeds to be evaluated?Fixes: eclipse-platform#677 A new
Fixes: eclipse-platform#677 A new
Fixes: eclipse-platform#677 For
Phillipus commentedon Oct 4, 2023
The problem also occurs for the SWT
Listwidget:Similar change has been given to list.java as well.
Phillipus commentedon Oct 6, 2023
TableandTreerow heights are initially set to 25 on Mac aarch64 and then set to 18 when resetting the font. With aListwidget the row height is initially 24 and then 17 when resetting the font.I have a doubt about whether the initial row height is wrong and should be as it is on intel Mac. But there are these earlier bug reports:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=575696
https://bugs.eclipse.org/bugs/show_bug.cgi?id=574932
and this comment from @sravanlakkimsetti:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=574932#c2
So I guess the higher row height values are correct for aarch64?
elsazac commentedon Dec 8, 2023
@Phillipus
I have verified some tables in Mac and I can see the table height in Mac being aligned with table in the snippet(with height 25)
I have gone through the bugzilla links and I see that the increased item height is the new native behaviour on BigSur. row height is 24pt in BigSur and 17pt in macOS 10.15.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=574932#c40
the snippet is initially set to item height 25 because the default item height in aarch is 25 unless we override and change it to 18
Also can you please try some tables in x86_64?
Fixes: eclipse-platform#677 For
Similar change has been given to list.java as well.
Fixes: eclipse-platform#677 For
24 remaining items
kohlschuetter commentedon Mar 21, 2024
@tmssngr For apps that use
-Dorg.eclipse.swt.internal.carbon.smallFonts(like Eclipse IDE), the change in 611accb brings back the old behavior, as an immediate remedy to the problem without the need of further configuration.For apps that don't specify
smallFonts, the appearance depends on their macOS version. Newer versions of macOS have a taller native height that matters here. To consistently bring back the old behavior, specify-Dorg.eclipse.swt.internal.cocoa.useNativeItemHeight=falsewhen launching your app.tmssngr commentedon Mar 21, 2024
I'm not sure I fully understand all. Older versions of SWT (e.g. used in SmartGit 23.1.2) show table and tree rows quite narrow on my M1 Mac Mini with macOS 14.4. Newer versions of SWT (e.g. used in SmartGit 24.1 preview) show a much larger row height. We don't have the mentioned properties set. Do you mean, that the larger row height in newer SWT builds is now the correct behavior for macOS 14.4, and if a user wants to have a narrower row-height, he needs to set the mentioned properties?
kohlschuetter commentedon Mar 21, 2024
@tmssngr Yes, I'm afraid that's the case, but setting a property will do the trick.
Anyhow, I'm just a Eclipse IDE user whose eyes couldn't bear looking at these oversized list items, so I'm glad I could contribute to resolving this issue.
Phillipus commentedon Mar 21, 2024
@tmssngr Take a look at SmartGit 23.1.2 Settings tree. You'll see bigger row heights. See eclipse-platform/eclipse.platform.ui#1674 (comment)
There always has been bigger row heights in SWT since the later macOS versions. However, when a call to
setItemHeightis made (by setting the control's font or image or something else), the row heights shrink, as the snippet here demonstrates. The commit of @kohlschuetter corrects this anomaly.tmssngr commentedon Mar 21, 2024
@Phillipus Ah, so there was even another difference between plain and owner-drawn trees.
On MacOS we were setting the display's system font (a slightly different one) to have all digits the same width. So it looks like our problem of the increased row-heights is a slightly different problem than this one covered in this ticket. Sorry for the noise.
Phillipus commentedon Mar 21, 2024
@tmssngr
It depends on how a Tree/Table/List is used.
As the snippet in this issue shows, when a Tree/Table/List control is first created it has the native row height (larger on later macOS). Thereafter, a change to the control's font/image/whatever triggers a re-calculation of the row height. This is where the row height shrinks because it doesn't take into account the initial native row height when calculating the row height based upon the current font.
Eclipse uses the
-Dorg.eclipse.swt.internal.carbon.smallFontsproperty and this triggers the recalculation of row heights immediately after the control is created. This is why Eclipse users always saw smaller row heights.Now that the recalculation anomaly has been fixed there is consistency between the initial row heights and the re-calculated ones, so no more unexpected row height shrinkage. However, this means that row heights are bigger by default because that's how they are initially created.
I think SmartGit Preview is seeing bigger row heights because of the erroneous padding added in this commit.
You could try using the latest SWT build with the new fix in and add the
-Dorg.eclipse.swt.internal.cocoa.useNativeItemHeight=falsesetting to SmartGit'sInfo.plistfile (I think that's where you set these properties?).Phillipus commentedon Mar 21, 2024
@tmssngr My assumptions are correct.
SmartGit.app/Contents/Resources/Java/org.eclipse.swt.cocoa.macosx.aarch64.jarwith the latest SWT build-Dorg.eclipse.swt.internal.cocoa.useNativeItemHeight=falseto theInfo.plistfile in theJVMOptionssectionBefore:
After:
swt commit 18369fb7/bb6102eb
tmssngr commentedon Mar 21, 2024
Thanks, @Phillipus, this helped to fix it. :)
cocoa: Enforce native item height for Table, Tree, List if necessary
cocoa: Enforce native item height for Table, Tree, List if necessary
odrotbohm commentedon Jun 18, 2024
I might be the odd one out here, but is there a way to get both small fonts, but the bigger spacing back after the fix? 😇 I see my ini file having
-Dorg.eclipse.swt.internal.carbon.smallFontsset. I've tried adding-Dorg.eclipse.swt.internal.cocoa.useNativeItemHeight=true(I also triedfalse) to get the bigger spacing back, but don't see any effect.Phillipus commentedon Jun 18, 2024
No, because the native item height is smaller when small fonts are set.
odrotbohm commentedon Jun 18, 2024
That's a pity, but thanks! 😕
marcleidner commentedon Jun 18, 2024
Issue is fixed in 2024-06 (4.32.0), for me at least.