From 4915f47264f87e39690bb138fc87138eb66708f0 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 15 Sep 2010 21:19:41 +0000 Subject: (svn r20808) -Add [FS#4110]: [OSX] support for input using dead keys (Zydeco) --- src/video/cocoa/event.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/video/cocoa') diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm index 08bf875fa..d3e2131a0 100644 --- a/src/video/cocoa/event.mm +++ b/src/video/cocoa/event.mm @@ -412,6 +412,7 @@ static bool QZ_PollEvent() NSString *chars; NSPoint pt; + NSText *fieldEditor; switch ([ event type ]) { case NSMouseMoved: case NSOtherMouseDragged: @@ -550,8 +551,19 @@ static bool QZ_PollEvent() break; } + fieldEditor = [[ event window ] fieldEditor:YES forObject:nil ]; + [ fieldEditor setString:@"" ]; + [ fieldEditor interpretKeyEvents: [ NSArray arrayWithObject:event ] ]; + chars = [ event characters ]; - QZ_KeyEvent([ event keyCode ], [ chars length ] ? [ chars characterAtIndex:0 ] : 0, YES); + if ([ chars length ] == 0) { + QZ_KeyEvent([ event keyCode ], 0, YES); + } else { + QZ_KeyEvent([ event keyCode ], [ chars characterAtIndex:0 ], YES); + for (int i = 1; i < [ chars length ]; i++) { + QZ_KeyEvent(0, [ chars characterAtIndex:i ], YES); + } + } break; case NSKeyUp: -- cgit v1.2.3-70-g09d2