-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8311922: [macOS] right-Option key fails to generate release event #15432
Conversation
👋 Welcome back dnguyen! A progress list of the required criteria for merging this PR into |
Webrevs
|
@DamonGuy Tested with the patch. Observed that the key code and extended modifier differ for left vs right option key. This is not the case for other left/right modifier keys such as Shift, Command. I think some extra flags (key masks) are being set in case of Right Option Key.
|
I guess it was removed in as part of JDK-8267374 fix. Please see PR#9230 where it was concluded that we dont need ALT_GRAPH mapping for macos and RightOption key was mapped to ALT_GRAPH which makes Option key not work Please run the regression test added/modified to see it does not regress those, mainly |
Thanks for catching this. I believe the edit I just pushed fixes this. My test now shows the correct key code and location on my end. |
I see the comments. I removed the code that was removed again and instead edited the existing NSAlternateKeyMask. Fix now shows the correct key code as well. TestAltUpDown passes as well as my new test. |
why was the keycode wrong with the previous fix? and why do we need to manually set leftAltKeyPressed = YES? should this be done in a different part of the code? |
@@ -291,7 +291,7 @@ | |||
//kCGSFlagsMaskAppleLeftAlternateKey, | |||
//kCGSFlagsMaskAppleRightAlternateKey, | |||
58, | |||
0, | |||
61, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the only change required to make right option key working is adding in the rightKeyCode (61) here. I don't think it is required to revert changes related toleftAltKeyPressed
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems correct. I updated it to only include the key code. Re-ran my test and TestAltUpDown, and both passed still.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated changes look good.
I originally added back the code that was removed. There seemed to be 2 instances of NSAlternateKeyMask afterwards, so the key code value was incorrect. This must've been the case before the regression as well I'd assume. leftAltKeyPressed has been removed as well since it doesn't seem necessary to fix this particular issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Manual test looks good.
I guess this test cannot be automated using Robot since the VK_ALT
defaults to the left option key.
Right. I looked into automating this and making the test headless, but I didn't see a way around this. Thanks |
@DamonGuy 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:
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 539 new commits pushed to the
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. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 83b01cf.
Your commit was automatically rebased without conflicts. |
Previously, a new key combination involving the option key was added to Aqua LAF for JTextAreas. In doing so, some code was removed that created this regression. The regression caused the right option key on Mac OS to incorrectly show another KeyPressed event instead of a KeyReleased event when pressing and releasing the key. Additionally, the location of the key was 'standard' instead of 'right'. Adding back the key mask and its following code resolves the issue and doesn't cause any other CI tests to fail.
The headful test included displays the key events as they're pressed. After the changes, the test correctly shows the right option key's KeyPressed and KeyReleased events and shows the location as 'right'.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15432/head:pull/15432
$ git checkout pull/15432
Update a local copy of the PR:
$ git checkout pull/15432
$ git pull https://git.openjdk.org/jdk.git pull/15432/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15432
View PR using the GUI difftool:
$ git pr show -t 15432
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15432.diff
Webrev
Link to Webrev Comment