jfx
jfx copied to clipboard
8341514: Add reducedMotion and reducedTransparency preferences
This PR adds the Platform.Preferences.reducedMotion and Platform.Preferences.reducedTransparency accessibility preferences:
interface Preferences {
/**
* Specifies whether applications should minimize the amount of non-essential animations,
* reducing discomfort for users who experience motion sickness or vertigo.
* <p>
* If the platform does not report this preference, this property defaults to {@code false}.
*
* @return the {@code reducedMotion} property
* @defaultValue {@code false}
* @since 24
*/
ReadOnlyBooleanProperty reducedMotionProperty();
/**
* Specifies whether applications should minimize the amount of transparent or translucent
* layer effects, which can help to increase contrast and readability for some users.
* <p>
* If the platform does not report this preference, this property defaults to {@code false}.
*
* @return the {@code reducedTransparency} property
* @defaultValue {@code false}
* @since 24
*/
ReadOnlyBooleanProperty reducedTransparencyProperty();
...
}
On Windows, these preferences correspond to "Transparency effects" and "Animation effects" in the system settings:
On macOS, these preferences correspond to "Reduce motion" and "Reduce transparency" in the system settings:
On Linux, the reducedMotion preference corresponds to gtk-enable-animations. On my Ubuntu 24.04 system, GTK3 does not pick up the "Settings / Accessibility / Reduce Animations" system setting, and therefore GTK always reports gtk-enable-animations == true. Changing the preference requires manually editing etc/gtk-3.0/settings.ini. The reducedTransparency preference has no corresponding GTK setting.
/reviewers 2 /csr
Progress
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
- [ ] Change requires CSR request JDK-8341667 to be approved
- [x] Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)
Issues
- JDK-8341514: Add reducedMotion and reducedTransparency preferences (Enhancement - P4)
- JDK-8341667: Add reducedMotion and reducedTransparency preferences (CSR)
Reviewers
- Kevin Rushforth (@kevinrushforth - Reviewer)
- Andy Goryachev (@andy-goryachev-oracle - Reviewer)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1592/head:pull/1592
$ git checkout pull/1592
Update a local copy of the PR:
$ git checkout pull/1592
$ git pull https://git.openjdk.org/jfx.git pull/1592/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1592
View PR using the GUI difftool:
$ git pr show -t 1592
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1592.diff
Webrev
:wave: Welcome back mstrauss! 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.
@mstr2 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:
8341514: Add reducedMotion and reducedTransparency preferences
Reviewed-by: kcr, angorya
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 15 new commits pushed to the master branch:
- e2a3074029d94e19332ffb1f1a49e94c5e3e5163: 8342462: TextAreaSkin: remove USE_MULTIPLE_NODES
- 6ac2dd3ee0d175053442fb5de1bd0e3f92175874: 8336031: Create implementation of NSAccessibilityStaticText protocol
- f5b18adfa4151a7760b146a95ecea08b2b407d39: 8337280: Include jdk.jsobject module with JavaFX
- f71c3906d5da83adb69bf55d1e2854b8891dbefe: 8340003: Bump minimum JDK version for JavaFX to JDK 22
- 77482debff0b6e550b451516b4d4d1466895fed8: 8341372: BackgroundPosition, BorderImage, BorderStroke, CornerRadii should be final
- c4b1e1c019c98e97c64df8b11ee2f9635c67256d: 8341686: FX: Update copyright year in docs, readme files to 2025
- 1c86d3b089bec1ade1e9e986ef71ec77cae7b533: 8340850: Wrong bug ID listed as reason for skipping SwingNodePlatformExitCrashTest
- 9c31cb0c696c9ec8bf71038f8f5f53633c457d04: 8340005: Eliminate native access calls from javafx.swing
- 0cafd8011b218162259b81872b1672a1a0649eef: 8341920: Intermittent WebKit build failure on Windows generating PDB files in 619.1
- cf559843d165e79167949718c15d458064ec9d2b: 8341440: ScrollPane: no immediate effect changing fitWidth/fitHeight
- ... and 5 more: https://git.openjdk.org/jfx/compare/f681302926af291d64982f92f6caf1ead5dd266b...master
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 master branch, type /integrate in a new comment.
@mstr2 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 1 Reviewer, 1 Author).
@mstr2 has indicated that a compatibility and specification (CSR) request is needed for this pull request.
@mstr2 please create a CSR request for issue JDK-8341514 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.
Webrevs
- 04: Full - Incremental (fbdd0759)
- 03: Full - Incremental (2b545aaf)
- 02: Full - Incremental (8b178268)
- 01: Full - Incremental (c144a794)
- 00: Full (ef95a9f7)
I've added the Platform Preferences Monitor to the Monkey Tester (Tools -> ...) https://github.com/andy-goryachev-oracle/MonkeyTest
One thing I could not do is to enumerate the properties getter via reflection or BeanInfo/PropertyDescriptor because the class is not accessible com.sun.javafx.application.preferences.PlatformPreferences
This presents a problem for any application that is expected to work with different JFX versions.
One thing I could not do is to enumerate the properties getter via reflection or BeanInfo/PropertyDescriptor because the class is not accessible com.sun.javafx.application.preferences.PlatformPreferences
Did try to use pref.getClass() for your reflection? That won't work. You should be able to look up the methods of Platform.Preferences.class.
To add a little more detail on what is a common mistake when doing reflection on a returned type from any API:
Fails:
var pref = Platform.getPreferences();
var methods = pref.getClass().getMethods();
Works:
var methods = Platform.Preferences.class.getMethods();
@mstr2 I see the map values change, but both new properties showing wrong initial values and not being updated (on macOS):
just to be clear, the code I used to verify properties in the monkey tester is both via UI and addListener:
https://github.com/andy-goryachev-oracle/MonkeyTest/blob/b78a34ddf028c8e987249ed8f4ace6fca6469efc/src/com/oracle/tools/fx/monkey/sheets/PropertiesMonitor.java#L318
@mstr2 I see the map values change, but both new properties showing wrong initial values and not being updated (on macOS):
This should also be fixed now.
API looks good. I reviewed the CSR. The impl also looks good. I just need to finish my testing (I tested macOS and Windows and will test Linux).
/integrate
Going to push as commit 076b4018de1a6fd659778b77d66d2478def315a3.
Since your change was applied there have been 15 commits pushed to the master branch:
- e2a3074029d94e19332ffb1f1a49e94c5e3e5163: 8342462: TextAreaSkin: remove USE_MULTIPLE_NODES
- 6ac2dd3ee0d175053442fb5de1bd0e3f92175874: 8336031: Create implementation of NSAccessibilityStaticText protocol
- f5b18adfa4151a7760b146a95ecea08b2b407d39: 8337280: Include jdk.jsobject module with JavaFX
- f71c3906d5da83adb69bf55d1e2854b8891dbefe: 8340003: Bump minimum JDK version for JavaFX to JDK 22
- 77482debff0b6e550b451516b4d4d1466895fed8: 8341372: BackgroundPosition, BorderImage, BorderStroke, CornerRadii should be final
- c4b1e1c019c98e97c64df8b11ee2f9635c67256d: 8341686: FX: Update copyright year in docs, readme files to 2025
- 1c86d3b089bec1ade1e9e986ef71ec77cae7b533: 8340850: Wrong bug ID listed as reason for skipping SwingNodePlatformExitCrashTest
- 9c31cb0c696c9ec8bf71038f8f5f53633c457d04: 8340005: Eliminate native access calls from javafx.swing
- 0cafd8011b218162259b81872b1672a1a0649eef: 8341920: Intermittent WebKit build failure on Windows generating PDB files in 619.1
- cf559843d165e79167949718c15d458064ec9d2b: 8341440: ScrollPane: no immediate effect changing fitWidth/fitHeight
- ... and 5 more: https://git.openjdk.org/jfx/compare/f681302926af291d64982f92f6caf1ead5dd266b...master
Your commit was automatically rebased without conflicts.
@mstr2 Pushed as commit 076b4018de1a6fd659778b77d66d2478def315a3.
:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.