mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Look up key equivalents in the Services menu only after traversing
rest of the main menu to avoid accidentally shadowing key equivalents in the application's own menus. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31902 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8e4ca1e17e
commit
92601d85d8
3 changed files with 27 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2011-01-17 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSApplication.m (-sendEvent:):
|
||||
* Source/NSMenu.m (-performKeyEquivalent:):
|
||||
Look up key equivalents in the Services menu only after traversing
|
||||
the rest of the main menu to avoid accidentally shadowing key
|
||||
equivalents in the application's own menus.
|
||||
|
||||
2011-01-17 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* ColorPickers/GSWheelColorPicker.m (-regenerateImage):
|
||||
|
|
|
@ -2090,8 +2090,13 @@ See -runModalForWindow:
|
|||
case NSKeyDown:
|
||||
{
|
||||
NSDebugLLog(@"NSEvent", @"send key down event\n");
|
||||
/* Key equivalents must be looked up explicitly in the Services menu
|
||||
after checking the main menu, as NSMenu's -performKeyEquivalent:
|
||||
ignores the Services menu. See the comment in that method for a
|
||||
rationale. */
|
||||
if ([[self keyWindow] performKeyEquivalent: theEvent] == NO
|
||||
&& [[self mainMenu] performKeyEquivalent: theEvent] == NO)
|
||||
&& [[self mainMenu] performKeyEquivalent: theEvent] == NO
|
||||
&& [[self servicesMenu] performKeyEquivalent: theEvent] == NO)
|
||||
{
|
||||
[[theEvent window] sendEvent: theEvent];
|
||||
}
|
||||
|
|
|
@ -1244,6 +1244,19 @@ static BOOL menuBarVisible = YES;
|
|||
|
||||
if ([item hasSubmenu])
|
||||
{
|
||||
/* Ignore the Services submenu during menu traversal so that its key
|
||||
equivalents do not accidentally shadow standard key equivalents
|
||||
in the application's own menus. NSApp calls -performKeyEquivalent:
|
||||
explicitly for the Services menu when no matching key equivalent
|
||||
was found here (see NSApplication -sendEvent:).
|
||||
Note: Shadowing is no problem for a standard OpenStep menu, where
|
||||
the Services menu appears close to the end of the main menu, but
|
||||
is very likely for Macintosh or Windows 95 interface styles, where
|
||||
the Services menu appears in the first submenu of the main menu. */
|
||||
// FIXME Should really remove conflicting key equivalents from the
|
||||
// menus so that users don't get confused.
|
||||
if ([item submenu] == [NSApp servicesMenu])
|
||||
continue;
|
||||
// Recurse through submenus whether active or not.
|
||||
// Recurse through submenus whether active or not.
|
||||
if ([[item submenu] performKeyEquivalent: theEvent])
|
||||
|
|
Loading…
Reference in a new issue