RFR: 8090267: JFXPanel Input Problem

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Jul 4 06:01:15 UTC 2023


When Japanse (IME on) is inputted to the TextFIeld, which is on JFXPanel, 
small window for inputting appears on top-left side of screen

![image](https://github.com/openjdk/jfx/assets/43534309/65833d59-528e-4087-9992-9f86b8b8c47f)

For swing-interop case, WmImeStartComposition starts composition in native ImmSetCompositionWindow window as "m_useNativeCompWindow" below is true for FX
https://github.com/openjdk/jdk/blob/514816ed7d7dea1fb13d32b80aef89774bee13d3/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp#L3957

m_useNativeCompWindow is true because during sun.awt.im.InputContext#focusGained() calls activateInputMethod which calls WInputMethod.activate() which calls haveActiveClient() which checks for
clientComponent.getInputMethodRequests().
Now, in JFXPanel, getInputMethodRequests() returns null as setEmbeddedScene() is not called yet.
Since getInputMethodRequests() returns null, haveActiveClient() is false which calls enableNativeIME() with 1 [thereby native composition window is enabled]
https://github.com/openjdk/jdk/blob/514816ed7d7dea1fb13d32b80aef89774bee13d3/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java#L316

Proposed fix is to ensure there is an active client "initially" so that enableNativeIME() is called with 0 and no native compostion window is shown.
getInputMethodRequests() is called in setEmbeddedScene() so as to make sure getInputMethodRequest() is initialised to correct "InputMethodSupport.InputMethodRequestsAdapter.fxRequests" object and not NULL.

AFter fix
![image](https://github.com/openjdk/jfx/assets/43534309/ec3d8343-9295-4950-885b-f9983b9b017a)

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

Commit messages:
 - 8090267: JFXPanel Input Problem

Changes: https://git.openjdk.org/jfx/pull/1169/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1169&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8090267
  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jfx/pull/1169.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1169/head:pull/1169

PR: https://git.openjdk.org/jfx/pull/1169


More information about the openjfx-dev mailing list