Bug 575696 - [Mac aarch64] List/Table/Tree has larger items and border on aarch64 than x86_64
Summary: [Mac aarch64] List/Table/Tree has larger items and border on aarch64 than x86_64
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.21   Edit
Hardware: Macintosh Mac OS X
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 572797
  Show dependency tree
 
Reported: 2021-08-29 13:27 EDT by Phil Beauvoir CLA
Modified: 2022-03-14 14:11 EDT (History)
5 users (show)

See Also:


Attachments
List on x86_64 (24.01 KB, image/png)
2021-08-29 13:27 EDT, Phil Beauvoir CLA
no flags Details
List on aarch64 (19.38 KB, image/png)
2021-08-29 13:28 EDT, Phil Beauvoir CLA
no flags Details
CCombo on x86_64 (21.40 KB, image/png)
2021-08-29 13:29 EDT, Phil Beauvoir CLA
no flags Details
CCombo on aarch64 (25.02 KB, image/png)
2021-08-29 13:29 EDT, Phil Beauvoir CLA
no flags Details
Snippet to show item height change when List font is set (1.01 KB, text/plain)
2021-11-15 07:51 EST, Phil Beauvoir CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Beauvoir CLA 2021-08-29 13:27:08 EDT
Big Sur 11.5.2
Eclipse 4.21 (eclipse-SDK-4.21-macosx-cocoa-aarch64)
JDK: Zulu11.48+21-CA for ARM64
Mac Mini M1 (ARM64)

The height and border of List items is bigger on aarch64 than x86_64.

This also affects the contents of CCombo as it uses a List.

Related to Bug #574932
Comment 1 Phil Beauvoir CLA 2021-08-29 13:27:53 EDT
Created attachment 287043 [details]
List on x86_64
Comment 2 Phil Beauvoir CLA 2021-08-29 13:28:31 EDT
Created attachment 287044 [details]
List on aarch64
Comment 3 Phil Beauvoir CLA 2021-08-29 13:29:17 EDT
Created attachment 287045 [details]
CCombo on x86_64
Comment 4 Phil Beauvoir CLA 2021-08-29 13:29:50 EDT
Created attachment 287046 [details]
CCombo on aarch64
Comment 5 Niraj Modi CLA 2021-11-15 05:53:30 EST
Problem happens in Table and Tree as well, hence updated the title.
Comment 6 Niraj Modi CLA 2021-11-15 05:53:54 EST
Problem happens in Table and Tree as well, hence updated the title.
Comment 7 Phil Beauvoir CLA 2021-11-15 07:51:27 EST
Created attachment 287514 [details]
Snippet to show item height change when List font is set

This is a snippet to show item height in a List. The item height is more than usual, so text is not vertically centred.

But if we simply set the font on the List control the item height is smaller, matching that on Mac x86_64.

Uncomment this line to see item height shrink:

list.setFont(list.getFont());
Comment 8 Ned Twigg CLA 2022-02-18 02:41:07 EST
Starting with Eclipse 4.22, I have found the SWT AArch64 port to work fantastic. The only problem is this larger row height issue, which was easy for us to workaround like this: https://github.com/diffplug/durian-swt/pull/17/files
Comment 9 Phil Beauvoir CLA 2022-02-18 03:30:00 EST
@Ned, this also works:

control.setFont(control.getFont());
Comment 10 Phil Beauvoir CLA 2022-02-18 03:55:24 EST
But I think the row height *should* be taller for this macOS SDK. Perhaps the real issue is that the text is not centred vertically in a row/item?
Comment 11 Ned Twigg CLA 2022-02-18 15:57:51 EST
Try doing:

    System.out.println("Font is " + control.getFont());
    control.setFont(control.getFont());

I get "Font is null".

> I think the row height *should* be taller for this macOS SDK.

