diff options
author | Sravan Kumar Lakkimsetti | 2021-03-26 14:49:51 +0000 |
---|---|---|
committer | Sravan Kumar Lakkimsetti | 2021-03-26 14:49:51 +0000 |
commit | f1601abd39837180f3ec228e267a447d82cac0e0 (patch) | |
tree | 82848c12b84512304e44848e3574f546116790e3 | |
parent | e74ed9cfae4e87c78e130a23e3d38927a47d31e4 (diff) | |
download | rt.equinox.framework-f1601abd39837180f3ec228e267a447d82cac0e0.tar.gz rt.equinox.framework-f1601abd39837180f3ec228e267a447d82cac0e0.tar.xz rt.equinox.framework-f1601abd39837180f3ec228e267a447d82cac0e0.zip |
Change-Id: If36833d6887611ea460ab74c4fe7f5e839c6d69e
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
5 files changed, 41 insertions, 47 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c index a38047f4e..e93adb197 100644 --- a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c +++ b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c @@ -111,10 +111,11 @@ static NSWindow* window = nil; NSImage* image = [[NSImage alloc] initByReferencingFile: featureImage]; [featureImage release]; if (image != NULL) { - NSSize size = [image size]; - NSRect rect = {{0, 0}, {size.width, size.height}}; + NSImageRep* imageRep = [image bestRepresentationForDevice: [[NSScreen mainScreen] deviceDescription]]; + NSRect rect = {{0, 0}, {[imageRep pixelsWide], [imageRep pixelsHigh]}}; + [image setSize: NSMakeSize([imageRep pixelsWide], [imageRep pixelsHigh])]; [image autorelease]; - window = [[KeyWindow alloc] initWithContentRect: rect styleMask: NSWindowStyleMaskBorderless backing: NSBackingStoreBuffered defer: 0]; + window = [[KeyWindow alloc] initWithContentRect: rect styleMask: NSBorderlessWindowMask backing: NSBackingStoreBuffered defer: 0]; if (window != nil) { [window center]; [window setBackgroundColor: [NSColor colorWithPatternImage: image]]; @@ -140,7 +141,7 @@ static NSWindow* window = nil; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSEvent* event; NSApplication* application = [NSApplication sharedApplication]; - while ((event = [application nextEventMatchingMask: NSEventMaskAny untilDate: nil inMode: NSDefaultRunLoopMode dequeue: TRUE]) != nil) { + while ((event = [application nextEventMatchingMask: NSAnyEventMask untilDate: nil inMode: NSDefaultRunLoopMode dequeue: TRUE]) != nil) { [application sendEvent: event]; } [pool release]; @@ -172,7 +173,9 @@ static NSWindow* window = nil; CFURLRef url = NULL; NSAppleEventDescriptor *desc = [event descriptorAtIndex:index], *coerceDesc; if (!desc) continue; - if ((coerceDesc = [desc coerceToDescriptorType: typeFileURL]) != NULL) { + if ((coerceDesc = [desc coerceToDescriptorType: typeFSRef]) != NULL) { + url = CFURLCreateFromFSRef(kCFAllocatorDefault, [[coerceDesc data] bytes]); + } else if ((coerceDesc = [desc coerceToDescriptorType: typeFileURL]) != NULL) { NSData *data = [coerceDesc data]; url = CFURLCreateWithBytes(kCFAllocatorDefault, [data bytes], [data length], kCFStringEncodingUTF8, NULL); } @@ -667,5 +670,5 @@ const char* getUUID() { _TCHAR* getFolderForApplicationData() { NSString* bundleId = getCFBundleIdentifier(); NSString* appSupport = getApplicationSupport(); - return (_TCHAR*)[[NSString stringWithFormat:@"%@/%@_%s", appSupport, bundleId, getUUID()] UTF8String]; + return [[NSString stringWithFormat:@"%@/%@_%s", appSupport, bundleId, getUUID()] UTF8String]; } diff --git a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c index ff7944f3e..34aadbaf2 100644 --- a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c +++ b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c @@ -66,12 +66,9 @@ void displayMessage(char *title, char *message) } NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText:(NSString*)(inDescription != nil ? inError : nil)]; - [alert setInformativeText:(NSString*)(inDescription != nil ? inDescription : inError)]; - [alert addButtonWithTitle:@"Ok"]; + NSAlert* alert = [NSAlert alertWithMessageText: (NSString*)(inDescription != nil ? inError : nil) defaultButton: nil alternateButton: nil otherButton: nil informativeTextWithFormat: (NSString*)(inDescription != nil ? inDescription : inError)]; [[alert window] setTitle: [NSString stringWithUTF8String: title]]; - [alert setAlertStyle: NSAlertStyleCritical]; + [alert setAlertStyle: NSCriticalAlertStyle]; [alert runModal]; [pool release]; CFRelease(inError); @@ -106,7 +103,7 @@ void * loadLibrary( char * library ){ // check if it's a JVM bundle if (strstr(bundle, "libjvm") && (start = strstr(bundle, "/Contents/Home/")) != NULL) { - start[0] = 0; + start[0] = NULL; loadVMBundle(bundle); free(bundle); if (javaVMBundle) { @@ -146,11 +143,8 @@ char * resolveSymlinks( char * path ) { char * result = 0; CFURLRef url, resolved; CFStringRef string; - Boolean isStale; - CFDataRef data; - CFErrorRef errorRef; - - + FSRef fsRef; + Boolean isFolder, wasAliased; if(path == NULL) return path; @@ -160,26 +154,24 @@ char * resolveSymlinks( char * path ) { CFRelease(string); if(url == NULL) return path; - - data = CFURLCreateBookmarkDataFromFile(kCFAllocatorDefault, url, &errorRef); - if (data == NULL) { - CFRelease(url); - return path; - } - - resolved = CFURLCreateByResolvingBookmarkData(kCFAllocatorDefault, data, kCFURLBookmarkResolutionWithoutMountingMask|kCFURLBookmarkResolutionWithoutUIMask, NULL, NULL, &isStale, &errorRef); - if(resolved != NULL) { - string = CFURLCopyFileSystemPath(resolved, kCFURLPOSIXPathStyle); - CFIndex length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(string), kCFStringEncodingUTF8); - char *s = malloc(length); - if (CFStringGetCString(string, s, length, kCFStringEncodingUTF8)) { - result = s; - } else { - free(s); - } - CFRelease(string); - CFRelease(resolved); - } + + if(CFURLGetFSRef(url, &fsRef)) { + if( FSResolveAliasFile(&fsRef, true, &isFolder, &wasAliased) == noErr) { + resolved = CFURLCreateFromFSRef(kCFAllocatorDefault, &fsRef); + if(resolved != NULL) { + string = CFURLCopyFileSystemPath(resolved, kCFURLPOSIXPathStyle); + CFIndex length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(string), kCFStringEncodingUTF8); + char *s = malloc(length); + if (CFStringGetCString(string, s, length, kCFStringEncodingUTF8)) { + result = s; + } else { + free(s); + } + CFRelease(string); + CFRelease(resolved); + } + } + } CFRelease(url); return result; } diff --git a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c index 052ce7edd..c7973f1f6 100644 --- a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c +++ b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c @@ -26,7 +26,6 @@ #include <sys/wait.h> #include <sys/ioctl.h> #include <unistd.h> -#include <Cocoa/Cocoa.h> #include <CoreServices/CoreServices.h> #include <mach-o/dyld.h> @@ -50,12 +49,14 @@ static int fgPid; extern int original_main(int argc, char* argv[]); int main( int argc, char* argv[] ) { - - NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; - if ((version.majorVersion < 10) || ((version.majorVersion == 10) && (version.minorVersion < 14))) { - displayMessage("Error", "This application requires Mac OS 10.14 or greater."); - return 0; - } + SInt32 systemVersion= 0; + if (Gestalt(gestaltSystemVersion, &systemVersion) == noErr) { + systemVersion &= 0xffff; + if (systemVersion < 0x1050) { + displayMessage("Error", "This application requires Mac OS X 10.5 (Leopard) or greater."); + return 0; + } + } fgConsoleLog= fopen("/dev/console", "w"); fgPid= getpid(); diff --git a/features/org.eclipse.equinox.executable.feature/library/cocoa/make_cocoa.mak b/features/org.eclipse.equinox.executable.feature/library/cocoa/make_cocoa.mak index 185b68df9..fe34bee2f 100644 --- a/features/org.eclipse.equinox.executable.feature/library/cocoa/make_cocoa.mak +++ b/features/org.eclipse.equinox.executable.feature/library/cocoa/make_cocoa.mak @@ -37,7 +37,7 @@ EXEC = $(PROGRAM_OUTPUT) DLL = $(PROGRAM_LIBRARY) LIBS = -framework Cocoa -CFLAGS = -O \ +CFLAGS = -O -s \ -Wall \ -DCOCOA -xobjective-c \ $(ARCHS) \ diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipse.c b/features/org.eclipse.equinox.executable.feature/library/eclipse.c index f3ab12442..d6767b25e 100644 --- a/features/org.eclipse.equinox.executable.feature/library/eclipse.c +++ b/features/org.eclipse.equinox.executable.feature/library/eclipse.c @@ -216,10 +216,8 @@ static _TCHAR* startupMsg = _T_ECLIPSE("The %s executable launcher was unable to locate its \n\ companion launcher jar."); -#ifdef LINUX static _TCHAR* gtk2Msg = _T_ECLIPSE("The %s executable launcher no longer supports running with GTK + 2.x. Continuing using GTK+ 3.x."); -#endif static _TCHAR* homeMsg = _T_ECLIPSE("The %s executable launcher was unable to locate its \n\ |