Mercurial > hg > openttd
changeset 20711:78fe2d6e7dba draft
-Codechange: [OSX] Abandon IME input if the edit box lost the focus.
author | Michael Lutz <michi@icosahedron.de> |
---|---|
date | Wed, 24 Jul 2013 02:16:22 +0200 |
parents | c1cb521445a4 |
children | cfe87e917bcd |
files | src/video/cocoa/cocoa_v.h src/video/cocoa/cocoa_v.mm |
diffstat | 2 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/cocoa/cocoa_v.h +++ b/src/video/cocoa/cocoa_v.h @@ -50,6 +50,11 @@ */ /* virtual */ bool AfterBlitterChange(); + /** + * An edit box lost the input focus. Abort character compositing if necessary. + */ + /* virtual */ void EditBoxLostFocus(); + /** Return driver name * @return driver name */
--- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -495,6 +495,20 @@ } /** + * An edit box lost the input focus. Abort character compositing if necessary. + */ +void VideoDriver_Cocoa::EditBoxLostFocus() +{ + if (_cocoa_subdriver != NULL) { + if ([ _cocoa_subdriver->cocoaview respondsToSelector:@selector(inputContext) ]) { + [ [ _cocoa_subdriver->cocoaview performSelector:@selector(inputContext) ] performSelector:@selector(discardMarkedText) ]; + } else { + [ [ NSInputManager currentInputManager ] markedTextAbandoned:_cocoa_subdriver->cocoaview ]; + } + } +} + +/** * Catch asserts prior to initialization of the videodriver. * * @param title Window title.