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) issue 2: configure Japanese IME for Hiragana input, such that the following icons are shown in the task bar: ![Screenshot 2023-08-17 125430](https://github.com/openjdk/jfx/assets/107069028/3c0971f9-8fe5-4b86-8332-8330ca25c966) then launch the test app and type 'a'. I see two hiragana ああ characters instead of one あ: ![Screenshot 2023-08-17 125206](https://github.com/openjdk/jfx/assets/107069028/52553335-686d-4efa-8833-8b722aa94846) issue 3: further typing and editing (using BACKSPACE key) results in a series of exceptions: Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 3 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302) at java.base/java.util.Objects.checkIndex(Objects.java:385) at java.base/java.util.ArrayList.get(ArrayList.java:427) at javafx.base/com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:88) at javafx.base/com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:314) at javafx.graphics/javafx.scene.Parent.updateCachedBounds(Parent.java:1705) at javafx.graphics/javafx.scene.Parent.recomputeBounds(Parent.java:1649) at javafx.graphics/javafx.scene.Parent.doComputeGeomBounds(Parent.java:1502) at javafx.graphics/javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115) at javafx.graphics/com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBoundsImpl(RegionHelper.java:78) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBounds(RegionHelper.java:62) at javafx.graphics/javafx.scene.layout.Region.doComputeGeomBounds(Region.java:3301) at javafx.graphics/javafx.scene.layout.Region$1.doComputeGeomBounds(Region.java:166) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.computeGeomBoundsImpl(RegionHelper.java:89) at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117) at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3812) at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3774) at javafx.graphics/javafx.scene.Node.computeLocalBounds(Node.java:3828) at javafx.graphics/javafx.scene.Node.updateLocalBounds(Node.java:3858) at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3728) at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3876) at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3668) at javafx.graphics/javafx.scene.Node$MiscProperties$2.computeBounds(Node.java:6770) at javafx.graphics/javafx.scene.Node$LazyBoundsProperty.get(Node.java:9749) at javafx.graphics/javafx.scene.Node$LazyBoundsProperty.get(Node.java:1) at javafx.graphics/javafx.scene.Node.getBoundsInParent(Node.java:3361) at javafx.controls/javafx.scene.control.skin.TextFieldSkin.getCharacterBounds(TextFieldSkin.java:533) at javafx.controls/javafx.scene.control.skin.TextInputControlSkin$11.getTextLocation(TextInputControlSkin.java:351) at javafx.graphics/javafx.scene.Scene$InputMethodRequestsDelegate.getTextLocation(Scene.java:4169) at javafx.swing/javafx.embed.swing.InputMethodSupport$InputMethodRequestsAdapter.getTextLocation(InputMethodSupport.java:61) at java.desktop/sun.awt.im.InputMethodContext.getTextLocation(InputMethodContext.java:279) at java.desktop/sun.awt.windows.WInputMethod$1.run(WInputMethod.java:616) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:98) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 4 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302) at java.base/java.util.Objects.checkIndex(Objects.java:385) at java.base/java.util.ArrayList.get(ArrayList.java:427) at javafx.base/com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:88) at javafx.base/com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:314) at javafx.graphics/javafx.scene.Parent.updateCachedBounds(Parent.java:1705) at javafx.graphics/javafx.scene.Parent.recomputeBounds(Parent.java:1649) at javafx.graphics/javafx.scene.Parent.doComputeGeomBounds(Parent.java:1502) at javafx.graphics/javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115) at javafx.graphics/com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBoundsImpl(RegionHelper.java:78) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBounds(RegionHelper.java:62) at javafx.graphics/javafx.scene.layout.Region.doComputeGeomBounds(Region.java:3301) at javafx.graphics/javafx.scene.layout.Region$1.doComputeGeomBounds(Region.java:166) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.computeGeomBoundsImpl(RegionHelper.java:89) at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117) at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3812) at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3774) at javafx.graphics/javafx.scene.Node.computeLocalBounds(Node.java:3828) at javafx.graphics/javafx.scene.Node.updateLocalBounds(Node.java:3858) at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3728) at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3876) at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3668) at javafx.graphics/javafx.scene.Node$MiscProperties$2.computeBounds(Node.java:6770) at javafx.graphics/javafx.scene.Node$LazyBoundsProperty.get(Node.java:9749) at javafx.graphics/javafx.scene.Node$LazyBoundsProperty.get(Node.java:1) at javafx.graphics/javafx.scene.Node.getBoundsInParent(Node.java:3361) at javafx.controls/javafx.scene.control.skin.TextFieldSkin.getCharacterBounds(TextFieldSkin.java:533) at javafx.controls/javafx.scene.control.skin.TextInputControlSkin$11.getTextLocation(TextInputControlSkin.java:351) at javafx.graphics/javafx.scene.Scene$InputMethodRequestsDelegate.getTextLocation(Scene.java:4169) at javafx.swing/javafx.embed.swing.InputMethodSupport$InputMethodRequestsAdapter.getTextLocation(InputMethodSupport.java:61) at java.desktop/sun.awt.im.InputMethodContext.getTextLocation(InputMethodContext.java:279) at java.desktop/sun.awt.windows.WInputMethod$1.run(WInputMethod.java:616) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:98) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 4 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302) at java.base/java.util.Objects.checkIndex(Objects.java:385) at java.base/java.util.ArrayList.get(ArrayList.java:427) at javafx.base/com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:88) at javafx.base/com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:314) at javafx.graphics/javafx.scene.Parent.updateCachedBounds(Parent.java:1705) at javafx.graphics/javafx.scene.Parent.recomputeBounds(Parent.java:1649) at javafx.graphics/javafx.scene.Parent.doComputeGeomBounds(Parent.java:1502) at javafx.graphics/javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115) at javafx.graphics/com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBoundsImpl(RegionHelper.java:78) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBounds(RegionHelper.java:62) at javafx.graphics/javafx.scene.layout.Region.doComputeGeomBounds(Region.java:3301) at javafx.graphics/javafx.scene.layout.Region$1.doComputeGeomBounds(Region.java:166) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.computeGeomBoundsImpl(RegionHelper.java:89) at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117) at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3812) at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3774) at javafx.graphics/javafx.scene.Node.computeLocalBounds(Node.java:3828) at javafx.graphics/javafx.scene.Node.updateLocalBounds(Node.java:3858) at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3728) at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3876) at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3668) at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:776) at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1836) at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1834) at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1834) at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2615) at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$2(Toolkit.java:401) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:400) at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:430) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:592) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$11(QuantumToolkit.java:352) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$4(WinApplication.java:185) at java.base/java.lang.Thread.run(Thread.java:1623) Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 4 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302) at java.base/java.util.Objects.checkIndex(Objects.java:385) at java.base/java.util.ArrayList.get(ArrayList.java:427) at javafx.base/com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:88) at javafx.base/com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:314) at javafx.graphics/javafx.scene.Parent.updateCachedBounds(Parent.java:1705) at javafx.graphics/javafx.scene.Parent.recomputeBounds(Parent.java:1649) at javafx.graphics/javafx.scene.Parent.doComputeGeomBounds(Parent.java:1502) at javafx.graphics/javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115) at javafx.graphics/com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBoundsImpl(RegionHelper.java:78) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBounds(RegionHelper.java:62) at javafx.graphics/javafx.scene.layout.Region.doComputeGeomBounds(Region.java:3301) at javafx.graphics/javafx.scene.layout.Region$1.doComputeGeomBounds(Region.java:166) at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.computeGeomBoundsImpl(RegionHelper.java:89) at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117) at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3812) at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3774) at javafx.graphics/javafx.scene.Node.computeLocalBounds(Node.java:3828) at javafx.graphics/javafx.scene.Node.updateLocalBounds(Node.java:3858) at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3728) at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3876) at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3668) at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:776) at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1836) at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1834) at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1834) at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2615) at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$2(Toolkit.java:401) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:400) at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:430) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:592) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$11(QuantumToolkit.java:352) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$4(WinApplication.java:185) at java.base/java.lang.Thread.run(Thread.java:1623) The good new is that the IME box appears at the right spot :-) ------------- PR Comment: https://git.openjdk.org/jfx/pull/1169#issuecomment-1682892243 PR Comment: https://git.openjdk.org/jfx/pull/1169#issuecomment-1682894629 PR Comment: https://git.openjdk.org/jfx/pull/1169#issuecomment-1682895935