macOS native rounded borders: (PR #772)
Some checks failed
CI / build (11, ) (push) Has been cancelled
CI / build (17, ) (push) Has been cancelled
CI / build (21, ) (push) Has been cancelled
CI / build (23, ) (push) Has been cancelled
CI / build (8, ) (push) Has been cancelled
Native Libraries / Natives (macos) (push) Has been cancelled
Native Libraries / Natives (ubuntu) (push) Has been cancelled
Native Libraries / Natives (windows) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled

- removed opacity from contentView.layer
- catch and log exceptions
This commit is contained in:
Karl Tauber
2025-01-21 11:58:03 +01:00
parent 2ef87dc789
commit 5e78b21df7
4 changed files with 20 additions and 5 deletions

View File

@@ -29,15 +29,21 @@
#endif
#define JNI_COCOA_TRY() \
@try {
#define JNI_COCOA_CATCH() \
} @catch( NSException *ex ) { \
NSLog( @"Exception: %@\nReason: %@\nUser Info: %@\nStack: %@", \
[ex name], [ex reason], [ex userInfo], [ex callStackSymbols] ); \
}
#define JNI_COCOA_ENTER() \
@autoreleasepool { \
@try {
JNI_COCOA_TRY()
#define JNI_COCOA_EXIT() \
} @catch( NSException *ex ) { \
NSLog( @"Exception: %@\nReason: %@\nUser Info: %@\nStack: %@", \
[ex name], [ex reason], [ex userInfo], [ex callStackSymbols] ); \
} \
JNI_COCOA_CATCH() \
}

View File

@@ -100,10 +100,13 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
return FALSE;
[FlatJNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
JNI_COCOA_TRY()
nsWindow.hasShadow = YES;
nsWindow.contentView.wantsLayer = YES;
nsWindow.contentView.layer.cornerRadius = radius;
nsWindow.contentView.layer.masksToBounds = YES;
nsWindow.contentView.layer.opaque = NO;
nsWindow.contentView.layer.borderWidth = borderWidth;
if( borderWidth > 0 ) {
@@ -120,6 +123,8 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
[nsWindow.contentView.layer removeAllAnimations];
[nsWindow invalidateShadow];
JNI_COCOA_CATCH()
}];
return TRUE;
@@ -157,6 +162,8 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
WindowData* windowData = getWindowData( nsWindow, true );
[FlatJNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
JNI_COCOA_TRY()
// NSLog( @"\n%@\n\n", [nsWindow.contentView.superview _subtreeDescription] );
// add/remove toolbar
@@ -235,6 +242,8 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
windowData.didExitFullScreenObserver = nil;
}
}
JNI_COCOA_CATCH()
}];
return TRUE;