Skip to content

Add option for smaller item (row) height on Mac - #1057

Closed
Phillipus wants to merge 2 commits into
eclipse-platform:masterfrom
Phillipus:mac-rowheight-option
Closed

Phillipus wants to merge 2 commits into
eclipse-platform:masterfrom
Phillipus:mac-rowheight-option

Conversation

@Phillipus

@Phillipus Phillipus commented Feb 21, 2024 •

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Feb 21, 2024 •

Copy link
Copy Markdown
Contributor

Test Results

   299 files  ±0     299 suites  ±0   6m 56s ⏱️ - 1m 14s
 4 099 tests ±0   4 091 ✅ ±0   8 💤 ±0  0 ❌ ±0 
12 209 runs  ±0  12 134 ✅ ±0  75 💤 ±0  0 ❌ ±0 

Results for commit 64233a2. ± Comparison against base commit 9149b68.

♻️ This comment has been updated with latest results.

@Phillipus
Phillipus force-pushed the mac-rowheight-option branch 3 times, most recently from c107893 to d9ff51e Compare March 2, 2024 12:19
- This is POC
- Set property -Dorg.eclipse.swt.internal.cocoa.smallItemHeight
- Need to set the initial item height in the constructors of List, Table and Tree
- See discussion at eclipse-platform/eclipse.platform.ui#1674
@Phillipus
Phillipus force-pushed the mac-rowheight-option branch from d9ff51e to 725f517 Compare March 14, 2024 14:34
* If this property exists then use smaller padding for item heights in Table, Tree and List controls
* TODO: this is initialized here, could this be put in a better place? And use a better property name?
*/
smallItemHeight = System.getProperty("org.eclipse.swt.internal.cocoa.smallItemHeight") != null;

@kohlschuetter kohlschuetter Mar 14, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like all this change does is to either set vertical cell padding to 1 ("smallItemHeight" enabled) or 8 (disabled). Couldn't the setFont/setItemHeight calls be made unconditionally, i.e. even when smallItemHeight was false?

What if instead introducing a boolean property, we would allow "vertical cell padding" to be configured as an integer? That way, we could even try values other than these two.

Also, could this be configured via CSS in a UI theme?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Couldn't the setFont/setItemHeight calls be made unconditionally, i.e. even when smallItemHeight was false?

That would be possible, but an overhead if the initial heights are the same as the ones set in setFont/setItemHeight

What if instead introducing a boolean property, we would allow "vertical cell padding" to be configured as an integer?

I have no personal preference, so that's something that users should decide.

Whatever method is chosen, the important thing is to keep the heights the same when the control is created and when setFont/setItemHeight is called, so we don't get "magical shrinkage".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What if instead introducing a boolean property, we would allow "vertical cell padding" to be configured as an integer?

To get the old item height back in Eclipse something like this would need to be added in eclipse.ini:

-Dorg.eclipse.swt.internal.cocoa.itemPadding=1

If this option is not set, the internal default would be 8 to match native macOS padding.

- This makes smaller item heights the default
- Option is org.eclipse.swt.internal.cocoa.enforceNativeItemHeightMinimum
- Native height maintained if option set
@Phillipus

Copy link
Copy Markdown
Contributor Author

Added a new commit with option

  • This makes smaller item heights the default
  • Option is org.eclipse.swt.internal.cocoa.enforceNativeItemHeightMinimum
  • Native height maintained if option set

Based on #1117

@Phillipus

Copy link
Copy Markdown
Contributor Author

Closing this in favour of #1117

@Phillipus Phillipus closed this Mar 15, 2024
@Phillipus
Phillipus deleted the mac-rowheight-option branch March 21, 2024 10:38
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.

2 participants