Mercurial > hg > openttd
changeset 16112:0d32d9e0ae81 draft
(svn r20808) -Add [FS#4110]: [OSX] support for input using dead keys (Zydeco)
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 15 Sep 2010 21:19:41 +0000 |
parents | d44fd6f19a51 |
children | c62198d95e77 |
files | src/video/cocoa/event.mm |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/cocoa/event.mm +++ b/src/video/cocoa/event.mm @@ -412,6 +412,7 @@ NSString *chars; NSPoint pt; + NSText *fieldEditor; switch ([ event type ]) { case NSMouseMoved: case NSOtherMouseDragged: @@ -550,8 +551,19 @@ 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: