[PATCH v2] dlls: Flush CompositionString after X11DRV_XIMLookupChars.
There is no flushing after X11DRV_XIMLookupChars on wine11xdrv. for this reason, the characters of the GUI are not updated. In addition, in IME_SetResultString on wine11xdrv, the bInComposition flag is not deactivated after generating WM_IME_ENDCOMPOSITION, so that the WM_IME_STARTCOMPOSITION message is not generated in the next composition. Also, when WM_IME_COMPOSITION is processed in editor_handle_message on riched20, the existing selection is removed and the characters being entered disappear. WM_IME_STARTCOMPOSITION occurs when attempting to input after full selection, and ME_DeleteSelection is called, which causes the exact location of the cursor to be lost. Signed-off-by: Alex Kwak <take-me-home(a)kakao.com> --- v2: Fix comment style --- dlls/riched20/editor.c | 3 +-- dlls/winex11.drv/ime.c | 5 ++--- dlls/winex11.drv/xim.c | 10 ++++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index a8cf3175591..33437a6d6e3 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -4097,8 +4097,8 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, return 0; case WM_IME_STARTCOMPOSITION: { - editor->imeStartIndex=ME_GetCursorOfs(&editor->pCursors[0]); ME_DeleteSelection(editor); + editor->imeStartIndex=ME_GetCursorOfs(&editor->pCursors[0]); ME_CommitUndo(editor); ME_UpdateRepaint(editor, FALSE); return 0; @@ -4109,7 +4109,6 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, ME_Style *style = style_get_insert_style( editor, editor->pCursors ); hIMC = ITextHost_TxImmGetContext(editor->texthost); - ME_DeleteSelection(editor); ME_SaveTempStyle(editor, style); if (lParam & (GCS_RESULTSTR|GCS_COMPSTR)) { diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index c1584930861..db2ff5d85cc 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -1049,10 +1049,9 @@ void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen) 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); + myPrivate->bInComposition = FALSE; - if (!inComp) - ImmSetOpenStatus(imc, FALSE); - + ImmSetOpenStatus(imc, FALSE); ImmUnlockIMC(imc); } diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 3994c2106cc..66c56c177ac 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -117,6 +117,16 @@ void X11DRV_XIMLookupChars( const char *str, DWORD count ) IME_SetResultString(wcOutput, dwOutput); HeapFree(GetProcessHeap(), 0, wcOutput); + + /* + * After then if `CompositionString` is remaining, flushing it. + * i.e., Korean + */ + if (CompositionString) + { + IME_SetCompositionString(SCS_SETSTR, CompositionString, + dwCompStringLength, NULL, 0); + } } static BOOL XIMPreEditStateNotifyCallback(XIC xic, XPointer p, XPointer data) -- 2.32.0
On Thu, 17 Mar 2022 07:48:51 +0900, Alex Kwak wrote:
> There is no flushing after X11DRV_XIMLookupChars on wine11xdrv. for
> this reason, the characters of the GUI are not updated.
[...]
> diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c
> index 3994c2106cc..66c56c177ac 100644
> --- a/dlls/winex11.drv/xim.c
> +++ b/dlls/winex11.drv/xim.c
> @@ -117,6 +117,16 @@ void X11DRV_XIMLookupChars( const char *str, DWORD count )
>
> IME_SetResultString(wcOutput, dwOutput);
> HeapFree(GetProcessHeap(), 0, wcOutput);
> +
> + /*
> + * After then if `CompositionString` is remaining, flushing it.
> + * i.e., Korean
> + */
> + if (CompositionString)
> + {
> + IME_SetCompositionString(SCS_SETSTR, CompositionString,
> + dwCompStringLength, NULL, 0);
> + }
> }
>
> static BOOL XIMPreEditStateNotifyCallback(XIC xic, XPointer p, XPointer data)
Hello Alex,
How about filing a bug regarding this issue and attaching
WINEDEBUG=xim,imm traces?
What XIM server or Input Method does suffer from the issue?
>From my point of view:
- If the XIM server supports XIMPreeditCallbacks,
CompositionString should be updated via XIMPreEditDrawCallback.
- If the XIM server doesn't support XIMPreeditCallbacks,
CompositionString is always NULL. So, your additional code doesn't
make sense.
At least, I can't reproduce the first issue with fcitx-mozc, a Japanese
input method...
Akihiro Sagawa
Hello, Akihiro Thanks for reviewing. just now, I wrote a bug with logs. ( https://bugs.winehq.org/show_bug.cgi?id=52700 ) This is a problem that occurs in almost all Korean input method. ( except root style IME ) Best Regards, Alex 22. 3. 19. 23:27에 Akihiro Sagawa 이(가) 쓴 글:
On Thu, 17 Mar 2022 07:48:51 +0900, Alex Kwak wrote:
There is no flushing after X11DRV_XIMLookupChars on wine11xdrv. for this reason, the characters of the GUI are not updated. [...] diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 3994c2106cc..66c56c177ac 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -117,6 +117,16 @@ void X11DRV_XIMLookupChars( const char *str, DWORD count )
IME_SetResultString(wcOutput, dwOutput); HeapFree(GetProcessHeap(), 0, wcOutput); + + /* + * After then if `CompositionString` is remaining, flushing it. + * i.e., Korean + */ + if (CompositionString) + { + IME_SetCompositionString(SCS_SETSTR, CompositionString, + dwCompStringLength, NULL, 0); + } }
static BOOL XIMPreEditStateNotifyCallback(XIC xic, XPointer p, XPointer data) Hello Alex, How about filing a bug regarding this issue and attaching WINEDEBUG=xim,imm traces? What XIM server or Input Method does suffer from the issue?
From my point of view: - If the XIM server supports XIMPreeditCallbacks, CompositionString should be updated via XIMPreEditDrawCallback. - If the XIM server doesn't support XIMPreeditCallbacks, CompositionString is always NULL. So, your additional code doesn't make sense.
At least, I can't reproduce the first issue with fcitx-mozc, a Japanese input method...
Akihiro Sagawa
Hi, I'd suggest to split the patch into two, since you are changing 2 different components at once. Also maybe you could write a small test for the riched part. Bernhard Alex Kwak <take-me-home(a)kakao.com> schrieb am Sa., 19. März 2022, 18:14:
Hello, Akihiro Thanks for reviewing.
just now, I wrote a bug with logs. ( https://bugs.winehq.org/show_bug.cgi?id=52700 )
This is a problem that occurs in almost all Korean input method. ( except root style IME )
Best Regards, Alex
22. 3. 19. 23:27에 Akihiro Sagawa 이(가) 쓴 글:
On Thu, 17 Mar 2022 07:48:51 +0900, Alex Kwak wrote:
There is no flushing after X11DRV_XIMLookupChars on wine11xdrv. for this reason, the characters of the GUI are not updated. [...] diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 3994c2106cc..66c56c177ac 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -117,6 +117,16 @@ void X11DRV_XIMLookupChars( const char *str, DWORD count )
IME_SetResultString(wcOutput, dwOutput); HeapFree(GetProcessHeap(), 0, wcOutput); + + /* + * After then if `CompositionString` is remaining, flushing it. + * i.e., Korean + */ + if (CompositionString) + { + IME_SetCompositionString(SCS_SETSTR, CompositionString, + dwCompStringLength, NULL, 0); + } }
static BOOL XIMPreEditStateNotifyCallback(XIC xic, XPointer p, XPointer data) Hello Alex, How about filing a bug regarding this issue and attaching WINEDEBUG=xim,imm traces? What XIM server or Input Method does suffer from the issue?
From my point of view: - If the XIM server supports XIMPreeditCallbacks, CompositionString should be updated via XIMPreEditDrawCallback. - If the XIM server doesn't support XIMPreeditCallbacks, CompositionString is always NULL. So, your additional code doesn't make sense.
At least, I can't reproduce the first issue with fcitx-mozc, a Japanese input method...
Akihiro Sagawa
Hi Bernhard, I'd better do what you say. so, it would be good to close this thread. Best Regards, Alex 22. 3. 20. 02:32에 Bernhard Kölbl 이(가) 쓴 글:
Hi,
I'd suggest to split the patch into two, since you are changing 2 different components at once. Also maybe you could write a small test for the riched part.
Bernhard
Alex Kwak <take-me-home(a)kakao.com> schrieb am Sa., 19. März 2022, 18:14:
Hello, Akihiro Thanks for reviewing.
just now, I wrote a bug with logs. ( https://bugs.winehq.org/show_bug.cgi?id=52700 )
This is a problem that occurs in almost all Korean input method. ( except root style IME )
Best Regards, Alex
22. 3. 19. 23:27에 Akihiro Sagawa 이(가) 쓴 글: > On Thu, 17 Mar 2022 07:48:51 +0900, Alex Kwak wrote: >> There is no flushing after X11DRV_XIMLookupChars on wine11xdrv. for >> this reason, the characters of the GUI are not updated. > [...] >> diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c >> index 3994c2106cc..66c56c177ac 100644 >> --- a/dlls/winex11.drv/xim.c >> +++ b/dlls/winex11.drv/xim.c >> @@ -117,6 +117,16 @@ void X11DRV_XIMLookupChars( const char *str, DWORD count ) >> >> IME_SetResultString(wcOutput, dwOutput); >> HeapFree(GetProcessHeap(), 0, wcOutput); >> + >> + /* >> + * After then if `CompositionString` is remaining, flushing it. >> + * i.e., Korean >> + */ >> + if (CompositionString) >> + { >> + IME_SetCompositionString(SCS_SETSTR, CompositionString, >> + dwCompStringLength, NULL, 0); >> + } >> } >> >> static BOOL XIMPreEditStateNotifyCallback(XIC xic, XPointer p, XPointer data) > Hello Alex, > How about filing a bug regarding this issue and attaching > WINEDEBUG=xim,imm traces? > What XIM server or Input Method does suffer from the issue? > > From my point of view: > - If the XIM server supports XIMPreeditCallbacks, > CompositionString should be updated via XIMPreEditDrawCallback. > - If the XIM server doesn't support XIMPreeditCallbacks, > CompositionString is always NULL. So, your additional code doesn't > make sense. > > At least, I can't reproduce the first issue with fcitx-mozc, a Japanese > input method... > > Akihiro Sagawa >
participants (3)
-
Akihiro Sagawa -
Alex Kwak -
Bernhard Kölbl