RFR: 8264728: When use chinese IME, the candidate box isn't moved with caret of JTextArea [v2]
柳鲲鹏
duke at openjdk.org
Sat Aug 19 00:36:43 UTC 2023
On Wed, 28 Jun 2023 22:05:50 GMT, Nikita Provotorov <duke at openjdk.org> wrote:
> Have you tried to use just _java.awt.Component#getLocationOnScreen_?
On linux, IME need the offset position of JTextArea from focus window(frame/dialog). So we use a loop to get it.
> src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c line 870:
>
>> 868: and block the candidate window to move with caret.
>> 869: */
>> 870: XIMStyle on_the_spot_styles = XIMPreeditNothing,
>
> `XNSpotLocation` can't be used together with `XIMPreeditNothing`. Look at the [specification](https://www.x.org/releases/X11R7.6/doc/libX11/specs/libX11/libX11.html#Input_Methods) of `XNSpotLocation`:
>> When specified to any input method other than XIMPreeditPosition, this XIC value is ignored.
>
> So even if this works with some IM on some distribution, there is no guarantee that it works more or less everywhere.
1, I tested some linux, only ubuntu has problem. Is there a macro to tell us the system is ubuntu?
2, When using XIMPreeditPosition, the XCreateIC() return NULL.
So suggest that we fix the problem first, and a comment with reason.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13055#discussion_r1298963346
PR Review Comment: https://git.openjdk.org/jdk/pull/13055#discussion_r1298963422
More information about the client-libs-dev
mailing list