Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8320773: [macOS] All IME input blocked #1295

Closed
wants to merge 1 commit into from

Conversation

beldenfox
Copy link
Contributor

@beldenfox beldenfox commented Nov 27, 2023

The changes submitted in PR #1209 broke IME input on macOS 12 and 13 (at least on Apple Silicon). Calling charactersByApplyingModifiers on an NSEvent alters its state in some way that confuses NSTextInputContext.handleEvent. The result is that all key events are discarded if an IME is active. Apple fixed this bug in macOS 14 Sonoma.

In this PR we switch to using the same Carbon call that we started using in PR #425 (jfx21) to query the keyboard layout.

This is a new implementation of the fix for JDK-8087700 so that bug will need to be re-tested.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 2 Reviewers)

Issue

  • JDK-8320773: [macOS] All IME input blocked (Bug - P1)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1295/head:pull/1295
$ git checkout pull/1295

Update a local copy of the PR:
$ git checkout pull/1295
$ git pull https://git.openjdk.org/jfx.git pull/1295/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1295

View PR using the GUI difftool:
$ git pr show -t 1295

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1295.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 27, 2023

👋 Welcome back mfox! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label Nov 27, 2023
@mlbridge
Copy link

mlbridge bot commented Nov 27, 2023

Webrevs

@kevinrushforth
Copy link
Member

/reviewers 2 reviewers

@kevinrushforth
Copy link
Member

Reviewers: @andy-goryachev-oracle @kevinrushforth

@jperedadnr would you also like to review this?

@openjdk
Copy link

openjdk bot commented Nov 27, 2023

@kevinrushforth
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 2 Reviewers).

@andy-goryachev-oracle
Copy link
Contributor

IME window opens (tested with Japanese input language).

Observation:
This might be an existing issue, and unrelated to the fix - the IME window opens in what appears to be incorrect location in certain situations.

My setup has two monitors and the secondary monitor (scale =1) is above the primary (retina, scale=2). When the test app is placed on the secondary window, the IME popup appears in the wrong location、 above the cursor, outside of the viewable area):

Screenshot 2023-11-27 at 16 06 37

At first I thought this might be due to negative coordinates, but it also happens when the secondary monitor is moved below the primary. Depending on where the secondary is placed the IME popup may appear on the other monitor altogether.

@andy-goryachev-oracle
Copy link
Contributor

The fix looks good as far as I can tell. Tests listed in JDK-8087700 work as expected (KeyboardTest, TestKeyCombination, monkey tester's Keyboard Event Viewer).

The IME location problem is a known issue JDK-8301893

@yososs
Copy link

yososs commented Nov 28, 2023

Thanks for the quick fix response.
As one of the actual users of the Japanese IME, I will make sure it works.

@yososs
Copy link

yososs commented Nov 28, 2023

A short test appears to have solved the problem caused by side effects.
I also found a known IME related issue, but am concerned that this fix will not complicate it.

Steps to reproduce:

Click on another TextInput control in the middle of an IME conversion in the TextInput control to move the focus.

Issue:

IME conversion candidate popup moves to the clicked destination,
locked into an input disabled state in the original TextInput.

Expected Behavior:

The conversion is committed.
The IME conversion candidate popup is closed.

@andy-goryachev-oracle
Copy link
Contributor

andy-goryachev-oracle commented Nov 28, 2023

I also found a known IME related issue

Thank you for noticing the issue! I've created JDK-8320912, feel free to add or correct any details.

Is the expected behavior in this case that IME should commit the existing candidate/input, clear its candidate list and present a blank IME window focused on the other input field?

@jperedadnr
Copy link
Collaborator

Reviewers: @andy-goryachev-oracle @kevinrushforth

@jperedadnr would you also like to review this?

I'll review it, sure.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I verified that it fixes the problem.

@beldenfox I recommend waiting for a day to integrate this in case @jperedadnr has any comments.

@openjdk
Copy link

openjdk bot commented Nov 28, 2023

@beldenfox This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8320773: [macOS] All IME input blocked

Reviewed-by: angorya, kcr, jpereda

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 1 new commit pushed to the master branch:

  • b80ec39: 8313648: JavaFX application continues to show a black screen after graphic card driver crash

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@andy-goryachev-oracle, @kevinrushforth, @jperedadnr) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Ready to be integrated label Nov 28, 2023
Copy link
Collaborator

@jperedadnr jperedadnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me.
I've tested:

  • M1/macOS 14.1.1 (no issues before or after this PR)
  • Intel/macOS 12.6.6 (reported issues starting 22-ea+18, and no issues after this PR)

@beldenfox
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Ready to sponsor label Nov 29, 2023
@openjdk
Copy link

openjdk bot commented Nov 29, 2023

@beldenfox
Your change (at version da46b51) is now ready to be sponsored by a Committer.

@andy-goryachev-oracle
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 29, 2023

Going to push as commit c46c172.
Since your change was applied there has been 1 commit pushed to the master branch:

  • b80ec39: 8313648: JavaFX application continues to show a black screen after graphic card driver crash

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 29, 2023
@openjdk openjdk bot closed this Nov 29, 2023
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review sponsor Ready to sponsor labels Nov 29, 2023
@openjdk
Copy link

openjdk bot commented Nov 29, 2023

@andy-goryachev-oracle @beldenfox Pushed as commit c46c172.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
5 participants