aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Jeannot <djeannot24@gmail.com>2012-01-16 17:02:06 -0500
committerRuss Cox <rsc@swtch.com>2012-01-16 17:02:06 -0500
commit5ec2425b17766f20600e224b05988dcc7580ea18 (patch)
tree59af2e86ce4affff0a4f639dc27bb88784f24a97
parent131ab3addbc9eaf629803992e058bea1ddf931cc (diff)
downloadplan9port-5ec2425b17766f20600e224b05988dcc7580ea18.tar.gz
plan9port-5ec2425b17766f20600e224b05988dcc7580ea18.tar.bz2
plan9port-5ec2425b17766f20600e224b05988dcc7580ea18.zip
devdraw: OS X dead key support
R=rsc CC=plan9port.codebot http://codereview.appspot.com/5503086
-rw-r--r--src/cmd/devdraw/cocoa-screen.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m
index 5ab6104e..4d664059 100644
--- a/src/cmd/devdraw/cocoa-screen.m
+++ b/src/cmd/devdraw/cocoa-screen.m
@@ -571,6 +571,23 @@ static int keycvt[] =
[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)
{
@@ -588,6 +605,8 @@ getkeyboard(NSEvent *e)
s = [e characters];
c = [s UTF8String][0];
+ interpretdeadkey(e);
+
if(m & NSCommandKeyMask){
if(' '<=c && c<='~')
keystroke(Kcmd+c);