summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-05 20:37:11 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-05 20:37:11 +0000
commit21126aec623c4d5a9afea786f2d57d8897a407bc (patch)
tree4d20c92d2f5630191d843909fc922b59145a1f03 /src/video
parent7422120014b51f0057bb41b3e9b6405957a01b63 (diff)
downloadopenttd-21126aec623c4d5a9afea786f2d57d8897a407bc.tar.xz
(svn r25680) -Codechange: [Win32] Cancel the current IME composition when the input focus changes.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/win32_v.cpp20
-rw-r--r--src/video/win32_v.h2
2 files changed, 21 insertions, 1 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index c497feb7e..a0da4b06f 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -524,7 +524,20 @@ static LRESULT HandleIMEComposition(HWND hwnd, WPARAM wParam, LPARAM lParam)
return lParam != 0 ? DefWindowProc(hwnd, WM_IME_COMPOSITION, wParam, lParam) : 0;
}
-#endif
+
+/** Clear the current composition string. */
+static void CancelIMEComposition(HWND hwnd)
+{
+ HIMC hIMC = ImmGetContext(hwnd);
+ if (hIMC != NULL) ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
+ ImmReleaseContext(hwnd, hIMC);
+}
+
+#else
+
+static void CancelIMEComposition(HWND hwnd) {}
+
+#endif /* !defined(WINCE) || _WIN32_WCE >= 0x400 */
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -1203,3 +1216,8 @@ bool VideoDriver_Win32::AfterBlitterChange()
{
return AllocateDibSection(_screen.width, _screen.height, true) && this->MakeWindow(_fullscreen);
}
+
+void VideoDriver_Win32::EditBoxLostFocus()
+{
+ CancelIMEComposition(_wnd.main_wnd);
+}
diff --git a/src/video/win32_v.h b/src/video/win32_v.h
index 0706c0ee7..6be60c230 100644
--- a/src/video/win32_v.h
+++ b/src/video/win32_v.h
@@ -33,6 +33,8 @@ public:
/* virtual */ bool ClaimMousePointer();
+ /* virtual */ void EditBoxLostFocus();
+
/* virtual */ const char *GetName() const { return "win32"; }
bool MakeWindow(bool full_screen);