On Wed, 31 Jan 2024 21:49:32 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>>>    notice how the underline under あ is still there in the first text field.
>> 
>> That behavior surprised me the first time I saw it but I eventually figured 
>> out that it's a feature, not a bug. If you switch back to the original 
>> window by clicking on the title bar you should pick up composition exactly 
>> where you left off e.g. the IM window should appear showing the same 
>> candidates it was showing earlier. That's the way native Mac apps like 
>> TextEdit work (most of the time, every now and then clicking on the title 
>> bar commits the text).
>> 
>> On a technical level the focusOwner for the Scene isn't changing so JavaFX 
>> doesn't think there's any reason to finish composition. And apparently the 
>> OS agrees and relies on Glass to retain enough state that it can pick up 
>> where it left off.
>
>> e.g. the IM window should appear showing the same candidates it was showing 
>> earlier.
> 
> Thank you for clarification!
> The behavior is different, let me explain:
> 
> using the MonkeyTester, open TextField page and the Native-to-ascii tool 
> (Tools -> Native-to-ascii).
> 1. switch to Japanese input
> 2. type "su" into the text field in the main window
> 3. click on a "native" text area in the other window
> 4. type "zu" in the native window
> 5. **unexpectedly**, the text field in the main window shows the symbol still 
> underlined
> 6. click on the main window title to focus back on the original text field.  
> type "zuki"
> EXPECTED:
> - the text field should contain 鈴木
> ACTUAL:
> - the text is すずき, the last two symbols underlined:
> 
> ![Screenshot 2024-01-31 at 13 43 
> 41](https://github.com/openjdk/jfx/assets/107069028/60eac972-252d-40b0-b8ed-76dcb6672bac)
> 
> It looks like the text was indeed committed (despite it being displayed 
> underlined at step 5), and getting back to it from another window does not 
> restore the IME to the state expected at the step 2.
> 
> Interestingly, if instead of going to a different window of the same javafx 
> application, the user clicks elsewhere on some other application window and 
> then goes back to javafx by clicking on the title bar, the IME window is 
> indeed gets back to the expected state.

@andy-goryachev-oracle You're right, I missed a detail and ended up testing 
something else. I did some more testing and it looks like the JavaFX behavior 
is consistent with other apps like TextEdit. If you move focus away from a 
window in the middle of IM composition the composed text is left underlined. If 
you restore focus to that window *before* typing anything the IM will pick up 
where it left off. But if you type something in another window before restoring 
focus the IM will commit the text the moment focus returns. This seems to be 
driven by the OS since TextEdit behaves the same way.

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

PR Comment: https://git.openjdk.org/jfx/pull/1356#issuecomment-1920268535

Reply via email to