mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-10 22:17: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:
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.FileOutputStream
|
||||
|
||||
plugins {
|
||||
`cpp-library`
|
||||
`flatlaf-cpp-library`
|
||||
@@ -67,7 +69,7 @@ tasks {
|
||||
|
||||
compilerArgs.addAll( toolChain.map {
|
||||
when( it ) {
|
||||
is Gcc, is Clang -> listOf()
|
||||
is Gcc, is Clang -> listOf( "-fvisibility=hidden" )
|
||||
else -> emptyList()
|
||||
}
|
||||
} )
|
||||
@@ -108,6 +110,29 @@ tasks {
|
||||
into( nativesDir )
|
||||
rename( "libflatlaf-natives-linux.so", libraryName )
|
||||
}
|
||||
|
||||
/*dump
|
||||
val dylib = linkedFile.asFile.get()
|
||||
val dylibDir = dylib.parent
|
||||
exec { commandLine( "size", dylib ) }
|
||||
exec {
|
||||
commandLine( "objdump",
|
||||
// commands
|
||||
"--archive-headers",
|
||||
"--section-headers",
|
||||
"--private-headers",
|
||||
"--reloc",
|
||||
"--dynamic-reloc",
|
||||
"--syms",
|
||||
// options
|
||||
// "--private-header",
|
||||
// files
|
||||
dylib )
|
||||
standardOutput = FileOutputStream( "$dylibDir/objdump.txt" )
|
||||
}
|
||||
exec { commandLine( "objdump", "--disassemble-all", dylib ); standardOutput = FileOutputStream( "$dylibDir/disassemble.txt" ) }
|
||||
exec { commandLine( "objdump", "--full-contents", dylib ); standardOutput = FileOutputStream( "$dylibDir/full-contents.txt" ) }
|
||||
dump*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
* @since 3.6
|
||||
*/
|
||||
|
||||
// see X11WmUtils.cpp
|
||||
Window getWindowHandle( JNIEnv* env, JAWT* awt, jobject window, Display** display_return );
|
||||
// declare external methods
|
||||
extern Window getWindowHandle( JNIEnv* env, JAWT* awt, jobject window, Display** display_return );
|
||||
|
||||
//---- class AutoReleaseStringUTF8 --------------------------------------------
|
||||
|
||||
@@ -55,12 +55,12 @@ public:
|
||||
#define isOptionClear( option ) ((optionsClear & com_formdev_flatlaf_ui_FlatNativeLinuxLibrary_ ## option) != 0)
|
||||
#define isOptionSetOrClear( option ) isOptionSet( option ) || isOptionClear( option )
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
void initFilters( GtkFileChooser* chooser, JNIEnv* env, jint fileTypeIndex, jobjectArray fileTypes ) {
|
||||
static void initFilters( GtkFileChooser* chooser, JNIEnv* env, jint fileTypeIndex, jobjectArray fileTypes ) {
|
||||
jint length = env->GetArrayLength( fileTypes );
|
||||
if( length <= 0 )
|
||||
return;
|
||||
@@ -89,7 +89,7 @@ void initFilters( GtkFileChooser* chooser, JNIEnv* env, jint fileTypeIndex, jobj
|
||||
}
|
||||
}
|
||||
|
||||
GdkWindow* getGdkWindow( JNIEnv* env, jobject window ) {
|
||||
static GdkWindow* getGdkWindow( JNIEnv* env, jobject window ) {
|
||||
// get the AWT
|
||||
JAWT awt;
|
||||
awt.version = JAWT_VERSION_1_4;
|
||||
|
||||
@@ -25,11 +25,14 @@
|
||||
*/
|
||||
|
||||
|
||||
bool sendEvent( JNIEnv *env, jobject window, const char *atom_name,
|
||||
long data0, long data1, long data2, long data3, long data4 );
|
||||
bool isWMHintSupported( Display* display, Window rootWindow, Atom atom );
|
||||
// declare exported methods
|
||||
Window getWindowHandle( JNIEnv* env, JAWT* awt, jobject window, Display** display_return );
|
||||
|
||||
// declare internal methods
|
||||
static bool sendEvent( JNIEnv *env, jobject window, const char *atom_name,
|
||||
long data0, long data1, long data2, long data3, long data4 );
|
||||
static bool isWMHintSupported( Display* display, Window rootWindow, Atom atom );
|
||||
|
||||
|
||||
//---- JNI methods ------------------------------------------------------------
|
||||
|
||||
@@ -79,7 +82,7 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeLinuxLibrary_xS
|
||||
0 );
|
||||
}
|
||||
|
||||
bool sendEvent( JNIEnv *env, jobject window, const char *atom_name,
|
||||
static bool sendEvent( JNIEnv *env, jobject window, const char *atom_name,
|
||||
long data0, long data1, long data2, long data3, long data4 )
|
||||
{
|
||||
// get the AWT
|
||||
@@ -131,7 +134,7 @@ bool sendEvent( JNIEnv *env, jobject window, const char *atom_name,
|
||||
}
|
||||
|
||||
|
||||
bool isWMHintSupported( Display* display, Window rootWindow, Atom atom ) {
|
||||
static bool isWMHintSupported( Display* display, Window rootWindow, Atom atom ) {
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long n_atoms;
|
||||
|
||||
Reference in New Issue
Block a user