From 2b356adbc5d29edf1bf3910f7c59663475abfabc Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Tue, 4 Apr 2023 19:09:21 +0900 Subject: [PATCH] [COMCTL32][USER32] EDIT: WM_SETFONT for IME (#5214) - Call ImmSetCompositionFontW in WM_SETFONT handling of EDIT controls if necessary. - If the specified font is NULL, then use DEFAULT_GUI_FONT. CORE-11700 --- dll/win32/comctl32/edit.c | 12 ++++++++++++ win32ss/user/user32/controls/edit.c | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/dll/win32/comctl32/edit.c b/dll/win32/comctl32/edit.c index 2ac526e2473..2e7322077fa 100644 --- a/dll/win32/comctl32/edit.c +++ b/dll/win32/comctl32/edit.c @@ -3766,6 +3766,18 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw) es->flags & EF_AFTER_WRAP); ShowCaret(es->hwndSelf); } +#ifdef __REACTOS__ + if (ImmIsIME(GetKeyboardLayout(0))) + { + LOGFONTW lf; + HIMC hIMC = ImmGetContext(es->hwndSelf); + if (font == NULL) + font = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + GetObjectW(font, sizeof(lf), &lf); + ImmSetCompositionFontW(hIMC, &lf); + ImmReleaseContext(es->hwndSelf, hIMC); + } +#endif } diff --git a/win32ss/user/user32/controls/edit.c b/win32ss/user/user32/controls/edit.c index 89ab481f7da..c9e4faaed53 100644 --- a/win32ss/user/user32/controls/edit.c +++ b/win32ss/user/user32/controls/edit.c @@ -53,6 +53,8 @@ #define ImmLockIMC IMM_FN(ImmLockIMC) #define ImmUnlockIMC IMM_FN(ImmUnlockIMC) #define ImmNotifyIME IMM_FN(ImmNotifyIME) +#define ImmIsIME IMM_FN(ImmIsIME) +#define ImmSetCompositionFontW IMM_FN(ImmSetCompositionFontW) #endif WINE_DEFAULT_DEBUG_CHANNEL(edit); @@ -3972,6 +3974,18 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw) es->flags & EF_AFTER_WRAP); ShowCaret(es->hwndSelf); } +#ifdef __REACTOS__ + if (ImmIsIME(GetKeyboardLayout(0))) + { + LOGFONTW lf; + HIMC hIMC = ImmGetContext(es->hwndSelf); + if (font == NULL) + font = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + GetObjectW(font, sizeof(lf), &lf); + ImmSetCompositionFontW(hIMC, &lf); + ImmReleaseContext(es->hwndSelf, hIMC); + } +#endif }