diff options
author | Silenio Quarti <silenio> | 2009-10-01 17:02:07 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2009-10-01 17:02:07 +0000 |
commit | 555307fe73377405fb00bb7d9821d70c3aa06ddb (patch) | |
tree | a44b1f87c0f44d3a5ec8fde9662c635c4d58acef | |
parent | 25c9259950b6c2e3656bcb3bf46f58db97de481d (diff) | |
download | eclipse.platform.swt-555307fe73377405fb00bb7d9821d70c3aa06ddb.tar.gz eclipse.platform.swt-555307fe73377405fb00bb7d9821d70c3aa06ddb.tar.xz eclipse.platform.swt-555307fe73377405fb00bb7d9821d70c3aa06ddb.zip |
268687 - SWT Mac dock icon cannot be hidden
6 files changed, 52 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c index 9ac7f97592..f845790ea9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c @@ -1260,6 +1260,23 @@ JNIEXPORT jint JNICALL OS_NATIVE(CFBundleGetMainBundle) } #endif +#ifndef NO_CFBundleGetPackageInfo +JNIEXPORT void JNICALL OS_NATIVE(CFBundleGetPackageInfo) + (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2) +{ + jint *lparg1=NULL; + jint *lparg2=NULL; + OS_NATIVE_ENTER(env, that, CFBundleGetPackageInfo_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; + CFBundleGetPackageInfo((CFBundleRef)arg0, (UInt32 *)lparg1, (UInt32 *)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, CFBundleGetPackageInfo_FUNC); +} +#endif + #ifndef NO_CFDataGetBytePtr JNIEXPORT jint JNICALL OS_NATIVE(CFDataGetBytePtr) (JNIEnv *env, jclass that, jint arg0) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c index 4cfce5d83d..3e06a61962 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 988; -int OS_nativeFunctionCallCount[988]; +int OS_nativeFunctionCount = 989; +int OS_nativeFunctionCallCount[989]; char * OS_nativeFunctionNames[] = { "AECoerceDesc", "AECountItems", @@ -96,6 +96,7 @@ char * OS_nativeFunctionNames[] = { "CFArrayGetValueAtIndex", "CFBundleGetIdentifier", "CFBundleGetMainBundle", + "CFBundleGetPackageInfo", "CFDataGetBytePtr", "CFDataGetBytes", "CFDataGetLength", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h index 5ff0218bc2..122f4cfa77 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h @@ -104,6 +104,7 @@ typedef enum { CFArrayGetValueAtIndex_FUNC, CFBundleGetIdentifier_FUNC, CFBundleGetMainBundle_FUNC, + CFBundleGetPackageInfo_FUNC, CFDataGetBytePtr_FUNC, CFDataGetBytes_FUNC, CFDataGetLength_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java index 68d15074bb..02a0ac3d80 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java @@ -28,6 +28,7 @@ public class OS extends C { } /** Constants */ + public static final int APPL = ('A'<<24) + ('P'<<16) + ('P'<<8) + 'L'; public static final int RGBDirect = 16; public static final int alphaLock = 0x0400; public static final int badDragFlavorErr = -1852; @@ -1508,6 +1509,12 @@ public static final native int CFBundleGetMainBundle(); /** @param bundle cast=(CFBundleRef) */ public static final native int CFBundleGetIdentifier(int bundle); /** + * @param bundle cast=(CFBundleRef) + * @param packageType cast=(UInt32 *) + * @param packageCreator cast=(UInt32 *) + */ +public static final native void CFBundleGetPackageInfo(int bundle, int[] packageType, int[] packageCreator); +/** * @param theData cast=(CFDataRef) * @param range flags=struct * @param buffer cast=(UInt8 *) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java index 9c0cead59f..870ed0035b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java @@ -981,8 +981,7 @@ void createDisplay (DeviceData data) { System.out.println ("***WARNING: Detected: " + Integer.toHexString((OS.VERSION & 0xFF00) >> 8) + "." + Integer.toHexString((OS.VERSION & 0xF0) >> 4) + "." + Integer.toHexString(OS.VERSION & 0xF)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - int identifier = OS.CFBundleGetIdentifier(OS.CFBundleGetMainBundle()); - if (identifier == 0) { + if (!isBundled ()) { /* * Feature in the Macintosh. On OS 10.2, it is necessary * to explicitly check in with the Process Manager and set @@ -2387,6 +2386,17 @@ public void internal_dispose_GC (int context, GCData data) { OS.CGContextRelease (context); } +boolean isBundled () { + int mainBundle = OS.CFBundleGetMainBundle (); + if (mainBundle != 0) { + int [] packageType = new int [1]; + int [] packageCreator = new int [1]; + OS.CFBundleGetPackageInfo (mainBundle, packageType, packageCreator); + if (packageType[0] == OS.APPL) return true; + } + return false; +} + static boolean isValidClass (Class clazz) { String name = clazz.getName (); int index = name.lastIndexOf ('.'); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index a072914711..339fc48229 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -767,8 +767,7 @@ void createDisplay (DeviceData data) { application = NSApplication.sharedApplication(); isEmbedded = application.isRunning(); - NSString identifier = NSBundle.mainBundle().bundleIdentifier(); - if (identifier == null) { + if (!isBundled ()) { /* * Feature in the Macintosh. On OS 10.2, it is necessary * to explicitly check in with the Process Manager and set @@ -2622,6 +2621,17 @@ public void internal_dispose_GC (int /*long*/ context, GCData data) { } +boolean isBundled () { + NSBundle mainBundle = NSBundle.mainBundle(); + if (mainBundle != null) { + NSDictionary info = mainBundle.infoDictionary(); + if (info != null) { + return NSString.stringWith("APPL").isEqual(info.objectForKey(NSString.stringWith("CFBundlePackageType"))); //$NON-NLS-1$ $NON-NLS-2$ + } + } + return false; +} + static boolean isValidClass (Class clazz) { String name = clazz.getName (); int index = name.lastIndexOf ('.'); |