diff options
author | Silenio Quarti <Silenio_Quarti@ca.ibm.com> | 2012-01-31 17:32:55 -0500 |
---|---|---|
committer | Felipe Heidrich <Felipe_Heidrich@ca.ibm.com> | 2012-01-31 17:32:55 -0500 |
commit | 0fc9a694d7469800fdb4849776d3de00cc1d2797 (patch) | |
tree | d2c894300531054af2acd9838a7cf29ef8255e02 | |
parent | 49414e687e8dd970398fad4ea36d97ab635cb3a8 (diff) | |
download | eclipse.platform.swt-0fc9a694d7469800fdb4849776d3de00cc1d2797.tar.gz eclipse.platform.swt-0fc9a694d7469800fdb4849776d3de00cc1d2797.tar.xz eclipse.platform.swt-0fc9a694d7469800fdb4849776d3de00cc1d2797.zip |
Bug 368757 - Using ESC as accelerator does not work on OS X, but on
Windows
5 files changed, 23 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras index 3d248b28fb..9ad591e3c8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras @@ -1130,6 +1130,9 @@ <method class_method="true" selector="currentCursor" swt_gen="true"> <retval swt_gen="true"></retval> </method> + <method selector="hotSpot" swt_gen="true"> + <retval swt_gen="true"></retval> + </method> <method selector="initWithImage:hotSpot:" swt_gen="true"> <arg swt_gen="true"></arg> <arg swt_gen="true"></arg> @@ -1823,6 +1826,10 @@ <method selector="numberOfItems" swt_gen="true"> <retval swt_gen="true"></retval> </method> + <method selector="performKeyEquivalent:" swt_gen="true"> + <arg swt_gen="true"></arg> + <retval swt_gen="true"></retval> + </method> <method class_method="true" selector="popUpContextMenu:withEvent:forView:" swt_gen="true"> <arg swt_gen="true"></arg> <arg swt_gen="true"></arg> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java index d70c8bd49a..c6a2587b27 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCursor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java index 15e8b657a4..b9320e824a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSMenu.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -69,6 +69,10 @@ public int /*long*/ numberOfItems() { return OS.objc_msgSend(this.id, OS.sel_numberOfItems); } +public boolean performKeyEquivalent(NSEvent theEvent) { + return OS.objc_msgSend_bool(this.id, OS.sel_performKeyEquivalent_, theEvent != null ? theEvent.id : 0); +} + public static void popUpContextMenu(NSMenu menu, NSEvent event, NSView view) { OS.objc_msgSend(OS.class_NSMenu, OS.sel_popUpContextMenu_withEvent_forView_, menu != null ? menu.id : 0, event != null ? event.id : 0, view != null ? view.id : 0); } 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 1605efdf46..0ac973f28d 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 @@ -1311,8 +1311,8 @@ public static final int /*long*/ sel_highlightSelectionInClipRect_ = sel_registe public static final int /*long*/ sel_hitPart = sel_registerName("hitPart"); public static final int /*long*/ sel_hitTest_ = sel_registerName("hitTest:"); public static final int /*long*/ sel_hitTestForEvent_inRect_ofView_ = sel_registerName("hitTestForEvent:inRect:ofView:"); -public static final int /*long*/ sel_hotSpot = sel_registerName("hotSpot"); public static final int /*long*/ sel_host = sel_registerName("host"); +public static final int /*long*/ sel_hotSpot = sel_registerName("hotSpot"); public static final int /*long*/ sel_hourOfDay = sel_registerName("hourOfDay"); public static final int /*long*/ sel_iconForFile_ = sel_registerName("iconForFile:"); public static final int /*long*/ sel_iconForFileType_ = sel_registerName("iconForFileType:"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java index a3aa7a3cf6..07d0b564c3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java @@ -2222,6 +2222,15 @@ void windowSendEvent (int /*long*/ id, int /*long*/ sel, int /*long*/ event) { break; case OS.NSKeyDown: + /* + * Feature in Cocoa. For some reason, Cocoa does not perform accelerators + * with ESC key code. The fix is to perform the accelerators ourselves. + */ + if (nsEvent.keyCode() == 53 /* ESC */ && menuBar != null && !menuBar.isDisposed()) { + if (menuBar.nsMenu.performKeyEquivalent(nsEvent)) { + return; + } + } /** * Feature in cocoa. Control+Tab, Ctrl+Shift+Tab, Ctrl+PageDown and Ctrl+PageUp are * swallowed to handle native traversal. If we find that, force the key event to |