首页 > 代码库 > libsdl中文输入法候选列表不显示解决方案
libsdl中文输入法候选列表不显示解决方案
libsdl输入中文时输入法不显示,将WM_IME_SETCONTEXT事件处理给注释即可。
WM_IME_SETCONTEXT
If the application draws the composition window, the default IME window does not have to show its composition window. In this case, the application must clear the ISC_SHOWUICOMPOSITIONWINDOW value from the lParam parameter before passing the message to DefWindowProc or ImmIsUIMessage. To display a certain user interface window, an application should remove the corresponding value so that the IME will not display it.
修改SDL_windowskeyboard.c找到IME_HandleMessage函数改为以下代码即可。
SDL_boolIME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata){ SDL_bool trap = SDL_FALSE; HIMC himc = 0; if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) return SDL_FALSE; switch (msg) { case WM_INPUTLANGCHANGE: IME_InputLangChanged(videodata); break; //输入法候选框不显示 //case WM_IME_SETCONTEXT: // *lParam = 0; // break; case WM_IME_STARTCOMPOSITION: trap = SDL_TRUE; break; case WM_IME_COMPOSITION: trap = SDL_TRUE; himc = ImmGetContext(hwnd); if (*lParam & GCS_RESULTSTR) { IME_GetCompositionString(videodata, himc, GCS_RESULTSTR); IME_SendInputEvent(videodata); } if (*lParam & GCS_COMPSTR) { if (!videodata->ime_uiless) videodata->ime_readingstring[0] = 0; IME_GetCompositionString(videodata, himc, GCS_COMPSTR); IME_SendEditingEvent(videodata); } ImmReleaseContext(hwnd, himc); break; case WM_IME_ENDCOMPOSITION: videodata->ime_composition[0] = 0; videodata->ime_readingstring[0] = 0; videodata->ime_cursor = 0; SDL_SendEditingText("", 0, 0); break; case WM_IME_NOTIFY: switch (wParam) { case IMN_SETCONVERSIONMODE: case IMN_SETOPENSTATUS: IME_UpdateInputLocale(videodata); break; case IMN_OPENCANDIDATE: case IMN_CHANGECANDIDATE: if (videodata->ime_uiless) break; trap = SDL_TRUE; IME_ShowCandidateList(videodata); himc = ImmGetContext(hwnd); if (!himc) break; IME_GetCandidateList(himc, videodata); ImmReleaseContext(hwnd, himc); break; case IMN_CLOSECANDIDATE: trap = SDL_TRUE; IME_HideCandidateList(videodata); break; case IMN_PRIVATE: { DWORD dwId = IME_GetId(videodata, 0); IME_GetReadingString(videodata, hwnd); switch (dwId) { case IMEID_CHT_VER42: case IMEID_CHT_VER43: case IMEID_CHT_VER44: case IMEID_CHS_VER41: case IMEID_CHS_VER42: if (*lParam == 1 || *lParam == 2) trap = SDL_TRUE; break; case IMEID_CHT_VER50: case IMEID_CHT_VER51: case IMEID_CHT_VER52: case IMEID_CHT_VER60: case IMEID_CHS_VER53: if (*lParam == 16 || *lParam == 17 || *lParam == 26 || *lParam == 27 || *lParam == 28) trap = SDL_TRUE; break; } } break; default: trap = SDL_TRUE; break; } break; } return trap;}
libsdl中文输入法候选列表不显示解决方案
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。