-
Notifications
You must be signed in to change notification settings - Fork 504
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
8259680: Need API to query states of CAPS LOCK and NUM LOCK keys #385
Conversation
Add Platform::isKeyLocked method
👋 Welcome back kcr! A progress list of the required criteria for merging this PR into |
@kevinrushforth this pull request will not be integrated until the CSR request JDK-8259868 for issue JDK-8259680 has been approved. |
@kevinrushforth |
Webrevs
|
modules/javafx.graphics/src/main/native-glass/gtk/glass_key.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java
Show resolved
Hide resolved
modules/javafx.graphics/src/main/java/javafx/application/Platform.java
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/java/javafx/application/Platform.java
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/java/javafx/application/Platform.java
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/java/javafx/application/Platform.java
Outdated
Show resolved
Hide resolved
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 good to me, verified tests on all three platforms.
Left minor comments.
modules/javafx.graphics/src/main/java/com/sun/javafx/tk/Toolkit.java
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-glass/gtk/glass_key.cpp
Outdated
Show resolved
Hide resolved
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 good. +1
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 good to me
@kevinrushforth 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 3 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
@kevinrushforth Since your change was applied there have been 3 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 217a8cb. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The JavaFX API does not provide a way to get the state of CAPS LOCK or NUM LOCK on the keyboard. Being able to read the lock state would allow an application to inform the user that caps lock was enabled for passwords or other usages where the keyboard input might not be echoed. It would also allow an application to do spell checking / auto-correction that might ordinarily be skipped when typing all upper-case letters.
We need an equivalent JavaFX API to the existing AWT
java.awt.ToolKit::getLockingKeyState
method. A natural place to put this in JavaFX is in thejavafx.application.Platform
class, so we propose to create a newPlatform::isKeyLocked
method, which will take aKeyCode
-- eitherCAPS
orNUM_LOCK
-- and return anOptional<Boolean>
indicating whether or not that key is in the locked or "on" state. If we can't read the key state on a particular platform, we will returnOptional.empty()
, rather than throwing a runtime exception as AWT does.I have provided both an automated Robot test and a manual test. The latter is needed primarily because we can't set the CAPS lock on Mac using Robot, but also because we want way to test the case where the user has enabled CAPS lock before the program starts.
/csr needed
/reviewers 2
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/385/head:pull/385
$ git checkout pull/385