Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Nemkin2020-01-21 07:52:37 +0000
committerNikita Nemkin2020-02-05 07:00:35 +0000
commitf8bc281b0e9002554df9fca679d28bad23903b21 (patch)
tree1c565575ccd41938c7dd468cd30ae7346e3c14b6
parent4d7eb631f5ba571ed4b0357d24d01d532be5cdda (diff)
downloadeclipse.platform.swt-f8bc281b0e9002554df9fca679d28bad23903b21.tar.gz
eclipse.platform.swt-f8bc281b0e9002554df9fca679d28bad23903b21.tar.xz
eclipse.platform.swt-f8bc281b0e9002554df9fca679d28bad23903b21.zip
Bug 559379 - [Cocoa] Remove double app menu workaround for AWT
Originally added in Bug 307302 (be954920b3bf). The problem isn't reproducible on Java 8+ and macOS 10.11+ Change-Id: Id40381a6b65c063ae4d599decd4cf19b6ba7571f Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c47
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java24
5 files changed, 3 insertions, 94 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
index d3d683bc32..f98ad950e8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1805,24 +1805,6 @@ JNIEXPORT void JNICALL OS_NATIVE(DeleteGlobalRef)
}
#endif
-#ifndef NO_DeleteMenuItem
-JNIEXPORT void JNICALL OS_NATIVE(DeleteMenuItem)
- (JNIEnv *env, jclass that, jlong arg0, jshort arg1)
-{
- OS_NATIVE_ENTER(env, that, DeleteMenuItem_FUNC);
-/*
- DeleteMenuItem((MenuRef)arg0, (short)arg1);
-*/
- {
- OS_LOAD_FUNCTION(fp, DeleteMenuItem)
- if (fp) {
- ((void (CALLING_CONVENTION*)(MenuRef, short))fp)((MenuRef)arg0, (short)arg1);
- }
- }
- OS_NATIVE_EXIT(env, that, DeleteMenuItem_FUNC);
-}
-#endif
-
#ifndef NO_DiffRgn
JNIEXPORT void JNICALL OS_NATIVE(DiffRgn)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2)
@@ -1919,33 +1901,6 @@ fail:
}
#endif
-#ifndef NO_GetIndMenuItemWithCommandID
-JNIEXPORT jint JNICALL OS_NATIVE(GetIndMenuItemWithCommandID)
- (JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2, jlongArray arg3, jshortArray arg4)
-{
- jlong *lparg3=NULL;
- jshort *lparg4=NULL;
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, GetIndMenuItemWithCommandID_FUNC);
- if (arg3) if ((lparg3 = (*env)->GetLongArrayElements(env, arg3, NULL)) == NULL) goto fail;
- if (arg4) if ((lparg4 = (*env)->GetShortArrayElements(env, arg4, NULL)) == NULL) goto fail;
-/*
- rc = (jint)GetIndMenuItemWithCommandID((MenuRef)arg0, (MenuCommand)arg1, (UInt32)arg2, (MenuRef *)lparg3, (MenuItemIndex *)lparg4);
-*/
- {
- OS_LOAD_FUNCTION(fp, GetIndMenuItemWithCommandID)
- if (fp) {
- rc = (jint)((jint (CALLING_CONVENTION*)(MenuRef, MenuCommand, UInt32, MenuRef *, MenuItemIndex *))fp)((MenuRef)arg0, (MenuCommand)arg1, (UInt32)arg2, (MenuRef *)lparg3, (MenuItemIndex *)lparg4);
- }
- }
-fail:
- if (arg4 && lparg4) (*env)->ReleaseShortArrayElements(env, arg4, lparg4, 0);
- if (arg3 && lparg3) (*env)->ReleaseLongArrayElements(env, arg3, lparg3, 0);
- OS_NATIVE_EXIT(env, that, GetIndMenuItemWithCommandID_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_GetRegionBounds
JNIEXPORT void JNICALL OS_NATIVE(GetRegionBounds)
(JNIEnv *env, jclass that, jlong arg0, jshortArray arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
index 5c093b83dc..b702fe86f9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -132,13 +132,11 @@ char * OS_nativeFunctionNames[] = {
"CloseRgn",
"CopyRgn",
"DeleteGlobalRef",
- "DeleteMenuItem",
"DiffRgn",
"DisposeRgn",
"EmptyRgn",
"GetCurrentProcess",
"GetIconRefFromTypeInfo",
- "GetIndMenuItemWithCommandID",
"GetRegionBounds",
"GetSystemUIMode",
"GetThemeMetric",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
index a1b5a5c3ca..26d5d5ab2d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -142,13 +142,11 @@ typedef enum {
CloseRgn_FUNC,
CopyRgn_FUNC,
DeleteGlobalRef_FUNC,
- DeleteMenuItem_FUNC,
DiffRgn_FUNC,
DisposeRgn_FUNC,
EmptyRgn_FUNC,
GetCurrentProcess_FUNC,
GetIconRefFromTypeInfo_FUNC,
- GetIndMenuItemWithCommandID_FUNC,
GetRegionBounds_FUNC,
GetSystemUIMode_FUNC,
GetThemeMetric_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index 02a437d64c..57464ae402 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -45,11 +45,6 @@ public class OS extends C {
public static final int kAlertCautionIcon = ('c'<<24) + ('a'<<16) + ('u'<<8) + 't';
public static final int kAlertNoteIcon = ('n'<<24) + ('o'<<16) + ('t'<<8) + 'e';
public static final int kAlertStopIcon = ('s'<<24) + ('t'<<16) + ('o'<<8) + 'p';
- public static final int kHICommandHide = ('h'<<24) + ('i'<<16) + ('d'<<8) + 'e';
- public static final int kHICommandHideOthers = ('h'<<24) + ('i'<<16) + ('d'<<8) + 'o';
- public static final int kHICommandShowAll = ('s'<<24) + ('h'<<16) + ('a'<<8) + 'l';
- public static final int kHICommandQuit = ('q'<<24) + ('u'<<16) + ('i'<<8) + 't';
- public static final int kHICommandServices = ('s'<<24) + ('e'<<16) + ('r'<<8) + 'v';
public static final int shiftKey = 1 << 9;
public static final int kThemeMetricFocusRectOutset = 7;
public static final int kHIThemeOrientationNormal = 0;
@@ -278,19 +273,6 @@ public static final native int CancelMenuTracking (long inRootMenu, boolean inIm
*/
public static final native long LSGetApplicationForInfo(int inType, int inCreator,long inExtension, int inRoleMask, byte[] outAppRef, int[] outAppURL);
/** @method flags=dynamic
- * @param mHandle cast=(MenuRef)
- * @param commandId cast=(MenuCommand)
- * @param index cast=(UInt32)
- * @param outMenu cast=(MenuRef *)
- * @param outIndex cast=(MenuItemIndex *)
- */
-public static final native int GetIndMenuItemWithCommandID(long mHandle, int commandId, int index, long [] outMenu, short[] outIndex);
-/** @method flags=dynamic
- * @param mHandle cast=(MenuRef)
- * @param index cast=(short)
- */
-public static final native void DeleteMenuItem(long mHandle, short index);
-/** @method flags=dynamic
* @param pmSessionInfo cast=(PMPrintSession)
* @param outPMPrinter cast=(PMPrinter *)
*/
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 20f5088cbb..92aeea7504 100644
--- 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
@@ -5413,30 +5413,6 @@ void applicationWillFinishLaunching (long id, long sel, long notification) {
boolean loaded = false;
/*
- * Bug in AWT: If the AWT starts up first when the VM was started on the first thread it assumes that
- * a Carbon-based SWT will be used, so it calls NSApplicationLoad(). This causes the Carbon menu
- * manager to create an application menu that isn't accessible via NSMenu. It is, however, accessible
- * via the Carbon menu manager, so find and delete the menu items it added.
- *
- * Note that this code will continue to work if Apple does change this. GetIndMenuWithCommandID will
- * return a non-zero value indicating failure, which we ignore.
- */
- if (isEmbedded) {
- long outMenu [] = new long [1];
- short outIndex[] = new short[1];
- int status = OS.GetIndMenuItemWithCommandID(0, OS.kHICommandHide, 1, outMenu, outIndex);
- if (status == 0) OS.DeleteMenuItem(outMenu[0], outIndex[0]);
- status = OS.GetIndMenuItemWithCommandID(0, OS.kHICommandHideOthers, 1, outMenu, outIndex);
- if (status == 0) OS.DeleteMenuItem(outMenu[0], outIndex[0]);
- status = OS.GetIndMenuItemWithCommandID(0, OS.kHICommandShowAll, 1, outMenu, outIndex);
- if (status == 0) OS.DeleteMenuItem(outMenu[0], outIndex[0]);
- status = OS.GetIndMenuItemWithCommandID(0, OS.kHICommandQuit, 1, outMenu, outIndex);
- if (status == 0) OS.DeleteMenuItem(outMenu[0], outIndex[0]);
- status = OS.GetIndMenuItemWithCommandID(0, OS.kHICommandServices, 1, outMenu, outIndex);
- if (status == 0) OS.DeleteMenuItem(outMenu[0], outIndex[0]);
- }
-
- /*
* Get the default locale's language, and then the display name of the language. Some Mac OS X localizations use the
* display name of the language, but many use the ISO two-char abbreviation instead.
*/

Back to the top