Skip to content

Commit

Permalink
Implement repositioning the OS-rendered IME with SDL_SetTextInputRect…
Browse files Browse the repository at this point in the history
… on Windows.
  • Loading branch information
shakesoda committed Jun 16, 2015
1 parent 0c3830a commit ccc12a3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/video/windows/SDL_windowskeyboard.c
Expand Up @@ -187,13 +187,25 @@ void
WIN_SetTextInputRect(_THIS, SDL_Rect *rect)
{
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
HIMC himc = 0;

if (!rect) {
SDL_InvalidParamError("rect");
return;
}

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
Expand Down

0 comments on commit ccc12a3

Please sign in to comment.