/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#import "NSApplicationAWT.h"
#import <objc/runtime.h>
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#import "PropertiesUtilities.h"
#import "ThreadUtilities.h"
#import "QueuingApplicationDelegate.h"
#import "AWTIconData.h"
// Flag used to indicate to the Plugin2 event synthesis code to do a postEvent instead of sendEvent
{
// Headless: NO
// Embedded: NO
// Multiple Calls: NO
// Caller: +[NSApplication sharedApplication]
dummyEventTimestamp = 0.0;
// NSApplication will call _RegisterApplication with the application's bundle, but there may not be one.
// So, we need to call it ourselves to ensure the app is set up properly.
return [super init];
}
- (void)dealloc
{
[super dealloc];
}
//- (void)finalize { [super finalize]; }
- (void)finishLaunching
{
// Get default nib file location
// NOTE: This should learn about the current java.version. Probably best thru
// the Makefile system's -DFRAMEWORK_VERSION define. Need to be able to pass this
// thru to PB from the Makefile system and for local builds.
NSString *defaultNibFile = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.application.nib" withEnv:env];
if (!defaultNibFile) {
} else {
}
[NSBundle loadNibFile:defaultNibFile externalNameTable: [NSDictionary dictionaryWithObject:self forKey:@"NSOwner"] withZone:nil];
// Set user defaults to not try to parse application arguments.
NSDictionary * noOpenDict = [NSDictionary dictionaryWithObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
// Fix up the dock icon now that we are registered with CAS and the Dock.
// If we are using our nib (the default application NIB) we need to put the app name into
// the application menu, which has placeholders for the name.
if (sUsingDefaultNIB) {
NSUInteger i, itemCount;
// First submenu off the main menu is the application menu.
for (i = 0; i < itemCount; i++) {
}
}
if (applicationDelegate) {
} else {
}
[super finishLaunching];
// inform any interested parties that the AWT has arrived and is pumping
[[NSNotificationCenter defaultCenter] postNotificationName:JNFRunLoopDidStartNotification object:self];
}
- (void) registerWithProcessManager
{
// Headless: NO
// Embedded: NO
// Multiple Calls: NO
// Caller: -[NSApplicationAWT init]
char envVar[80];
// The following environment variable is set from the -Xdock:name param. It should be UTF8.
}
// If it wasn't specified as an argument, see if it was specified as a system property.
if (fApplicationName == nil) {
fApplicationName = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.application.name" withEnv:env];
}
// If we STILL don't have it, the app name is retrieved from an environment variable (set in java.c) It should be UTF8.
if (fApplicationName == nil) {
char mainClassEnvVar[80];
}
}
}
// The dock name is nil for double-clickable Java apps (bundled and Web Start apps)
// When that happens get the display name, and if that's not available fall back to
// CFBundleName.
if (fApplicationName == nil) {
if (fApplicationName == nil) {
fApplicationName = (NSString *)[mainBundle objectForInfoDictionaryKey:(NSString *)kCFBundleNameKey];
if (fApplicationName == nil) {
fApplicationName = (NSString *)[mainBundle objectForInfoDictionaryKey: (NSString *)kCFBundleExecutableKey];
if (fApplicationName == nil) {
// Name of last resort is the last part of the applicatoin name without the .app (consistent with CopyProcessName)
}
}
}
}
}
// We're all done trying to determine the app name. Hold on to it.
NSDictionary *registrationOptions = [NSMutableDictionary dictionaryWithObject:fApplicationName forKey:@"JRSAppNameKey"];
NSString *launcherType = [PropertiesUtilities javaSystemPropertyForKey:@"sun.java.launcher" withEnv:env];
}
NSString *uiElementProp = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.UIElement" withEnv:env];
}
NSString *backgroundOnlyProp = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.BackgroundOnly" withEnv:env];
}
// TODO replace with direct call
// [JRSAppKitAWT registerAWTAppWithOptions:registrationOptions];
return;
}
// HACK BEGIN
// The following is necessary to make the java process behave like a
// proper foreground application...
}];
// HACK END
}
// The following environment variable is set in java.c. It is probably UTF8.
char envVar[80];
}
if (theIconPath == nil) {
theIconPath = [PropertiesUtilities javaSystemPropertyForKey:@"apple.awt.application.icon" withEnv:env];
}
// Use the path specified to get the icon image
if (theIconPath != nil) {
}
// If no icon file was specified or we failed to get the icon image
// and we need to get an icon, then use the default icon
if (bundleIcon == nil) {
iconData = [[NSData alloc] initWithBytesNoCopy: sAWTIconData length: sizeof(sAWTIconData) freeWhenDone: NO];
}
}
// Set up the dock icon if we have an icon image.
}
}
// Make sure that when we run in AWTRunLoopMode we don't exit randomly
do {
@try {
} @catch (NSException* e) {
NSLog(@"Apple AWT Restarting Native Event Thread");
}
} while (YES);
}
- (BOOL)usingDefaultNib {
return sUsingDefaultNIB;
}
if (!optionsDictionary) {
[optionsDictionary setValue:[[[[[NSApp mainMenu] itemAtIndex:0] submenu] itemAtIndex:0] title] forKey:@"ApplicationName"];
}
}
}
#define DRAGMASK (NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDownMask | NSRightMouseDraggedMask | NSLeftMouseUpMask | NSRightMouseUpMask | NSFlagsChangedMask | NSKeyDownMask)
- (NSEvent *)nextEventMatchingMask:(NSUInteger)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag {
}
NSEvent *event = [super nextEventMatchingMask:mask untilDate:expiration inMode:mode dequeue: deqFlag];
return event;
}
// NSTimeInterval has microseconds precision
{
} else {
}
}
- (void)postDummyEvent {
windowNumber: 0
subtype: 0
data1: 0
data2: 0];
}
- (void)waitForDummyEvent {
}
@end
{
if (applicationDelegate && qad) {
}
}
}