[macOS 26] Add layer-based border rendering for Text and Combo widgets#3302
[macOS 26] Add layer-based border rendering for Text and Combo widgets#3302tobiasmelcher wants to merge 2 commits into
Conversation
The macOS runtime can report incorrect OS versions (10.16 instead of actual version) when the executable's linked SDK is too old. Add OS.getMachOSDKVersion() to extract the SDK version from the LC_BUILD_VERSION load command in the main executable's Mach-O header. This allows SWT to detect the SDK version the running JVM was built against, enabling proper diagnostics for version reporting issues.
|
I think I went into the wrong direction. I got following explanation from Gemini. I will try the Description This change is part of Apple's move toward layer-backed controls and the "Liquid Glass" design language, where traditional CPU-based drawing of bezels is being phased out in favor of GPU-accelerated layer properties. Changes Enables Layer-Backing: Sets wantsLayer = true for the control. Manual Border Definition: Uses CALayer properties to define a border that mimics the native appearance. System Color Integration: Uses NSColor.separatorColor to ensure the border automatically adapts to Light Mode, Dark Mode, and high-contrast accessibility settings. Refined Geometry: Applies a slight cornerRadius to align with modern macOS UI standards. Technical Snippet (Implementation Logic) Swift Forward Compatibility: Moves away from deprecated drawing behaviors toward the recommended AppKit/Core Animation architecture. No Regression: On older macOS versions, this approach remains functionally identical and provides a cleaner, modern aesthetic. |
|
Thank you for taking so much time to investigate this, @tobias-melcher. It's great to see the continuously increasing understanding of what changed/happens. Looking forward to hopefully seeing a solution that keeps SWT adopt the latest macOS look & feel. The screenshots already look very promising. |
On macOS 26 (Tahoe) Liquid Glass, all text fields and combo boxes require a visible border regardless of SWT.BORDER style. This adds the necessary Cocoa bindings (NSView.setWantsLayer, CALayer.setBorderColor/ setBorderWidth/setCornerRadius, NSColor.separatorColor/CGColor) and draws borders via the layer pipeline. The shared logic is extracted into Control.configureLayerBorder() and the SDK version is cached in OS.MACH_O_SDK_VERSION.
5cd8838 to
1e4df2d
Compare
|
Pull request 1e4df2d no longer uses any hack or workaround from my point of view. Following screenshots are made with -Dorg.eclipse.swt.internal.carbon.smallFonts
What do you think? Is it an improvement compared to the current state? Does it make sense to merge these changes? |
I don't think it's a good idea to merge any of these macOS changes so late in 4.40. If there is more time for targeting a later release it allows (at least me) more time to test on macOS 15, 26 and on various combinations. It would be a shame to find serious regressions in 4.40. |
No worries, I don't want to break any release. It is fine for me. Just wanted to know if the change goes into the right direction. |
Thanks. I want to spend some focussed time testing this and the other changes to Mac for macOS 26 support and also test for possible regressions on earlier macOS versions (I have various Mac setups including Intel). It would be helpful if the changes which are proposed could have longer testing period into 4.41. Thanks for your work on this! |









On macOS 26 (Tahoe) Liquid Glass, all text fields and combo boxes
require a visible border regardless of SWT.BORDER style. This adds
the necessary Cocoa bindings (NSView.setWantsLayer,
CALayer.setBorderColor/
setBorderWidth/setCornerRadius, NSColor.separatorColor/CGColor) and
draws borders via the layer pipeline. The shared logic is extracted
into Control.configureLayerBorder() and the SDK version is cached in
OS.MACH_O_SDK_VERSION.