author | serb |
Sat, 26 Sep 2015 22:38:36 +0300 | |
changeset 32872 | abca6234313d |
parent 32293 | 269494f7adec |
child 32875 | eb8e90bef9aa |
permissions | -rw-r--r-- |
12047 | 1 |
/* |
32293 | 2 |
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
12047 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
#import <dlfcn.h> |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
27 |
#import <pthread.h> |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
28 |
#import <objc/runtime.h> |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
29 |
#import <Cocoa/Cocoa.h> |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
30 |
#import <Security/AuthSession.h> |
12047 | 31 |
|
32 |
#include "jni_util.h" |
|
33 |
#import "LWCToolkit.h" |
|
34 |
#import "ThreadUtilities.h" |
|
35 |
#import "CSystemColors.h" |
|
13991
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
36 |
#import "NSApplicationAWT.h" |
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
37 |
#import "PropertiesUtilities.h" |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
38 |
#import "ApplicationDelegate.h" |
12047 | 39 |
|
40 |
#import "sun_lwawt_macosx_LWCToolkit.h" |
|
41 |
||
18232 | 42 |
#import "sizecalc.h" |
43 |
||
32872 | 44 |
#import <JavaRuntimeSupport/JavaRuntimeSupport.h> |
45 |
||
12047 | 46 |
int gNumberOfButtons; |
47 |
jint* gButtonDownMasks; |
|
48 |
||
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
49 |
// Indicates that the app has been started with -XstartOnFirstThread |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
50 |
// (directly or via WebStart settings), and AWT should not run its |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
51 |
// own event loop in this mode. Even if a loop isn't running yet, |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
52 |
// we expect an embedder (e.g. SWT) to start it some time later. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
53 |
static BOOL forceEmbeddedMode = NO; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
54 |
|
25564
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
55 |
// Indicates if awt toolkit is embedded into another UI toolkit |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
56 |
static BOOL isEmbedded = NO; |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
57 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
58 |
// This is the data necessary to have JNI_OnLoad wait for AppKit to start. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
59 |
static BOOL sAppKitStarted = NO; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
60 |
static pthread_mutex_t sAppKitStarted_mutex = PTHREAD_MUTEX_INITIALIZER; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
61 |
static pthread_cond_t sAppKitStarted_cv = PTHREAD_COND_INITIALIZER; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
62 |
|
12047 | 63 |
@implementation AWTToolkit |
64 |
||
65 |
static long eventCount; |
|
66 |
||
67 |
+ (long) getEventCount{ |
|
68 |
return eventCount; |
|
69 |
} |
|
70 |
||
32293 | 71 |
+ (void) eventCountPlusPlus{ |
12047 | 72 |
eventCount++; |
73 |
} |
|
74 |
||
75 |
@end |
|
76 |
||
77 |
||
78 |
@interface AWTRunLoopObject : NSObject { |
|
79 |
BOOL _shouldEndRunLoop; |
|
80 |
} |
|
81 |
@end |
|
82 |
||
83 |
@implementation AWTRunLoopObject |
|
84 |
||
85 |
- (id) init { |
|
86 |
self = [super init]; |
|
87 |
if (self != nil) { |
|
88 |
_shouldEndRunLoop = NO; |
|
89 |
} |
|
90 |
return self; |
|
91 |
} |
|
92 |
||
93 |
- (BOOL) shouldEndRunLoop { |
|
94 |
return _shouldEndRunLoop; |
|
95 |
} |
|
96 |
||
97 |
- (void) endRunLoop { |
|
98 |
_shouldEndRunLoop = YES; |
|
99 |
} |
|
100 |
||
101 |
@end |
|
102 |
||
23681
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
103 |
@interface JavaRunnable : NSObject { } |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
104 |
@property jobject runnable; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
105 |
- (id)initWithRunnable:(jobject)gRunnable; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
106 |
- (void)perform; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
107 |
@end |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
108 |
|
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
109 |
@implementation JavaRunnable |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
110 |
@synthesize runnable = _runnable; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
111 |
|
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
112 |
- (id)initWithRunnable:(jobject)gRunnable { |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
113 |
if (self = [super init]) { |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
114 |
self.runnable = gRunnable; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
115 |
} |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
116 |
return self; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
117 |
} |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
118 |
|
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
119 |
- (void)dealloc { |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
120 |
JNIEnv *env = [ThreadUtilities getJNIEnv]; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
121 |
if (self.runnable) { |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
122 |
(*env)->DeleteGlobalRef(env, self.runnable); |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
123 |
} |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
124 |
[super dealloc]; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
125 |
} |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
126 |
|
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
127 |
- (void)perform { |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
128 |
JNIEnv* env = [ThreadUtilities getJNIEnv]; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
129 |
static JNF_CLASS_CACHE(sjc_Runnable, "java/lang/Runnable"); |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
130 |
static JNF_MEMBER_CACHE(jm_Runnable_run, sjc_Runnable, "run", "()V"); |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
131 |
JNFCallVoidMethod(env, self.runnable, jm_Runnable_run); |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
132 |
[self release]; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
133 |
} |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
134 |
@end |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
135 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
136 |
void setBusy(BOOL busy) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
137 |
AWT_ASSERT_APPKIT_THREAD; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
138 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
139 |
JNIEnv *env = [ThreadUtilities getJNIEnv]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
140 |
static JNF_CLASS_CACHE(jc_AWTAutoShutdown, "sun/awt/AWTAutoShutdown"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
141 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
142 |
if (busy) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
143 |
static JNF_STATIC_MEMBER_CACHE(jm_notifyBusyMethod, jc_AWTAutoShutdown, "notifyToolkitThreadBusy", "()V"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
144 |
JNFCallStaticVoidMethod(env, jm_notifyBusyMethod); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
145 |
} else { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
146 |
static JNF_STATIC_MEMBER_CACHE(jm_notifyFreeMethod, jc_AWTAutoShutdown, "notifyToolkitThreadFree", "()V"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
147 |
JNFCallStaticVoidMethod(env, jm_notifyFreeMethod); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
148 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
149 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
150 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
151 |
static void setUpAWTAppKit(BOOL installObservers) |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
152 |
{ |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
153 |
if (installObservers) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
154 |
AWT_STARTUP_LOG(@"Setting up busy observers"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
155 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
156 |
// Add CFRunLoopObservers to call into AWT so that AWT knows that the |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
157 |
// AWT thread (which is the AppKit main thread) is alive. This way AWT |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
158 |
// will not automatically shutdown. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
159 |
CFRunLoopObserverRef busyObserver = CFRunLoopObserverCreateWithHandler( |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
160 |
NULL, // CFAllocator |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
161 |
kCFRunLoopAfterWaiting, // CFOptionFlags |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
162 |
true, // repeats |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
163 |
NSIntegerMax, // order |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
164 |
^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
165 |
setBusy(YES); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
166 |
}); |
32293 | 167 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
168 |
CFRunLoopObserverRef notBusyObserver = CFRunLoopObserverCreateWithHandler( |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
169 |
NULL, // CFAllocator |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
170 |
kCFRunLoopBeforeWaiting, // CFOptionFlags |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
171 |
true, // repeats |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
172 |
NSIntegerMin, // order |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
173 |
^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
174 |
setBusy(NO); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
175 |
}); |
32293 | 176 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
177 |
CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
178 |
CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
179 |
CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode); |
32293 | 180 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
181 |
CFRelease(busyObserver); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
182 |
CFRelease(notBusyObserver); |
32293 | 183 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
184 |
setBusy(YES); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
185 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
186 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
187 |
JNIEnv* env = [ThreadUtilities getJNIEnv]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
188 |
static JNF_CLASS_CACHE(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
189 |
static JNF_STATIC_MEMBER_CACHE(jsm_installToolkitThreadInJava, jc_LWCToolkit, "installToolkitThreadInJava", "()V"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
190 |
JNFCallStaticVoidMethod(env, jsm_installToolkitThreadInJava); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
191 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
192 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
193 |
BOOL isSWTInWebStart(JNIEnv* env) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
194 |
NSString *swtWebStart = [PropertiesUtilities javaSystemPropertyForKey:@"com.apple.javaws.usingSWT" withEnv:env]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
195 |
return [@"true" isCaseInsensitiveLike:swtWebStart]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
196 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
197 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
198 |
static void AWT_NSUncaughtExceptionHandler(NSException *exception) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
199 |
NSLog(@"Apple AWT Internal Exception: %@", [exception description]); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
200 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
201 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
202 |
@interface AWTStarter : NSObject |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
203 |
+ (void)start:(BOOL)headless; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
204 |
+ (void)starter:(BOOL)onMainThread headless:(BOOL)headless; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
205 |
+ (void)appKitIsRunning:(id)arg; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
206 |
@end |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
207 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
208 |
@implementation AWTStarter |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
209 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
210 |
+ (BOOL) isConnectedToWindowServer { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
211 |
SecuritySessionId session_id; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
212 |
SessionAttributeBits session_info; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
213 |
OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
214 |
if (status != noErr) return NO; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
215 |
if (!(session_info & sessionHasGraphicAccess)) return NO; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
216 |
return YES; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
217 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
218 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
219 |
+ (BOOL) markAppAsDaemon { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
220 |
id jrsAppKitAWTClass = objc_getClass("JRSAppKitAWT"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
221 |
SEL markAppSel = @selector(markAppIsDaemon); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
222 |
if (![jrsAppKitAWTClass respondsToSelector:markAppSel]) return NO; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
223 |
return [jrsAppKitAWTClass performSelector:markAppSel] ? YES : NO; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
224 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
225 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
226 |
+ (void)appKitIsRunning:(id)arg { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
227 |
AWT_ASSERT_APPKIT_THREAD; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
228 |
AWT_STARTUP_LOG(@"About to message AppKit started"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
229 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
230 |
// Signal that AppKit has started (or is already running). |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
231 |
pthread_mutex_lock(&sAppKitStarted_mutex); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
232 |
sAppKitStarted = YES; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
233 |
pthread_cond_signal(&sAppKitStarted_cv); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
234 |
pthread_mutex_unlock(&sAppKitStarted_mutex); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
235 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
236 |
AWT_STARTUP_LOG(@"Finished messaging AppKit started"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
237 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
238 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
239 |
+ (void)start:(BOOL)headless |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
240 |
{ |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
241 |
// onMainThread is NOT the same at SWT mode! |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
242 |
// If the JVM was started on the first thread for SWT, but the SWT loads the AWT on a secondary thread, |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
243 |
// onMainThread here will be false but SWT mode will be true. If we are currently on the main thread, we don't |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
244 |
// need to throw AWT startup over to another thread. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
245 |
BOOL onMainThread = [NSThread isMainThread]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
246 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
247 |
NSString* msg = [NSString stringWithFormat:@"+[AWTStarter start headless:%d] { onMainThread:%d }", headless, onMainThread]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
248 |
AWT_STARTUP_LOG(msg); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
249 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
250 |
if (!headless) |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
251 |
{ |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
252 |
// Listen for the NSApp to start. This indicates that JNI_OnLoad can proceed. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
253 |
// It must wait because there is a chance that another java thread will grab |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
254 |
// the AppKit lock before the +[NSApplication sharedApplication] returns. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
255 |
// See <rdar://problem/3492666> for an example. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
256 |
[[NSNotificationCenter defaultCenter] addObserver:[AWTStarter class] |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
257 |
selector:@selector(appKitIsRunning:) |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
258 |
name:NSApplicationDidFinishLaunchingNotification |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
259 |
object:nil]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
260 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
261 |
AWT_STARTUP_LOG(@"+[AWTStarter start:::]: registered NSApplicationDidFinishLaunchingNotification"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
262 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
263 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
264 |
[ThreadUtilities performOnMainThreadWaiting:NO block:^() { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
265 |
[AWTStarter starter:onMainThread headless:headless]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
266 |
}]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
267 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
268 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
269 |
if (!headless && !onMainThread) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
270 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
271 |
AWT_STARTUP_LOG(@"about to wait on AppKit startup mutex"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
272 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
273 |
// Wait here for AppKit to have started (or for AWT to have been loaded into |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
274 |
// an already running NSApplication). |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
275 |
pthread_mutex_lock(&sAppKitStarted_mutex); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
276 |
while (sAppKitStarted == NO) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
277 |
pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
278 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
279 |
pthread_mutex_unlock(&sAppKitStarted_mutex); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
280 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
281 |
// AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
282 |
AWT_STARTUP_LOG(@"got out of the AppKit startup mutex"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
283 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
284 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
285 |
if (!headless) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
286 |
// Don't set the delegate until the NSApplication has been created and |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
287 |
// its finishLaunching has initialized it. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
288 |
// ApplicationDelegate is the support code for com.apple.eawt. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
289 |
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){ |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
290 |
id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
291 |
if (delegate != nil) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
292 |
OSXAPP_SetApplicationDelegate(delegate); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
293 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
294 |
}]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
295 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
296 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
297 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
298 |
+ (void)starter:(BOOL)wasOnMainThread headless:(BOOL)headless { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
299 |
NSAutoreleasePool *pool = [NSAutoreleasePool new]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
300 |
// Add the exception handler of last resort |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
301 |
NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
302 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
303 |
// Headless mode trumps either ordinary AWT or SWT-in-AWT mode. Declare us a daemon and return. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
304 |
if (headless) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
305 |
// Note that we don't install run loop observers in headless mode |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
306 |
// because we don't need them (see 7174704) |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
307 |
if (!forceEmbeddedMode) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
308 |
setUpAWTAppKit(false); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
309 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
310 |
[AWTStarter markAppAsDaemon]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
311 |
return; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
312 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
313 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
314 |
if (forceEmbeddedMode) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
315 |
AWT_STARTUP_LOG(@"in SWT or SWT/WebStart mode"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
316 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
317 |
// Init a default NSApplication instance instead of the NSApplicationAWT. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
318 |
// Note that [NSApp isRunning] will return YES after that, though |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
319 |
// this behavior isn't specified anywhere. We rely on that. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
320 |
NSApplicationLoad(); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
321 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
322 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
323 |
// This will create a NSApplicationAWT for standalone AWT programs, unless there is |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
324 |
// already a NSApplication instance. If there is already a NSApplication instance, |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
325 |
// and -[NSApplication isRunning] returns YES, AWT is embedded inside another |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
326 |
// AppKit Application. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
327 |
NSApplication *app = [NSApplicationAWT sharedApplication]; |
25564
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
328 |
isEmbedded = ![NSApp isKindOfClass:[NSApplicationAWT class]]; |
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
329 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
330 |
if (!isEmbedded) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
331 |
// Install run loop observers and set the AppKit Java thread name |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
332 |
setUpAWTAppKit(true); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
333 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
334 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
335 |
// AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
336 |
if (![app isRunning]) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
337 |
AWT_STARTUP_LOG(@"+[AWTStarter startAWT]: ![app isRunning]"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
338 |
// This is where the AWT AppKit thread parks itself to process events. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
339 |
[NSApplicationAWT runAWTLoopWithApp: app]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
340 |
} else { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
341 |
// We're either embedded, or showing a splash screen |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
342 |
if (isEmbedded) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
343 |
AWT_STARTUP_LOG(@"running embedded"); |
32293 | 344 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
345 |
// We don't track if the runloop is busy, so set it free to let AWT finish when it needs |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
346 |
setBusy(NO); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
347 |
} else { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
348 |
AWT_STARTUP_LOG(@"running after showing a splash screen"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
349 |
} |
32293 | 350 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
351 |
// Signal so that JNI_OnLoad can proceed. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
352 |
if (!wasOnMainThread) [AWTStarter appKitIsRunning:nil]; |
32293 | 353 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
354 |
// Proceed to exit this call as there is no reason to run the NSApplication event loop. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
355 |
} |
32293 | 356 |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
357 |
[pool drain]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
358 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
359 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
360 |
@end |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
361 |
|
12047 | 362 |
/* |
363 |
* Class: sun_lwawt_macosx_LWCToolkit |
|
364 |
* Method: nativeSyncQueue |
|
365 |
* Signature: (J)Z |
|
366 |
*/ |
|
367 |
JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_nativeSyncQueue |
|
368 |
(JNIEnv *env, jobject self, jlong timeout) |
|
369 |
{ |
|
32293 | 370 |
long currentEventNum = [AWTToolkit getEventCount]; |
12047 | 371 |
|
13991
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
372 |
NSApplication* sharedApp = [NSApplication sharedApplication]; |
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
373 |
if ([sharedApp isKindOfClass:[NSApplicationAWT class]]) { |
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
374 |
NSApplicationAWT* theApp = (NSApplicationAWT*)sharedApp; |
32293 | 375 |
// We use two different API to post events to the application, |
376 |
// - [NSApplication postEvent] |
|
377 |
// - CGEventPost(), see CRobot.m |
|
378 |
// It was found that if we post an event via CGEventPost in robot and |
|
379 |
// immediately after this we will post the second event via |
|
380 |
// [NSApp postEvent] then sometimes the second event will be handled |
|
381 |
// first. The opposite isn't proved, but we use both here to be safer. |
|
382 |
[theApp postDummyEvent:false]; |
|
383 |
[theApp waitForDummyEvent:timeout / 2.0]; |
|
384 |
[theApp postDummyEvent:true]; |
|
385 |
[theApp waitForDummyEvent:timeout / 2.0]; |
|
386 |
||
13991
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
387 |
} else { |
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
388 |
// could happen if we are embedded inside SWT application, |
32293 | 389 |
// in this case just spin a single empty block through |
13991
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
390 |
// the event loop to give it a chance to process pending events |
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
391 |
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){}]; |
e62879b84a14
7124239: [macosx] sun.awt.SunToolkit.InfiniteLoop exception in realSync called from SwingTestHelper
leonidr
parents:
13004
diff
changeset
|
392 |
} |
32293 | 393 |
|
12047 | 394 |
if (([AWTToolkit getEventCount] - currentEventNum) != 0) { |
395 |
return JNI_TRUE; |
|
396 |
} |
|
32293 | 397 |
|
12047 | 398 |
return JNI_FALSE; |
399 |
} |
|
400 |
||
24169
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
401 |
/* |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
402 |
* Class: sun_lwawt_macosx_LWCToolkit |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
403 |
* Method: flushNativeSelectors |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
404 |
* Signature: ()J |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
405 |
*/ |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
406 |
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_flushNativeSelectors |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
407 |
(JNIEnv *env, jclass clz) |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
408 |
{ |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
409 |
JNF_COCOA_ENTER(env); |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
410 |
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){}]; |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
411 |
JNF_COCOA_EXIT(env); |
4efa892f600b
8038765: [macosx] Toolkit.sync should be implemented
serb
parents:
23681
diff
changeset
|
412 |
} |
12047 | 413 |
|
414 |
/* |
|
415 |
* Class: sun_lwawt_macosx_LWCToolkit |
|
416 |
* Method: beep |
|
417 |
* Signature: ()V |
|
418 |
*/ |
|
419 |
JNIEXPORT void JNICALL |
|
420 |
Java_sun_lwawt_macosx_LWCToolkit_beep |
|
421 |
(JNIEnv *env, jobject self) |
|
422 |
{ |
|
423 |
NSBeep(); // produces both sound and visual flash, if configured in System Preferences |
|
424 |
} |
|
425 |
||
426 |
static UInt32 RGB(NSColor *c) { |
|
427 |
c = [c colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; |
|
428 |
if (c == nil) |
|
429 |
{ |
|
430 |
return -1; // opaque white |
|
431 |
} |
|
432 |
||
433 |
CGFloat r, g, b, a; |
|
434 |
[c getRed:&r green:&g blue:&b alpha:&a]; |
|
435 |
||
436 |
UInt32 ir = (UInt32) (r*255+0.5), |
|
437 |
ig = (UInt32) (g*255+0.5), |
|
438 |
ib = (UInt32) (b*255+0.5), |
|
439 |
ia = (UInt32) (a*255+0.5); |
|
440 |
||
441 |
// NSLog(@"%@ %d, %d, %d", c, ir, ig, ib); |
|
442 |
||
443 |
return ((ia & 0xFF) << 24) | ((ir & 0xFF) << 16) | ((ig & 0xFF) << 8) | ((ib & 0xFF) << 0); |
|
444 |
} |
|
445 |
||
23301
618f7a6142c0
8034035: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/LWCToolkit.m
pchelko
parents:
18274
diff
changeset
|
446 |
BOOL doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) { |
12047 | 447 |
jint len = (*env)->GetArrayLength(env, jColors); |
448 |
||
449 |
UInt32 colorsArray[len]; |
|
450 |
UInt32 *colors = colorsArray; |
|
451 |
||
452 |
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ |
|
453 |
NSUInteger i; |
|
454 |
for (i = 0; i < len; i++) { |
|
455 |
colors[i] = RGB([CSystemColors getColor:i useAppleColor:useAppleColors]); |
|
456 |
} |
|
457 |
}]; |
|
458 |
||
459 |
jint *_colors = (*env)->GetPrimitiveArrayCritical(env, jColors, 0); |
|
23301
618f7a6142c0
8034035: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/LWCToolkit.m
pchelko
parents:
18274
diff
changeset
|
460 |
if (_colors == NULL) { |
618f7a6142c0
8034035: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/LWCToolkit.m
pchelko
parents:
18274
diff
changeset
|
461 |
return NO; |
618f7a6142c0
8034035: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/LWCToolkit.m
pchelko
parents:
18274
diff
changeset
|
462 |
} |
12047 | 463 |
memcpy(_colors, colors, len * sizeof(UInt32)); |
464 |
(*env)->ReleasePrimitiveArrayCritical(env, jColors, _colors, 0); |
|
23301
618f7a6142c0
8034035: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/LWCToolkit.m
pchelko
parents:
18274
diff
changeset
|
465 |
return YES; |
12047 | 466 |
} |
467 |
||
468 |
/** |
|
469 |
* Class: sun_lwawt_macosx_LWCToolkit |
|
470 |
* Method: loadNativeColors |
|
471 |
* Signature: ([I[I)V |
|
472 |
*/ |
|
473 |
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_loadNativeColors |
|
474 |
(JNIEnv *env, jobject peer, jintArray jSystemColors, jintArray jAppleColors) |
|
475 |
{ |
|
476 |
JNF_COCOA_ENTER(env); |
|
23301
618f7a6142c0
8034035: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/LWCToolkit.m
pchelko
parents:
18274
diff
changeset
|
477 |
if (doLoadNativeColors(env, jSystemColors, NO)) { |
618f7a6142c0
8034035: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/LWCToolkit.m
pchelko
parents:
18274
diff
changeset
|
478 |
doLoadNativeColors(env, jAppleColors, YES); |
618f7a6142c0
8034035: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/LWCToolkit.m
pchelko
parents:
18274
diff
changeset
|
479 |
} |
12047 | 480 |
JNF_COCOA_EXIT(env); |
481 |
} |
|
482 |
||
483 |
/* |
|
484 |
* Class: sun_lwawt_macosx_LWCToolkit |
|
485 |
* Method: createAWTRunLoopMediator |
|
486 |
* Signature: ()J |
|
487 |
*/ |
|
488 |
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_LWCToolkit_createAWTRunLoopMediator |
|
489 |
(JNIEnv *env, jclass clz) |
|
490 |
{ |
|
491 |
AWT_ASSERT_APPKIT_THREAD; |
|
492 |
||
23651
e41298d0da2f
8037099: [macosx] Remove all references to GC from native OBJ-C code
pchelko
parents:
23328
diff
changeset
|
493 |
jlong result; |
12047 | 494 |
|
23651
e41298d0da2f
8037099: [macosx] Remove all references to GC from native OBJ-C code
pchelko
parents:
23328
diff
changeset
|
495 |
JNF_COCOA_ENTER(env); |
12047 | 496 |
// We double retain because this object is owned by both main thread and "other" thread |
497 |
// We release in both doAWTRunLoop and stopAWTRunLoop |
|
23651
e41298d0da2f
8037099: [macosx] Remove all references to GC from native OBJ-C code
pchelko
parents:
23328
diff
changeset
|
498 |
result = ptr_to_jlong([[[AWTRunLoopObject alloc] init] retain]); |
e41298d0da2f
8037099: [macosx] Remove all references to GC from native OBJ-C code
pchelko
parents:
23328
diff
changeset
|
499 |
JNF_COCOA_EXIT(env); |
e41298d0da2f
8037099: [macosx] Remove all references to GC from native OBJ-C code
pchelko
parents:
23328
diff
changeset
|
500 |
|
e41298d0da2f
8037099: [macosx] Remove all references to GC from native OBJ-C code
pchelko
parents:
23328
diff
changeset
|
501 |
return result; |
12047 | 502 |
} |
503 |
||
504 |
/* |
|
505 |
* Class: sun_lwawt_macosx_LWCToolkit |
|
17899 | 506 |
* Method: doAWTRunLoopImpl |
12047 | 507 |
* Signature: (JZZ)V |
508 |
*/ |
|
17899 | 509 |
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_doAWTRunLoopImpl |
510 |
(JNIEnv *env, jclass clz, jlong mediator, jboolean processEvents, jboolean inAWT) |
|
12047 | 511 |
{ |
512 |
AWT_ASSERT_APPKIT_THREAD; |
|
513 |
JNF_COCOA_ENTER(env); |
|
514 |
||
515 |
AWTRunLoopObject* mediatorObject = (AWTRunLoopObject*)jlong_to_ptr(mediator); |
|
516 |
||
517 |
if (mediatorObject == nil) return; |
|
518 |
||
15985
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
519 |
// Don't use acceptInputForMode because that doesn't setup autorelease pools properly |
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
520 |
BOOL isRunning = true; |
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
521 |
while (![mediatorObject shouldEndRunLoop] && isRunning) { |
17899 | 522 |
isRunning = [[NSRunLoop currentRunLoop] runMode:(inAWT ? [JNFRunLoop javaRunLoopMode] : NSDefaultRunLoopMode) |
15985
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
523 |
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.010]]; |
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
524 |
if (processEvents) { |
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
525 |
//We do not spin a runloop here as date is nil, so does not matter which mode to use |
32293 | 526 |
// Processing all events excluding NSApplicationDefined which need to be processed |
31170
4d414cfb92cc
8068886: IDEA IntelliJ crashes in objc_msgSend when an accessibility tool is enabled
anashaty
parents:
27272
diff
changeset
|
527 |
// on the main loop only (those events are intended for disposing resources) |
15985
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
528 |
NSEvent *event; |
31170
4d414cfb92cc
8068886: IDEA IntelliJ crashes in objc_msgSend when an accessibility tool is enabled
anashaty
parents:
27272
diff
changeset
|
529 |
if ((event = [NSApp nextEventMatchingMask:(NSAnyEventMask & ~NSApplicationDefined) |
15985
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
530 |
untilDate:nil |
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
531 |
inMode:NSDefaultRunLoopMode |
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
532 |
dequeue:YES]) != nil) { |
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
533 |
[NSApp sendEvent:event]; |
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
534 |
} |
12047 | 535 |
|
536 |
} |
|
537 |
} |
|
23651
e41298d0da2f
8037099: [macosx] Remove all references to GC from native OBJ-C code
pchelko
parents:
23328
diff
changeset
|
538 |
[mediatorObject release]; |
12047 | 539 |
JNF_COCOA_EXIT(env); |
540 |
} |
|
541 |
||
542 |
/* |
|
543 |
* Class: sun_lwawt_macosx_LWCToolkit |
|
544 |
* Method: stopAWTRunLoop |
|
545 |
* Signature: (J)V |
|
546 |
*/ |
|
547 |
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_stopAWTRunLoop |
|
548 |
(JNIEnv *env, jclass clz, jlong mediator) |
|
549 |
{ |
|
550 |
JNF_COCOA_ENTER(env); |
|
551 |
||
552 |
AWTRunLoopObject* mediatorObject = (AWTRunLoopObject*)jlong_to_ptr(mediator); |
|
553 |
||
15985
b9e25a486549
8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler
pchelko
parents:
15322
diff
changeset
|
554 |
[ThreadUtilities performOnMainThread:@selector(endRunLoop) on:mediatorObject withObject:nil waitUntilDone:NO]; |
12047 | 555 |
|
23651
e41298d0da2f
8037099: [macosx] Remove all references to GC from native OBJ-C code
pchelko
parents:
23328
diff
changeset
|
556 |
[mediatorObject release]; |
12047 | 557 |
|
558 |
JNF_COCOA_EXIT(env); |
|
559 |
} |
|
560 |
||
561 |
/* |
|
562 |
* Class: sun_lwawt_macosx_LWCToolkit |
|
23681
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
563 |
* Method: performOnMainThreadAfterDelay |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
564 |
* Signature: (Ljava/lang/Runnable;J)V |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
565 |
*/ |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
566 |
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_performOnMainThreadAfterDelay |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
567 |
(JNIEnv *env, jclass clz, jobject runnable, jlong delay) |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
568 |
{ |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
569 |
JNF_COCOA_ENTER(env); |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
570 |
jobject gRunnable = (*env)->NewGlobalRef(env, runnable); |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
571 |
CHECK_NULL(gRunnable); |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
572 |
[ThreadUtilities performOnMainThreadWaiting:NO block:^() { |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
573 |
JavaRunnable* performer = [[JavaRunnable alloc] initWithRunnable:gRunnable]; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
574 |
[performer performSelector:@selector(perform) withObject:nil afterDelay:(delay/1000.0)]; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
575 |
}]; |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
576 |
JNF_COCOA_EXIT(env); |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
577 |
} |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
578 |
|
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
579 |
|
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
580 |
/* |
2044c9d2b681
8037840: [macosx] Rewrite CWarning window to eliminate the ExecutorService
pchelko
parents:
23651
diff
changeset
|
581 |
* Class: sun_lwawt_macosx_LWCToolkit |
12047 | 582 |
* Method: isCapsLockOn |
583 |
* Signature: ()Z |
|
584 |
*/ |
|
585 |
JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isCapsLockOn |
|
586 |
(JNIEnv *env, jobject self) |
|
587 |
{ |
|
588 |
__block jboolean isOn = JNI_FALSE; |
|
589 |
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ |
|
590 |
NSUInteger modifiers = [NSEvent modifierFlags]; |
|
591 |
isOn = (modifiers & NSAlphaShiftKeyMask) != 0; |
|
592 |
}]; |
|
593 |
||
594 |
return isOn; |
|
595 |
} |
|
596 |
||
597 |
/* |
|
598 |
* Class: sun_lwawt_macosx_LWCToolkit |
|
599 |
* Method: isApplicationActive |
|
600 |
* Signature: ()Z |
|
601 |
*/ |
|
602 |
JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive |
|
603 |
(JNIEnv *env, jclass clazz) |
|
604 |
{ |
|
12177
7b84ed7d0efa
7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents:
12047
diff
changeset
|
605 |
__block jboolean active = JNI_FALSE; |
12047 | 606 |
|
607 |
JNF_COCOA_ENTER(env); |
|
608 |
||
15322
3638f33225ec
7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents:
13991
diff
changeset
|
609 |
[ThreadUtilities performOnMainThreadWaiting:YES block:^() { |
12177
7b84ed7d0efa
7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents:
12047
diff
changeset
|
610 |
active = (jboolean)[NSRunningApplication currentApplication].active; |
15322
3638f33225ec
7179050: [macosx] Make LWAWT be able to run on AppKit thread
serb
parents:
13991
diff
changeset
|
611 |
}]; |
12047 | 612 |
|
613 |
JNF_COCOA_EXIT(env); |
|
614 |
||
12177
7b84ed7d0efa
7150349: [macosx] Applets attempting to show popup menus activate the applet process
dcherepanov
parents:
12047
diff
changeset
|
615 |
return active; |
12047 | 616 |
} |
617 |
||
27272
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
618 |
/* |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
619 |
* Class: sun_lwawt_macosx_LWCToolkit |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
620 |
* Method: activateApplicationIgnoringOtherApps |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
621 |
* Signature: ()V |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
622 |
*/ |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
623 |
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_activateApplicationIgnoringOtherApps |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
624 |
(JNIEnv *env, jclass clazz) |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
625 |
{ |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
626 |
JNF_COCOA_ENTER(env); |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
627 |
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){ |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
628 |
if(![NSApp isActive]){ |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
629 |
[NSApp activateIgnoringOtherApps:YES]; |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
630 |
} |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
631 |
}]; |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
632 |
JNF_COCOA_EXIT(env); |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
633 |
} |
cffe6690ee9d
8038919: Requesting focus to a modeless dialog doesn't work on Safari
mcherkas
parents:
26751
diff
changeset
|
634 |
|
12047 | 635 |
|
636 |
/* |
|
637 |
* Class: sun_awt_SunToolkit |
|
638 |
* Method: closeSplashScreen |
|
639 |
* Signature: ()V |
|
640 |
*/ |
|
641 |
JNIEXPORT void JNICALL |
|
642 |
Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls) |
|
643 |
{ |
|
644 |
void *hSplashLib = dlopen(0, RTLD_LAZY); |
|
645 |
if (!hSplashLib) return; |
|
646 |
||
647 |
void (*splashClose)() = dlsym(hSplashLib, "SplashClose"); |
|
648 |
if (splashClose) { |
|
649 |
splashClose(); |
|
650 |
} |
|
651 |
dlclose(hSplashLib); |
|
652 |
} |
|
653 |
||
654 |
||
655 |
// TODO: definitely doesn't belong here (copied from fontpath.c in the |
|
656 |
// solaris tree)... |
|
657 |
||
658 |
JNIEXPORT jstring JNICALL |
|
659 |
Java_sun_font_FontManager_getFontPath |
|
660 |
(JNIEnv *env, jclass obj, jboolean noType1) |
|
661 |
{ |
|
662 |
return JNFNSToJavaString(env, @"/Library/Fonts"); |
|
663 |
} |
|
664 |
||
665 |
// This isn't yet used on unix, the implementation is added since shared |
|
666 |
// code calls this method in preparation for future use. |
|
667 |
JNIEXPORT void JNICALL |
|
668 |
Java_sun_font_FontManager_populateFontFileNameMap |
|
669 |
(JNIEnv *env, jclass obj, jobject fontToFileMap, jobject fontToFamilyMap, jobject familyToFontListMap, jobject locale) |
|
670 |
{ |
|
671 |
||
672 |
} |
|
25563
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
673 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
674 |
/* |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
675 |
* Class: sun_lwawt_macosx_LWCToolkit |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
676 |
* Method: initIDs |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
677 |
* Signature: ()V |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
678 |
*/ |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
679 |
JNIEXPORT void JNICALL |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
680 |
Java_sun_lwawt_macosx_LWCToolkit_initIDs |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
681 |
(JNIEnv *env, jclass klass) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
682 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
683 |
JNF_COCOA_ENTER(env) |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
684 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
685 |
gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
686 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
687 |
jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
688 |
CHECK_NULL(inputEventClazz); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
689 |
jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I"); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
690 |
CHECK_NULL(getButtonDownMasksID); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
691 |
jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
692 |
jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
693 |
CHECK_NULL(tmp); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
694 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
695 |
gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
696 |
if (gButtonDownMasks == NULL) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
697 |
gNumberOfButtons = 0; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
698 |
(*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
699 |
JNU_ThrowOutOfMemoryError(env, NULL); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
700 |
return; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
701 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
702 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
703 |
int i; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
704 |
for (i = 0; i < gNumberOfButtons; i++) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
705 |
gButtonDownMasks[i] = tmp[i]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
706 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
707 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
708 |
(*env)->ReleaseIntArrayElements(env, obj, tmp, 0); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
709 |
(*env)->DeleteLocalRef(env, obj); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
710 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
711 |
JNF_COCOA_EXIT(env) |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
712 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
713 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
714 |
/* |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
715 |
* Class: sun_lwawt_macosx_LWCToolkit |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
716 |
* Method: initAppkit |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
717 |
* Signature: (Ljava/lang/ThreadGroup;)V |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
718 |
*/ |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
719 |
JNIEXPORT void JNICALL |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
720 |
Java_sun_lwawt_macosx_LWCToolkit_initAppkit |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
721 |
(JNIEnv *env, jclass klass, jobject appkitThreadGroup, jboolean headless) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
722 |
JNF_COCOA_ENTER(env) |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
723 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
724 |
[ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, appkitThreadGroup)]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
725 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
726 |
// Launcher sets this env variable if -XstartOnFirstThread is specified |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
727 |
char envVar[80]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
728 |
snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid()); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
729 |
if (getenv(envVar) != NULL) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
730 |
forceEmbeddedMode = YES; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
731 |
unsetenv(envVar); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
732 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
733 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
734 |
if (isSWTInWebStart(env)) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
735 |
forceEmbeddedMode = YES; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
736 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
737 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
738 |
[AWTStarter start:headless ? YES : NO]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
739 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
740 |
JNF_COCOA_EXIT(env) |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
741 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
742 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
743 |
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
744 |
OSXAPP_SetJavaVM(vm); |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
745 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
746 |
// We need to let Foundation know that this is a multithreaded application, if it isn't already. |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
747 |
if (![NSThread isMultiThreaded]) { |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
748 |
[NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil]; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
749 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
750 |
|
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
751 |
return JNI_VERSION_1_4; |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
752 |
} |
248400a88627
8033367: [macosx] Appletviewer was broken in jdk8 b124
pchelko
parents:
24550
diff
changeset
|
753 |
|
25564
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
754 |
/* |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
755 |
* Class: sun_lwawt_macosx_LWCToolkit |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
756 |
* Method: isEmbedded |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
757 |
* Signature: ()Z |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
758 |
*/ |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
759 |
JNIEXPORT jboolean JNICALL |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
760 |
Java_sun_lwawt_macosx_LWCToolkit_isEmbedded |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
761 |
(JNIEnv *env, jclass klass) { |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
762 |
return isEmbedded ? JNI_TRUE : JNI_FALSE; |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
763 |
} |
871d3490f14d
8048549: [macosx] Disable usage of system menu bar if AWT is embedded in FX
pchelko
parents:
25563
diff
changeset
|
764 |