mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 17:59:34 +00:00
Some keys like arrow keys send double command events to NSView's performKeyEquivalent:, one for key up and one for key down. This doesn't make sense for us, so only handle key down command events. b=363005 r=cbarrett r=froodian r=cl
This commit is contained in:
parent
6e56193b6e
commit
d90417e60a
@ -3627,12 +3627,17 @@ static void ConvertCocoaKeyEventToMacEvent(NSEvent* cocoaEvent, EventRecord& mac
|
||||
|
||||
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent
|
||||
{
|
||||
if (mInComposition)
|
||||
// Don't bother if we're in composition. Also do not handle anything
|
||||
// that isn't a key down event. Some keys like arrow keys send command
|
||||
// events for up and down, and we only care about down. See bug 363002.
|
||||
if (mInComposition || ([theEvent type] != NSKeyDown))
|
||||
return NO;
|
||||
|
||||
// see if the menu system will handle the event
|
||||
if ([[NSApp mainMenu] performKeyEquivalent:theEvent])
|
||||
return YES;
|
||||
|
||||
// handle the event ourselves
|
||||
nsKeyEvent geckoEvent(PR_TRUE, 0, nsnull);
|
||||
geckoEvent.refPoint.x = geckoEvent.refPoint.y = 0;
|
||||
[self convertKeyEvent:theEvent message:NS_KEY_PRESS toGeckoEvent:&geckoEvent];
|
||||
|
Loading…
x
Reference in New Issue
Block a user