From ccc12a3632fe2c7e71a06a85ba73a98eedbeeb92 Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Mon, 15 Jun 2015 20:24:51 -0700 Subject: [PATCH] Implement repositioning the OS-rendered IME with SDL_SetTextInputRect on Windows. --- src/video/windows/SDL_windowskeyboard.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index edc2b9aef635b..b6cf3b706a86d 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -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