mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-15 16:27:13 -06:00
Native Libraries:
- made C methods `static` (similar to `private` in Java) to avoid that they are added (exported) to shared library symbol table - macOS and Linux: added `-fvisibility=hidden` to compiler options to mark C methods hidden by default
This commit is contained in:
@@ -126,10 +126,10 @@
|
||||
#define isOptionClear( option ) ((optionsClear & com_formdev_flatlaf_ui_FlatNativeMacLibrary_ ## option) != 0)
|
||||
#define isOptionSetOrClear( option ) isOptionSet( option ) || isOptionClear( option )
|
||||
|
||||
// declare methods
|
||||
NSWindow* getNSWindow( JNIEnv* env, jclass cls, jobject window );
|
||||
// declare external methods
|
||||
extern NSWindow* getNSWindow( JNIEnv* env, jclass cls, jobject window );
|
||||
|
||||
jobjectArray newJavaStringArray( JNIEnv* env, jsize count ) {
|
||||
static jobjectArray newJavaStringArray( JNIEnv* env, jsize count ) {
|
||||
jclass stringClass = env->FindClass( "java/lang/String" );
|
||||
return env->NewObjectArray( count, stringClass, NULL );
|
||||
}
|
||||
|
||||
@@ -39,13 +39,15 @@
|
||||
@implementation WindowData
|
||||
@end
|
||||
|
||||
// declare internal methods
|
||||
// declare exported methods
|
||||
NSWindow* getNSWindow( JNIEnv* env, jclass cls, jobject window );
|
||||
WindowData* getWindowData( NSWindow* nsWindow, bool allocate );
|
||||
void setWindowButtonsHidden( NSWindow* nsWindow, bool hidden );
|
||||
int getWindowButtonAreaWidth( NSWindow* nsWindow );
|
||||
int getWindowTitleBarHeight( NSWindow* nsWindow );
|
||||
bool isWindowFullScreen( NSWindow* nsWindow );
|
||||
|
||||
// declare internal methods
|
||||
static WindowData* getWindowData( NSWindow* nsWindow, bool allocate );
|
||||
static void setWindowButtonsHidden( NSWindow* nsWindow, bool hidden );
|
||||
static int getWindowButtonAreaWidth( NSWindow* nsWindow );
|
||||
static int getWindowTitleBarHeight( NSWindow* nsWindow );
|
||||
static bool isWindowFullScreen( NSWindow* nsWindow );
|
||||
|
||||
|
||||
NSWindow* getNSWindow( JNIEnv* env, jclass cls, jobject window ) {
|
||||
@@ -79,7 +81,7 @@ NSWindow* getNSWindow( JNIEnv* env, jclass cls, jobject window ) {
|
||||
return (NSWindow *) jlong_to_ptr( env->GetLongField( platformWindow, ptrID ) );
|
||||
}
|
||||
|
||||
WindowData* getWindowData( NSWindow* nsWindow, bool allocate ) {
|
||||
static WindowData* getWindowData( NSWindow* nsWindow, bool allocate ) {
|
||||
static char key;
|
||||
WindowData* windowData = objc_getAssociatedObject( nsWindow, &key );
|
||||
if( windowData == NULL && allocate ) {
|
||||
@@ -243,7 +245,7 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_setW
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void setWindowButtonsHidden( NSWindow* nsWindow, bool hidden ) {
|
||||
static void setWindowButtonsHidden( NSWindow* nsWindow, bool hidden ) {
|
||||
// get buttons
|
||||
NSView* buttons[3] = {
|
||||
[nsWindow standardWindowButton:NSWindowCloseButton],
|
||||
@@ -303,7 +305,7 @@ JNIEXPORT jobject JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_getWi
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int getWindowButtonAreaWidth( NSWindow* nsWindow ) {
|
||||
static int getWindowButtonAreaWidth( NSWindow* nsWindow ) {
|
||||
// get buttons
|
||||
NSView* buttons[3] = {
|
||||
[nsWindow standardWindowButton:NSWindowCloseButton],
|
||||
@@ -335,7 +337,7 @@ int getWindowButtonAreaWidth( NSWindow* nsWindow ) {
|
||||
return right + left;
|
||||
}
|
||||
|
||||
int getWindowTitleBarHeight( NSWindow* nsWindow ) {
|
||||
static int getWindowTitleBarHeight( NSWindow* nsWindow ) {
|
||||
NSView* closeButton = [nsWindow standardWindowButton:NSWindowCloseButton];
|
||||
if( closeButton == NULL )
|
||||
return -1;
|
||||
@@ -360,7 +362,7 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_isWi
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool isWindowFullScreen( NSWindow* nsWindow ) {
|
||||
static bool isWindowFullScreen( NSWindow* nsWindow ) {
|
||||
return ((nsWindow.styleMask & NSWindowStyleMaskFullScreen) != 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user