IME_SetResultString function overwrite composition strings. so, next composition is not display on GUI. but, still have an xim. Therefore, there was a string that seemed to have disappeared in the middle of the input.
Therefore, change it as follows. When calling IME_SetResultString, if in a Composition state, no longer generate WM_IME_ENDCOMPOSITION and call back the previous Composition to recover the overwritten Composition.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52700 Signed-off-by: Alex Kwak take-me-home@kakao.com --- v2: use updateCompStr instead IME_SetResultString. --- dlls/winex11.drv/ime.c | 21 +++++++++++++++++---- dlls/winex11.drv/x11drv.h | 3 ++- dlls/winex11.drv/xim.c | 3 ++- 3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index c1584930861..0212a127205 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -1015,7 +1015,8 @@ BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, lpRead, dwReadLen); }
-void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen) +void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen, LPCVOID compStr, + DWORD compStrLen) { HIMC imc; LPINPUTCONTEXT lpIMC; @@ -1028,7 +1029,8 @@ void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen) if (lpIMC == NULL) return;
- newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0); + newCompStr = updateCompStr(lpIMC->hCompStr, (LPCWSTR) compStr, + compStrLen / sizeof(WCHAR)); ImmDestroyIMCC(lpIMC->hCompStr); lpIMC->hCompStr = newCompStr;
@@ -1046,12 +1048,23 @@ void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen) GenerateIMEMessage(imc, WM_IME_STARTCOMPOSITION, 0, 0); }
- GenerateIMEMessage(imc, WM_IME_COMPOSITION, 0, GCS_COMPSTR); GenerateIMEMessage(imc, WM_IME_COMPOSITION, lpResult[0], GCS_RESULTSTR|GCS_RESULTCLAUSE); - GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0); + + if (compStrLen / sizeof(WCHAR) > 0) + { + GenerateIMEMessage(imc, WM_IME_COMPOSITION, ((LPCWSTR) compStr)[0], + GCS_COMPSTR); + } + else + { + GenerateIMEMessage(imc, WM_IME_COMPOSITION, 0, GCS_COMPSTR); + }
if (!inComp) + { + GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0); ImmSetOpenStatus(imc, FALSE); + }
ImmUnlockIMC(imc); } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index f389f3e0836..ca077caa45c 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -290,7 +290,8 @@ extern void IME_UpdateAssociation(HWND focus) DECLSPEC_HIDDEN; extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen) DECLSPEC_HIDDEN; -extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultlen) DECLSPEC_HIDDEN; +extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen, + LPCVOID compStr, DWORD compStrLen) DECLSPEC_HIDDEN;
extern void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 3994c2106cc..3b762d45b3c 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -115,7 +115,8 @@ void X11DRV_XIMLookupChars( const char *str, DWORD count ) if ((focus = GetFocus())) IME_UpdateAssociation(focus);
- IME_SetResultString(wcOutput, dwOutput); + IME_SetResultString(wcOutput, dwOutput, CompositionString, + dwCompStringLength); HeapFree(GetProcessHeap(), 0, wcOutput); }
On Thu, 31 Mar 2022 04:36:18 +0900, Alex Kwak wrote:
IME_SetResultString function overwrite composition strings. so, next composition is not display on GUI. but, still have an xim. Therefore, there was a string that seemed to have disappeared in the middle of the input.
Therefore, change it as follows. When calling IME_SetResultString, if in a Composition state, no longer generate WM_IME_ENDCOMPOSITION and call back the previous Composition to recover the overwritten Composition.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52700 Signed-off-by: Alex Kwak take-me-home@kakao.com
v2: use updateCompStr instead IME_SetResultString.
Oops, the following implementation doesn't match with the subject. If I were you, I'd describe what I want to resolve instead of the way.
dlls/winex11.drv/ime.c | 21 +++++++++++++++++---- dlls/winex11.drv/x11drv.h | 3 ++- dlls/winex11.drv/xim.c | 3 ++- 3 files changed, 21 insertions(+), 6 deletions(-)
[...]
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index f389f3e0836..ca077caa45c 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -290,7 +290,8 @@ extern void IME_UpdateAssociation(HWND focus) DECLSPEC_HIDDEN; extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen) DECLSPEC_HIDDEN; -extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultlen) DECLSPEC_HIDDEN; +extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen,
LPCVOID compStr, DWORD compStrLen) DECLSPEC_HIDDEN;
Though IME_SetCompositionString() uses LPCVOID and byte unit, I'd suggest you to use const WCHAR* for the third parameter and WCHAR unit for the fourth one. It will avoid the type casting and divisions in IME_SetResultString function. Moreover, it's consistent with exisiting parameters, i.e. wcOutput's type and dwOutput's unit.
Other points look good to me. Just one more effort.
Akihiro Sagawa
Hi,
Thanks for your reviewing. great helpful to me.
I submit a new patch reflecting feedback.
https://www.winehq.org/pipermail/wine-devel/2022-April/212602.html
Regards.,
Alex
22. 4. 2. 22:57에 Akihiro Sagawa 이(가) 쓴 글:
On Thu, 31 Mar 2022 04:36:18 +0900, Alex Kwak wrote:
IME_SetResultString function overwrite composition strings. so, next composition is not display on GUI. but, still have an xim. Therefore, there was a string that seemed to have disappeared in the middle of the input.
Therefore, change it as follows. When calling IME_SetResultString, if in a Composition state, no longer generate WM_IME_ENDCOMPOSITION and call back the previous Composition to recover the overwritten Composition.
Wine-Bug:https://bugs.winehq.org/show_bug.cgi?id=52700 Signed-off-by: Alex Kwaktake-me-home@kakao.com
v2: use updateCompStr instead IME_SetResultString.
Oops, the following implementation doesn't match with the subject. If I were you, I'd describe what I want to resolve instead of the way.
dlls/winex11.drv/ime.c | 21 +++++++++++++++++---- dlls/winex11.drv/x11drv.h | 3 ++- dlls/winex11.drv/xim.c | 3 ++- 3 files changed, 21 insertions(+), 6 deletions(-)
[...]
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index f389f3e0836..ca077caa45c 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -290,7 +290,8 @@ extern void IME_UpdateAssociation(HWND focus) DECLSPEC_HIDDEN; extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen) DECLSPEC_HIDDEN; -extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultlen) DECLSPEC_HIDDEN; +extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen,
LPCVOID compStr, DWORD compStrLen) DECLSPEC_HIDDEN;
Though IME_SetCompositionString() uses LPCVOID and byte unit, I'd suggest you to use const WCHAR* for the third parameter and WCHAR unit for the fourth one. It will avoid the type casting and divisions in IME_SetResultString function. Moreover, it's consistent with exisiting parameters, i.e. wcOutput's type and dwOutput's unit.
Other points look good to me. Just one more effort.
Akihiro Sagawa
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=111793
Your paranoid android.
=== debian11 (build log) ===
error: corrupt patch at line 128 Task: Patch failed to apply
=== debian11 (build log) ===
error: corrupt patch at line 128 Task: Patch failed to apply
A new patch has been submitted and will no longer be used.
Regards,
Alex
2022-03-31 오전 4:36에 Alex Kwak 이(가) 쓴 글:
IME_SetResultString function overwrite composition strings. so, next composition is not display on GUI. but, still have an xim. Therefore, there was a string that seemed to have disappeared in the middle of the input.
Therefore, change it as follows. When calling IME_SetResultString, if in a Composition state, no longer generate WM_IME_ENDCOMPOSITION and call back the previous Composition to recover the overwritten Composition.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52700 Signed-off-by: Alex Kwak take-me-home@kakao.com
v2: use updateCompStr instead IME_SetResultString.
dlls/winex11.drv/ime.c | 21 +++++++++++++++++---- dlls/winex11.drv/x11drv.h | 3 ++- dlls/winex11.drv/xim.c | 3 ++- 3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index c1584930861..0212a127205 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -1015,7 +1015,8 @@ BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, lpRead, dwReadLen); }
-void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen) +void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen, LPCVOID compStr,
{ HIMC imc; LPINPUTCONTEXT lpIMC;DWORD compStrLen)
@@ -1028,7 +1029,8 @@ void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen) if (lpIMC == NULL) return;
- newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0);
- newCompStr = updateCompStr(lpIMC->hCompStr, (LPCWSTR) compStr,
compStrLen / sizeof(WCHAR)); ImmDestroyIMCC(lpIMC->hCompStr); lpIMC->hCompStr = newCompStr;
@@ -1046,12 +1048,23 @@ void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen) GenerateIMEMessage(imc, WM_IME_STARTCOMPOSITION, 0, 0); }
- GenerateIMEMessage(imc, WM_IME_COMPOSITION, 0, GCS_COMPSTR); GenerateIMEMessage(imc, WM_IME_COMPOSITION, lpResult[0], GCS_RESULTSTR|GCS_RESULTCLAUSE);
- GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0);
if (compStrLen / sizeof(WCHAR) > 0)
{
GenerateIMEMessage(imc, WM_IME_COMPOSITION, ((LPCWSTR) compStr)[0],
GCS_COMPSTR);
}
else
{
GenerateIMEMessage(imc, WM_IME_COMPOSITION, 0, GCS_COMPSTR);
}
if (!inComp)
{
GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0); ImmSetOpenStatus(imc, FALSE);
}
ImmUnlockIMC(imc); }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index f389f3e0836..ca077caa45c 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -290,7 +290,8 @@ extern void IME_UpdateAssociation(HWND focus) DECLSPEC_HIDDEN; extern BOOL IME_SetCompositionString(DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen) DECLSPEC_HIDDEN; -extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultlen) DECLSPEC_HIDDEN; +extern void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen,
LPCVOID compStr, DWORD compStrLen) DECLSPEC_HIDDEN;
extern void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 3994c2106cc..3b762d45b3c 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -115,7 +115,8 @@ void X11DRV_XIMLookupChars( const char *str, DWORD count ) if ((focus = GetFocus())) IME_UpdateAssociation(focus);
- IME_SetResultString(wcOutput, dwOutput);
- IME_SetResultString(wcOutput, dwOutput, CompositionString,
}dwCompStringLength); HeapFree(GetProcessHeap(), 0, wcOutput);