Implement repositioning the OS-rendered IME with SDL_SetTextInputRect on Windows.

This commit is contained in:
Colby Klein 2015-06-15 20:24:51 -07:00
parent 0c3830a9a9
commit ccc12a3632
1 changed files with 12 additions and 0 deletions

View File

@ -187,6 +187,7 @@ void
WIN_SetTextInputRect(_THIS, SDL_Rect *rect)
{
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
HIMC himc = 0;
if (!rect) {
SDL_InvalidParamError("rect");
@ -194,6 +195,17 @@ WIN_SetTextInputRect(_THIS, SDL_Rect *rect)
}
videodata->ime_rect = *rect;
himc = ImmGetContext(videodata->ime_hwnd_current);
if (himc)
{
COMPOSITIONFORM cf;
cf.ptCurrentPos.x = videodata->ime_rect.x;
cf.ptCurrentPos.y = videodata->ime_rect.y;
cf.dwStyle = CFS_FORCE_POSITION;
ImmSetCompositionWindow(himc, &cf);
ImmReleaseContext(videodata->ime_hwnd_current, himc);
}
}
#ifdef SDL_DISABLE_WINDOWS_IME