summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-05 20:37:33 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-05 20:37:33 +0000
commite4d48f3a3b67026825f54e2c8df18550f7220acf (patch)
tree8f48dc666b9b310582c73058cea077f19f815be7 /src/video
parentde097dd989a0675c74253aa0b7f1e27f21233cb7 (diff)
downloadopenttd-e4d48f3a3b67026825f54e2c8df18550f7220acf.tar.xz
(svn r25686) -Codechange: [OSX] Abandon IME input if the edit box lost the focus.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/cocoa/cocoa_v.h5
-rw-r--r--src/video/cocoa/cocoa_v.mm14
2 files changed, 19 insertions, 0 deletions
diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h
index 06bbbfdb2..e350f0a06 100644
--- a/src/video/cocoa/cocoa_v.h
+++ b/src/video/cocoa/cocoa_v.h
@@ -50,6 +50,11 @@ public:
*/
/* 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
index 8e7b7824e..11ba8ab84 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -495,6 +495,20 @@ bool VideoDriver_Cocoa::AfterBlitterChange()
}
/**
+ * 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.