[Mac] Proper fix for Mac blank UI - add setClipsToBounds in NSView constructor
Background
The problem is blank areas appearing in the UI on Mac 14 (Sonoma). See https://github.com/eclipse-platform/eclipse.platform.swt/issues/1012
This affects macOS 14 (Sonoma) and whether the target launcher binary is linked to Mac SDK 14. The target launcher binary can be java in the case of running a child Eclipse or RCP app instance, or eclipse when running Eclipse itself.
As of now the eclipse launcher binary is linked to Mac SDK 13 so this issue won't manifest when running Eclipse (or an RCP app) itself. However, it may be that one day the eclipse binary will be linked to Mac SDK 14. See https://github.com/eclipse-equinox/equinox/issues/495
Temurin JDK 17.0.10, 21.0.2 and later versions are linked to Mac SDK 14 so the issue will be seen when launching a child Eclipse instance that targets one of these JDKs, because the binary launcher in this case is java.
Current remedy
The solution is to set setClipsToBounds to true for an NSView. See https://developer.apple.com/documentation/macos-release-notes/appkit-release-notes-for-macos-14#NSView
This has been done in three places in two PRs in the Widget component. See https://github.com/eclipse-platform/eclipse.platform.swt/pull/1081 and https://github.com/eclipse-platform/eclipse.platform.swt/pull/1232
Long-term remedy
Those three instances of setClipsToBounds may not be enough and ideally we should set it just once in the constructor of NSView like this:
public NSView(long id) {
super(id);
OS.objc_msgSend(id, OS.sel_setClipsToBounds_, true);
}
However, this is not as simple as inserting one line of code as explained by @lshanmug - https://github.com/eclipse-platform/eclipse.platform.swt/pull/1081#issuecomment-1984309289 and I'll quote it here:
setClipstoBounds can't be added directly to NSView.java, it has to ideally be added through the MacGenerator tool and generated. But since it's a new symbol, it can't be added through the tool as well without updating the bridgesupport files. (for more info pls see https://github.com/eclipse-platform/eclipse.platform.swt/blob/master/bundles/org.eclipse.swt/Readme.macOS.md)
So I've opened this issue to track the possibility of doing this. Disclaimer - I don't know how to do this, so help required!