comparison src/macosx/native/sun/awt/AWTView.m @ 8555:d72ca6dac444

8020209: [macosx] Mac OS X key event confusion for "COMMAND PLUS" Reviewed-by: anthony, serb
author leonidr
date Tue, 22 Oct 2013 16:45:08 +0400
parents 04612a52e7bd
children bedc29a6d074
comparison
equal deleted inserted replaced
15:85b822580dc7 16:4eabe73a847f
270 /* 270 /*
271 * KeyEvents support 271 * KeyEvents support
272 */ 272 */
273 273
274 - (void) keyDown: (NSEvent *)event { 274 - (void) keyDown: (NSEvent *)event {
275
276 fProcessingKeystroke = YES; 275 fProcessingKeystroke = YES;
277 fKeyEventsNeeded = YES; 276 fKeyEventsNeeded = YES;
278 277
279 // Allow TSM to look at the event and potentially send back NSTextInputClient messages. 278 // Allow TSM to look at the event and potentially send back NSTextInputClient messages.
280 [self interpretKeyEvents:[NSArray arrayWithObject:event]]; 279 [self interpretKeyEvents:[NSArray arrayWithObject:event]];
306 [self deliverJavaKeyEventHelper: event]; 305 [self deliverJavaKeyEventHelper: event];
307 } 306 }
308 307
309 - (BOOL) performKeyEquivalent: (NSEvent *) event { 308 - (BOOL) performKeyEquivalent: (NSEvent *) event {
310 [self deliverJavaKeyEventHelper: event]; 309 [self deliverJavaKeyEventHelper: event];
310
311 // Workaround for 8020209: special case for "Cmd =" and "Cmd ."
312 // because Cocoa calls performKeyEquivalent twice for these keystrokes
313 NSUInteger modFlags = [event modifierFlags] &
314 (NSCommandKeyMask | NSAlternateKeyMask | NSShiftKeyMask | NSControlKeyMask);
315 if (modFlags == NSCommandKeyMask) {
316 NSString *eventChars = [event charactersIgnoringModifiers];
317 if ([eventChars length] == 1) {
318 unichar ch = [eventChars characterAtIndex:0];
319 if (ch == '=' || ch == '.') {
320 [[NSApp mainMenu] performKeyEquivalent: event];
321 return YES;
322 }
323 }
324
325 }
326
311 return NO; 327 return NO;
312 } 328 }
313 329
314 /** 330 /**
315 * Utility methods and accessors 331 * Utility methods and accessors