diff --git a/patches/imm32-message_on_focus/0001-imm32-Only-generate-WM_IME_SETCONTEXT-message-if-win.patch b/patches/imm32-message_on_focus/0001-imm32-Only-generate-WM_IME_SETCONTEXT-message-if-win.patch new file mode 100644 index 00000000..6bfecc4c --- /dev/null +++ b/patches/imm32-message_on_focus/0001-imm32-Only-generate-WM_IME_SETCONTEXT-message-if-win.patch @@ -0,0 +1,34 @@ +From 117673ffe8bd5a8aae060307bcf6af83b4da011e Mon Sep 17 00:00:00 2001 +From: Gijs Vermeulen +Date: Mon, 17 Dec 2018 11:49:26 +1100 +Subject: [PATCH] imm32: Only generate 'WM_IME_SETCONTEXT' message if window + has focus + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31157 +--- + dlls/imm32/imm.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c +index 28eb00f..4255e98 100644 +--- a/dlls/imm32/imm.c ++++ b/dlls/imm32/imm.c +@@ -608,9 +608,12 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC) + if (!hIMC) + return old; + +- SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, FALSE, ISC_SHOWUIALL); +- data->IMC.hWnd = hWnd; +- SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, TRUE, ISC_SHOWUIALL); ++ if(GetActiveWindow() == data->IMC.hWnd) ++ { ++ SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, FALSE, ISC_SHOWUIALL); ++ data->IMC.hWnd = hWnd; ++ SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, TRUE, ISC_SHOWUIALL); ++ } + + return old; + } +-- +1.9.1 + diff --git a/patches/imm32-message_on_focus/definition b/patches/imm32-message_on_focus/definition new file mode 100644 index 00000000..c72706ed --- /dev/null +++ b/patches/imm32-message_on_focus/definition @@ -0,0 +1,5 @@ +# I suspect that bug #28861,#46263 are related to this issue as well. +# Both of these hint that the szwWineIMCProperty doesn't the correct value +# and thus goes down invalid path leading to a crash. +# +Fixes: [31157] imm32: Only generate 'WM_IME_SETCONTEXT' message if window has focus. diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index fd84d79a..8444d1be 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -152,6 +152,7 @@ patch_enable_all () enable_imagehlp_BindImageEx="$1" enable_imagehlp_Cleanup="$1" enable_imagehlp_ImageLoad="$1" + enable_imm32_message_on_focus="$1" enable_include_winsock="$1" enable_inseng_Implementation="$1" enable_iphlpapi_System_Ping="$1" @@ -614,6 +615,9 @@ patch_enable () imagehlp-ImageLoad) enable_imagehlp_ImageLoad="$2" ;; + imm32-message_on_focus) + enable_imm32_message_on_focus="$2" + ;; include-winsock) enable_include_winsock="$2" ;; @@ -3683,6 +3687,21 @@ if test "$enable_imagehlp_ImageLoad" -eq 1; then ) >> "$patchlist" fi +# Patchset imm32-message_on_focus +# | +# | This patchset fixes the following Wine bugs: +# | * [#31157] imm32: Only generate 'WM_IME_SETCONTEXT' message if window has focus. +# | +# | Modified files: +# | * dlls/imm32/imm.c +# | +if test "$enable_imm32_message_on_focus" -eq 1; then + patch_apply imm32-message_on_focus/0001-imm32-Only-generate-WM_IME_SETCONTEXT-message-if-win.patch + ( + printf '%s\n' '+ { "Gijs Vermeulen", "imm32: Only generate '\''WM_IME_SETCONTEXT'\'' message if window has focus.", 1 },'; + ) >> "$patchlist" +fi + # Patchset include-winsock # | # | Modified files: