Center the composition text in the text input area
This commit is contained in:
@@ -656,11 +656,17 @@ static void IME_SetTextInputArea(SDL_VideoData *videodata, const SDL_Rect *rect,
|
|||||||
if (himc) {
|
if (himc) {
|
||||||
COMPOSITIONFORM cof;
|
COMPOSITIONFORM cof;
|
||||||
CANDIDATEFORM caf;
|
CANDIDATEFORM caf;
|
||||||
|
int font_height = rect->h;
|
||||||
|
|
||||||
|
LOGFONTW font;
|
||||||
|
if (ImmGetCompositionFontW(himc, &font)) {
|
||||||
|
font_height = font.lfHeight;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_zero(cof);
|
SDL_zero(cof);
|
||||||
cof.dwStyle = CFS_RECT;
|
cof.dwStyle = CFS_RECT;
|
||||||
cof.ptCurrentPos.x = rect->x + cursor;
|
cof.ptCurrentPos.x = rect->x + cursor;
|
||||||
cof.ptCurrentPos.y = rect->y;
|
cof.ptCurrentPos.y = rect->y + (rect->h - font_height) / 2;
|
||||||
cof.rcArea.left = rect->x;
|
cof.rcArea.left = rect->x;
|
||||||
cof.rcArea.right = (LONG)rect->x + rect->w;
|
cof.rcArea.right = (LONG)rect->x + rect->w;
|
||||||
cof.rcArea.top = rect->y;
|
cof.rcArea.top = rect->y;
|
||||||
@@ -1055,6 +1061,9 @@ SDL_bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam
|
|||||||
case IMN_SETCOMPOSITIONWINDOW:
|
case IMN_SETCOMPOSITIONWINDOW:
|
||||||
SDL_DebugIMELog("IMN_SETCOMPOSITIONWINDOW\n");
|
SDL_DebugIMELog("IMN_SETCOMPOSITIONWINDOW\n");
|
||||||
break;
|
break;
|
||||||
|
case IMN_SETCOMPOSITIONFONT:
|
||||||
|
SDL_DebugIMELog("IMN_SETCOMPOSITIONFONT\n");
|
||||||
|
break;
|
||||||
case IMN_SETCANDIDATEPOS:
|
case IMN_SETCANDIDATEPOS:
|
||||||
SDL_DebugIMELog("IMN_SETCANDIDATEPOS\n");
|
SDL_DebugIMELog("IMN_SETCANDIDATEPOS\n");
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user