Re: RFR: 8090267: JFXPanel Input Problem

2023-12-29 Thread Martin Fox
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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)

It turns out this PR didn't introduce new problems, it just exposed existing 
ones. The AWT EventQueue thread is calling into the InputMethodRequests at the 
same time as the JavaFX thread is updating and drawing the text field. If the 
timing is right (or wrong) both threads can trigger glyph layout in the same 
Text object at the same time. The result is the sort of erratic behavior seen 
here.

I've entered [JDK-8322784](https://bugs.openjdk.org/browse/JDK-8322784).

-

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


Re: RFR: 8090267: JFXPanel Input Problem

2023-08-21 Thread Andy Goryachev
On Mon, 21 Aug 2023 20:52:51 GMT, Martin Fox  wrote:

> behavior is erratic

thank you for testing and the insights, @beldenfox !

this is exactly my experience, esp. re: exact steps to reproduce.  which makes 
me think that the issue might be in the way we call either swing or fx from the 
wrong thread perhaps?

-

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


Re: RFR: 8090267: JFXPanel Input Problem

2023-08-21 Thread Martin Fox
On Mon, 21 Aug 2023 16:19:55 GMT, Andy Goryachev  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)
>
> could we try this on another window 11 box?

I tried this on my Windows 11 setup. I can reproduce all of the problems 
@andy-goryachev-oracle was seeing but the behavior is erratic so I'm having 
difficulty coming up with a precise set of steps.

You might try this:
- set keyboard to Japanese, half-width alphanumeric
- launch the test app
- click in the TextField to establish focus (focus is not working as expected 
for me)
- type two 'a' characters
- switch to Hirigana
- type 'a'

On my system the input sequence displays doubled aaあaaあ. At this point the 
TextField is confused, if I commit and start moving the cursor around it treats 
the final あaaあ sequence as one character. Various bad behavior follows.

I can also get into a state where exceptions are being thrown but haven't 
figured out precisely how. Seems to happen most when I switch to Hiragana and 
start typing quickly...

Without Swing in the picture none of these problems occur.

-

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


Re: RFR: 8090267: JFXPanel Input Problem

2023-08-21 Thread Andy Goryachev
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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)

could we try this on another window 11 box?

-

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


Re: RFR: 8090267: JFXPanel Input Problem

2023-08-20 Thread Prasanta Sadhukhan
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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 am not able to reproduce issue1,2,3 in windows 10 testing

Issue2 in my system

![image](https://github.com/openjdk/jfx/assets/43534309/603c2a92-fcd6-4e70-a2c4-fb52d774ad37)

Also, I tried adding and backspacing/deleting typed characters without any 
issue...
Seems like this issue is specific to Windows11 and maynot be related to 
swing-interop

-

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


Re: RFR: 8090267: JFXPanel Input Problem

2023-08-17 Thread Andy Goryachev
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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)

The fix introduced a number of issues.

The bad news is that without the fix, the IME UI works correctly - the only 
issue is that it is in the wrong position (as seems to be using a different 
Look and Feel).  No exceptions, no duplicate symbols, no caret positioning 
issues.

Tested on Windows 11 Pro, 22H2 os build 22621.1992, Windows Feature Experience 
Pack 1000.22644.1000.0

-

Changes requested by angorya (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/1169#pullrequestreview-1583514420
PR Comment: https://git.openjdk.org/jfx/pull/1169#issuecomment-1682995516


Re: RFR: 8090267: JFXPanel Input Problem

2023-08-17 Thread Andy Goryachev
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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.ja

Re: RFR: 8090267: JFXPanel Input Problem

2023-08-17 Thread Andy Goryachev
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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)

This PR has been outstanding for a long time, please sync with the latest 
master.

When I merged the latest master in my own local branch, I see a number of 
issues on Windows 11 with Japanese IME:

1. type simple Romaji sequences (arigatou):


Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: 
Cannot read field "x" because "location" is null
at 
javafx.graphics/com.sun.javafx.text.PrismTextLayout.getCaretShape(PrismTextLayout.java:379)
at 
javafx.graphics/javafx.scene.text.Text$TextAttribute$11.computeValue(Text.java:1823)
at 
javafx.graphics/javafx.scene.text.Text$TextAttribute$11.computeValue(Text.java:1)
at 
javafx.base/javafx.beans.binding.ObjectBinding.get(ObjectBinding.java:168)
at 
javafx.base/javafx.beans.binding.ObjectExpression.getValue(ObjectExpression.java:49)
at 
javafx.base/javafx.beans.property.ObjectPropertyBase.get(ObjectPropertyBase.java:133)
at 
javafx.controls/javafx.scene.control.skin.TextFieldSkin.lambda$4(TextFieldSkin.java:247)
at 
javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
at 
javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
at 
javafx.base/javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
at 
javafx.base/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
at 
javafx.base/javafx.beans.property.ObjectPropertyBase$Listener.invalidated(ObjectPropertyBase.java:234)
at 
javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
at 
javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
at 
javafx.base/javafx.beans.binding.ObjectBinding.invalidate(ObjectBinding.java:192)
at javafx.graphics/javafx.scene.text.Text.doGeomChanged(Text.java:842)
at javafx.graphics/javafx.scene.text.Text$1.doGeomChanged(Text.java:159)
at 
javafx.graphics/com.sun.javafx.scene.shape.TextHelper.geomChangedImpl(TextHelper.java:106)
at 
javafx.graphics/com.sun.javafx.scene.NodeHelper.geomChanged(NodeHelper.java:139)
at javafx.graphics/javafx.scene.text.Text.needsTextLayout(Text.java:267)
at 
javafx.graphics/javafx.scene.text.Text.needsFullTextLayout(Text.java:262)
at javafx.graphics/javafx.scene.text.Text$3.invalidated(Text.java:463)
at 
javafx.base/javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:110)
at 
javafx.base/javafx.beans.property.StringPropertyBase$Listener.invalidated(StringPropertyBase.java:231)
at 
javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:147)
at 
javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:91)
at 
javafx.base/javafx.beans.binding.StringBinding.invalidate(StringBinding.java:181)
at 
javafx.base/com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObser

Re: RFR: 8090267: JFXPanel Input Problem

2023-08-07 Thread Prasanta Sadhukhan
On Thu, 27 Jul 2023 16:59:59 GMT, Andy Goryachev  wrote:

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

Does it work now? 
or Can anyone else review this please?

-

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


Re: RFR: 8090267: JFXPanel Input Problem

2023-07-27 Thread Andy Goryachev
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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


Re: RFR: 8090267: JFXPanel Input Problem

2023-07-27 Thread Prasanta Sadhukhan
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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)

ping?

-

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


Re: RFR: 8090267: JFXPanel Input Problem

2023-07-26 Thread ctipper
On Tue, 4 Jul 2023 05:54:54 GMT, Prasanta Sadhukhan  
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'm a client side developer trying to add a custom input method event handler 
to my app and I have noticed this problem on Windows with the native client. 
These APIs don't seem to have an great deal of online documentation and I can't 
even get it to work in macOS. Sorry but I don't have privileges for JIRA.

-

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