-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
When using IME, it will be offset by some pixels down from the expected position. Rewriting the function WIN_SetTextInputRect can solve this problem
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 cof;
CANDIDATEFORM caf;
cof.dwStyle = CFS_EXCLUDE;
cof.rcArea.left = rect->x;
cof.rcArea.right = rect->x+rect->w;
cof.rcArea.top = rect->y;
cof.rcArea.bottom = rect->y + rect->h;
cof.ptCurrentPos.x = videodata->ime_rect.x+rect->w;
cof.ptCurrentPos.y = videodata->ime_rect.y+rect->h;
ImmSetCompositionWindow(himc, &cof);
caf.dwIndex = 0;
caf.dwStyle = CFS_EXCLUDE;
caf.ptCurrentPos.x = videodata->ime_rect.x+rect->w;
caf.ptCurrentPos.y = videodata->ime_rect.y + rect->h;
caf.rcArea.left = rect->x;
caf.rcArea.right = rect->x + rect->w;
caf.rcArea.top = rect->y;
caf.rcArea.bottom = rect->y + rect->h;
ImmSetCandidateWindow(himc, &caf);
ImmReleaseContext(videodata->ime_hwnd_current,himc);
}
}
Metadata
Metadata
Assignees
Labels
No labels