summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-09-15 21:19:41 +0000
committerrubidium <rubidium@openttd.org>2010-09-15 21:19:41 +0000
commit4915f47264f87e39690bb138fc87138eb66708f0 (patch)
tree9eb34bdf4aee0522da9a241854820d91e11277b1 /src
parent532003504e18226014c3845065d16835b4467043 (diff)
downloadopenttd-4915f47264f87e39690bb138fc87138eb66708f0.tar.xz
(svn r20808) -Add [FS#4110]: [OSX] support for input using dead keys (Zydeco)
Diffstat (limited to 'src')
-rw-r--r--src/video/cocoa/event.mm14
1 files changed, 13 insertions, 1 deletions
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: