RFR: 8305418: [Linux] Replace obsolete XIM as Input Method Editor

Martin Fox duke at openjdk.org
Sun Sep 3 22:08:13 UTC 2023


On Sun, 2 Apr 2023 20:38:25 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:

> This replaces obsolete XIM and uses gtk api for IME.
> Gtk uses [ibus](https://github.com/ibus/ibus)
> 
> Gtk3+ uses relative positioning (as Wayland does), so I've added a Relative positioning on `InputMethodRequest`.

I see that this PR changes the behavior of dead keys. You may be aware of this but I thought I would write this up for others to review.

In the past when the user pressed a dead key they got no feedback until they pressed the next key at which point the final character would appear. With this PR when the user presses a dead key they get a preview of the diacritic which looks the same as previewing text from an IME.

This is a change from the old JavaFX behavior but not necessarily a bug. In fact it matches the new behavior of Ubuntu. I'm not sure when they made the switch but in Ubuntu 18 there was no diacritic preview and in Ubuntu 22 there is. It also matches the way the Mac works.

At the API level this changes the event stream. In the past the dead key only generated an incorrectly encoded RELEASED KeyEvent. The fully composed character was then delivered as the commit string in an InputMethodEvent. With this PR the (sort of bogus) RELEASED KeyEvent goes away and is replaced by an InputMethodEvent that delivers the preview diacritic in the compose string.

One minor detail: after entering a dead key the cursor moves to a point before the preview diacritic instead of after it. That looks like a bug and doesn't match the way other parts of Ubuntu behave.

modules/javafx.graphics/src/main/native-glass/gtk/glass_key.cpp line 58:

> 56: 
> 57: // This function exists because gdk_keyval_to_unicode won't translate dead keys
> 58: guint32 glass_gdk_keyval_to_unicode(guint keyval) {

I don't think this routine is needed. You only need Unicode text for a TYPED KeyEvent and dead keys don't generate those. `notifyKey` will just ignore any text you pass in for PRESSED or RELEASED events.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1080#issuecomment-1522286678
PR Review Comment: https://git.openjdk.org/jfx/pull/1080#discussion_r1193908201


More information about the openjfx-dev mailing list