On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

> 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)

I would love to review this, but for some reason, I could not get Japanese IME 
to work on my windows 11...

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

PR Comment: https://git.openjdk.org/jfx/pull/1169#issuecomment-1654006525

Reply via email to