From 34d679ec1d457396fb5860c3d8d78d71a75c2f15 Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 28 Apr 2006 09:31:33 +0000 Subject: [PATCH] Minor key equivalent handling improvement. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22834 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Source/NSApplication.m | 25 ++++++++++++------------- Source/NSWindow.m | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20173bd8c..16796eeb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-04-28 Richard Frith-Macdonald + + * Source/NSApplication.m: ([-sendEvent:]) try key equivalents for + every key down, not just command modifiers ... consistent with + MacOS-X and allows carriage return as a button/menu key. + * Source/NSWindow.m: ([-performKeyEquivalent:]) only pass on to + our views if this is the key window (NSMenu overrides this). + 2006-04-27 Sergii Stoian * Source/NSMenuView.m (-rectOfItemAtIndex:): Delete origin.x fiddling diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 88580642a..78d1f8798 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -1825,23 +1825,22 @@ See -runModalForWindow: case NSKeyDown: { + NSArray *window_list = [self windows]; + unsigned count = [window_list count]; + unsigned i; + NSDebugLLog(@"NSEvent", @"send key down event\n"); - if ([theEvent modifierFlags] & NSCommandKeyMask) + for (i = 0; i < count; i++) { - NSArray *window_list = [self windows]; - unsigned i; - unsigned count = [window_list count]; + NSWindow *window = [window_list objectAtIndex: i]; - for (i = 0; i < count; i++) - { - NSWindow *window = [window_list objectAtIndex: i]; - - if ([window performKeyEquivalent: theEvent] == YES) - break; - } + if ([window performKeyEquivalent: theEvent] == YES) + break; + } + if (i == count) + { + [[theEvent window] sendEvent: theEvent]; } - else - [[theEvent window] sendEvent: theEvent]; break; } diff --git a/Source/NSWindow.m b/Source/NSWindow.m index f989ada74..57eb41c9f 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2538,7 +2538,7 @@ resetCursorRectsForView(NSView *theView) - (BOOL) performKeyEquivalent: (NSEvent*)theEvent { - if (_contentView) + if ([self isKeyWindow] && _contentView) return [_contentView performKeyEquivalent: theEvent]; return NO; }