[Cocoa] Replace deprecated NSProgressIndicatorPreferredThickness#3433
[Cocoa] Replace deprecated NSProgressIndicatorPreferredThickness#3433HeikoKlare wants to merge 1 commit into
Conversation
|
I thought you couldn't add code to |
That's a very good hint, thank you. I have to admit that I was not aware of the exact purpose of that tool. I just executed it and turns out that several changes performed in the recent past (by me and others) did not take that into account properly, such that running the MacGenerator now produces some unexpected result. I will try to take a look what needs to be done to make the current state consistent to the MacGenerator again. And we definitely have to update the |
|
Actually I missed that you also made changes in |
|
Might be. But since the agent did definitely not use the MacGenerator tool, we should not further process this before doing so and verifying that the change is sound. |
NSProgressIndicatorPreferredThickness is deprecated since macOS 10.14 in favor of using controlSize and sizeToFit. Add a binding for NSProgressIndicator#sizeToFit and use it in ProgressBar#computeSize to determine the default thickness for the progress indicator's control size, restoring the original frame afterwards. Contributes to eclipse-platform#3214 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ae5fe7f to
90cb2fd
Compare
NSProgressIndicatorPreferredThicknessis deprecated since macOS 10.14. The deprecation message in the SDK header (NSProgressIndicator.h) prescribes the replacement:This change adds a binding for
NSProgressIndicator#sizeToFitand uses it inProgressBar#computeSizeto determine the default thickness, restoring the original frame afterwards sincecomputeSizemust not have side effects on the widget's bounds. The header documents exactly the semantics this relies on:SWT always uses the bar style and never changes the indicator's
controlSize(it stays at the defaultNSControlSizeRegular), sosizeToFityields the recommended thickness for that control size.Note that this changes the default thickness of a
ProgressBarfrom the hardcoded 14px to the value AppKit actually reports for the current system (18px on macOS 15): the deprecated constant was a stale Aqua-era value that, per the deprecation message, "does not accurately represent the geometry" of the rendered indicator.How to test
Open the ProgressBar tab of the SWT ControlExample (
org.eclipse.swt.examples.controlexample.ControlExample). In the Size group, the default Preferred setting sizes the bars viacomputeSize, i.e., the changed code path. With this change, the horizontal progress bar becomes 18px instead of 14px tall (the vertical one correspondingly wider), matching the geometry AppKit recommends.Before:

After:

Contributes to #3214
🤖 Generated with Claude Code