[PATCH v3 0/1] MR9097: imm32: Do not overwrite input context window with GetFocus() in ime_ui_update_window.
Overwriting ctx->hWnd with the current focus window breaks the relationship between the HIMC handle and its associated window. This direct assignment does not update the corresponding state in the wine server, leading to inconsistencies between client and server. Signed-off-by: chenzhengyong <chenzhengyong(a)uniontech.com> -- v3: imm32: Do not overwrite input context window with GetFocus() in ime_ui_update_window. https://gitlab.winehq.org/wine/wine/-/merge_requests/9097
From: chenzhengyong <chenzhengyong(a)uniontech.com> Overwriting ctx->hWnd with the current focus window breaks the relationship between the HIMC handle and its associated window. This direct assignment does not update the corresponding state in the wine server, leading to inconsistencies between client and server. Signed-off-by: chenzhengyong <chenzhengyong(a)uniontech.com> --- dlls/imm32/ime.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/imm32/ime.c b/dlls/imm32/ime.c index 1487c847e00..74abe5bf338 100644 --- a/dlls/imm32/ime.c +++ b/dlls/imm32/ime.c @@ -328,7 +328,12 @@ static void ime_ui_update_window( INPUTCONTEXT *ctx, HWND hwnd ) } free( str ); - ctx->hWnd = GetFocus(); + /* Only update ctx->hWnd when called from the same UI thread. */ + DWORD ui_thread = GetWindowThreadProcessId(ctx->hWnd, NULL); + DWORD current_thread = GetCurrentThreadId(); + + if (ui_thread == current_thread) + ctx->hWnd = GetFocus(); } static void ime_ui_composition( HIMC himc, HWND hwnd, LPARAM lparam ) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9097
This merge request was closed by zhengyong chen. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9097
participants (2)
-
chenzhengyong -
zhengyong chen (@chenzhengyong)