MFC: don't send composition string on close_ime

This commit is contained in:
Yonghwan Lee 2004-04-27 00:56:16 +00:00
parent c5d3a6f7d8
commit d7871b69f2

View File

@ -94,6 +94,11 @@ WinGraphicsWindow::
////////////////////////////////////////////////////////////////////
bool WinGraphicsWindow::
move_pointer(int device, int x, int y) {
// First, indicate that the IME is no longer active, so that it won't
// send the string through WM_IME_COMPOSITION. But we still leave
// _ime_open true, so that it also won't send the string through WM_CHAR.
_ime_active = false;
// Note: this is not thread-safe; it should be called only from App.
// Probably not an issue.
nassertr(device == 0, false);
@ -101,6 +106,7 @@ move_pointer(int device, int x, int y) {
!_input_devices[0].get_pointer().get_in_window()) {
// If the window doesn't have input focus, or the mouse isn't
// currently within the window, forget it.
return false;
}
@ -132,7 +138,7 @@ close_ime() {
ImmReleaseContext(_hWnd, hIMC);
}
_ime_open = false;
_ime_active = false;
windisplay_cat.debug() << "success: closed ime window\n";
return;
}
@ -1120,6 +1126,13 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
case WM_IME_COMPOSITION:
if (lparam & GCS_RESULTSTR) {
// If the ime window is not marked as active at this point, we
// must be in the process of closing it down (in close_ime), and
// we don't want to send the current composition string in that
// case. But we do need to return 0 to tell windows not to try
// to send the composition string through WM_CHAR messages.
if (_ime_active) {
HIMC hIMC = ImmGetContext(hwnd);
nassertr(hIMC != 0, 0);
@ -1177,6 +1190,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
}
ImmReleaseContext(hwnd, hIMC);
}
return 0;
}
//else if (0) {