# HG changeset patch # User Michael Lutz <michi@icosahedron.de> # Date 1374624982 -7200 # Node ID 78fe2d6e7dbadd2544920efe5da45ec32656c0e9 # Parent c1cb521445a4fe816761aea0ca2f2b770f478fca -Codechange: [OSX] Abandon IME input if the edit box lost the focus. diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h --- 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 */ diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm --- 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.