Changeset - r20642:9fa74f045d3c
[Not reviewed]
master
0 2 0
michi_cc - 11 years ago 2013-08-05 20:37:11
michi_cc@openttd.org
(svn r25680) -Codechange: [Win32] Cancel the current IME composition when the input focus changes.
2 files changed with 21 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/video/win32_v.cpp
Show inline comments
 
@@ -524,7 +524,20 @@ static LRESULT HandleIMEComposition(HWND
 

	
 
	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::AfterBlitterChan
 
{
 
	return AllocateDibSection(_screen.width, _screen.height, true) && this->MakeWindow(_fullscreen);
 
}
 

	
 
void VideoDriver_Win32::EditBoxLostFocus()
 
{
 
	CancelIMEComposition(_wnd.main_wnd);
 
}
src/video/win32_v.h
Show inline comments
 
@@ -33,6 +33,8 @@ public:
 

	
 
	/* virtual */ bool ClaimMousePointer();
 

	
 
	/* virtual */ void EditBoxLostFocus();
 

	
 
	/* virtual */ const char *GetName() const { return "win32"; }
 

	
 
	bool MakeWindow(bool full_screen);
0 comments (0 inline, 0 general)