src/macosx/native/sun/awt/LWCToolkit.m
Print this page
@@ -53,10 +53,13 @@
// (directly or via WebStart settings), and AWT should not run its
// own event loop in this mode. Even if a loop isn't running yet,
// we expect an embedder (e.g. SWT) to start it some time later.
static BOOL forceEmbeddedMode = NO;
+// Indicates if awt toolkit is embedded into another UI toolkit
+static BOOL isEmbedded = NO;
+
// This is the data necessary to have JNI_OnLoad wait for AppKit to start.
static BOOL sAppKitStarted = NO;
static pthread_mutex_t sAppKitStarted_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t sAppKitStarted_cv = PTHREAD_COND_INITIALIZER;
@@ -323,12 +326,11 @@
// This will create a NSApplicationAWT for standalone AWT programs, unless there is
// already a NSApplication instance. If there is already a NSApplication instance,
// and -[NSApplication isRunning] returns YES, AWT is embedded inside another
// AppKit Application.
NSApplication *app = [NSApplicationAWT sharedApplication];
- BOOL isEmbedded = ![NSApp isKindOfClass:[NSApplicationAWT class]];
- [ThreadUtilities setAWTEmbedded:isEmbedded];
+ isEmbedded = ![NSApp isKindOfClass:[NSApplicationAWT class]];
if (!isEmbedded) {
// Install run loop observers and set the AppKit Java thread name
setUpAWTAppKit(true);
}
@@ -721,5 +723,16 @@
}
return JNI_VERSION_1_4;
}
+/*
+ * Class: sun_lwawt_macosx_LWCToolkit
+ * Method: isEmbedded
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_isEmbedded
+(JNIEnv *env, jclass klass) {
+ return isEmbedded ? JNI_TRUE : JNI_FALSE;
+}
+