commit 5ec2425b17766f20600e224b05988dcc7580ea18 from: David Jeannot via: Russ Cox date: Mon Jan 16 22:02:06 2012 UTC devdraw: OS X dead key support R=rsc CC=plan9port.codebot http://codereview.appspot.com/5503086 commit - 131ab3addbc9eaf629803992e058bea1ddf931cc commit + 5ec2425b17766f20600e224b05988dcc7580ea18 blob - 5ab6104ed34ea8b21f6f8b85945754062fd92a07 blob + 4d66405917af5c2fc85eed080bdf4b3366bae001 --- src/cmd/devdraw/cocoa-screen.m +++ src/cmd/devdraw/cocoa-screen.m @@ -570,8 +570,25 @@ static int keycvt[] = [QZ_KP8] '8', [QZ_KP9] '9', }; + +@interface apptext : NSTextView @end +@implementation apptext +- (void)doCommandBySelector:(SEL)s{} /* Esc key beeps otherwise */ +- (void)insertText:(id)arg{} /* to avoid a latency after some time */ +@end + static void +interpretdeadkey(NSEvent *e) +{ + static apptext *t; + + if(t == nil) + t = [apptext new]; + [t interpretKeyEvents:[NSArray arrayWithObject:e]]; +} + +static void getkeyboard(NSEvent *e) { NSString *s; @@ -587,6 +604,8 @@ getkeyboard(NSEvent *e) s = [e characters]; c = [s UTF8String][0]; + + interpretdeadkey(e); if(m & NSCommandKeyMask){ if(' '<=c && c<='~')