macOS 11 has an emphasis on unifying the UI between macOS / iPad, which includes a default UI styling which is big enough to be touch-friendly. But you can still opt-in to the older style, and I think that's the appropriate path for SWT. Using the `setFont(null)` hack, we are getting a pixel-perfect match between x86 and aarch64. We don't want to restyle our application to be iPad-friendly, we want row heights appropriate for mouse & keyboard, not touch.
Comment 12 Phil Beauvoir CLA 2022-02-18 16:06:35 EST
(In reply to Ned Twigg from comment #11)
> Try doing:
> 
>     System.out.println("Font is " + control.getFont());
>     control.setFont(control.getFont());
> 
> I get "Font is null".
> 

When I create a TreeViewer with a Tree control, or TableViewer with a Table control, the font is set to non-null.
Comment 13 Thomas Singer CLA 2022-02-21 03:52:20 EST
(In reply to Ned Twigg from comment #11)
> Try doing:
> 
>     System.out.println("Font is " + control.getFont());
>     control.setFont(control.getFont());
> 
> I get "Font is null".

I would consider a null return value as bug. The documentation does not mention it. Hence it must be not-null.
Comment 14 Andrey Loskutov CLA 2022-02-21 03:59:46 EST
(In reply to Thomas Singer from comment #13)
> I would consider a null return value as bug. The documentation does not
> mention it. Hence it must be not-null.

Nope. The null means, the control has no *specific* font set, and simply uses display default font (org.eclipse.swt.graphics.Device.getSystemFont()).
Comment 15 Thomas Singer CLA 2022-02-21 04:08:25 EST
(In reply to Andrey Loskutov from comment #14)
> (In reply to Thomas Singer from comment #13)
> > I would consider a null return value as bug. The documentation does not
> > mention it. Hence it must be not-null.
> 
> Nope. The null means, the control has no *specific* font set, and simply
> uses display default font (org.eclipse.swt.graphics.Device.getSystemFont()).

Then this should be the case for all controls on all platforms: if no font explicitly has been set, return null. Otherwise the control itself can interpret the null value and return org.eclipse.swt.graphics.Device.getSystemFont() itself.
Comment 16 Lakshmi P Shanmugam CLA 2022-03-14 14:10:58 EDT
(In reply to Ned Twigg from comment #11)
> Try doing:
> 
>     System.out.println("Font is " + control.getFont());
>     control.setFont(control.getFont());
> 
> I get "Font is null".
> 
> > I think the row height *should* be taller for this macOS SDK.
> 
> macOS 11 has an emphasis on unifying the UI between macOS / iPad, which
> includes a default UI styling which is big enough to be touch-friendly. But
> you can still opt-in to the older style, and I think that's the appropriate
> path for SWT. Using the `setFont(null)` hack, we are getting a pixel-perfect
> match between x86 and aarch64. We don't want to restyle our application to
> be iPad-friendly, we want row heights appropriate for mouse & keyboard, not
> touch.

control.getFont() returns the default system font when no font is set explicitly. control.setFont(null) also sets the font to the default system font. So, both
control.setFont(control.getFont()) and control.setFont(null) should have the same effect.

SWT can set setFont(null) for Table/Tree/List on aarch64 if it fixes the row height bug.
Comment 17 Lakshmi P Shanmugam CLA 2022-03-14 14:11:59 EDT
(In reply to Thomas Singer from comment #15)
> (In reply to Andrey Loskutov from comment #14)
> > (In reply to Thomas Singer from comment #13)
> > > I would consider a null return value as bug. The documentation does not
> > > mention it. Hence it must be not-null.
> > 
> > Nope. The null means, the control has no *specific* font set, and simply
> > uses display default font (org.eclipse.swt.graphics.Device.getSystemFont()).
> 
> Then this should be the case for all controls on all platforms: if no font
> explicitly has been set, return null. Otherwise the control itself can
> interpret the null value and return
> org.eclipse.swt.graphics.Device.getSystemFont() itself.

From the code, control.getFont() is not expected to return null. It either returns the non-null font set by setFont() or the default font on all platforms.