-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8367376: Bad ButtonUI prevents other components from updating when system changes desktop properties #27205
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
Conversation
Previously: If updateAllUIs threw an exception, we would never reset the update-pending property to false. This means any subsequent call to `updateUI()` would not attempt to call `updateAllUIs()`
|
👋 Welcome back jwood! A progress list of the required criteria for merging this PR into |
|
@mickleness 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 156 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. 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 (@prrace, @aivanov-jdk, @prsadhuk) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
@mickleness The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
prrace
left a comment
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 reasonable to me.
@prsadhuk please review.
| p.add(button); | ||
| getContentPane().add(p); | ||
| } | ||
| } No newline at end of file |
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.
A file should end with new line (\n) character.
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.
OK, this is updated
| import java.awt.Toolkit; | ||
| import java.util.concurrent.CountDownLatch; | ||
|
|
||
| public class Test8367376 extends JFrame { |
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.
Give the test a meaningful name? UninstallUIThrowsException?
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.
OK. I used DesktopPropertyResetPendingFlagTest
Co-authored-by: Alexey Ivanov <alexey.ivanov@oracle.com>
Co-authored-by: Alexey Ivanov <alexey.ivanov@oracle.com>
This is in response to: openjdk#27205 (comment)
This is in response to: openjdk#27205 (comment)
This is in response to: openjdk#27205 (comment)
| } finally { | ||
| setUpdatePending(false); | ||
| } | ||
| } |
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.
I guess same thing we need to do here too
jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
Lines 2293 to 2296 in c96d09a
| public void run() { | |
| updateAllUIs(); | |
| setUpdatePending(false); | |
| } |
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.
and here too
jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
Lines 911 to 914 in c96d09a
| public void run() { | |
| updateAllUIs(); | |
| setUpdatePending(false); | |
| } |
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.
OK, I updated Metal and Synth L&F.
The test in this PR does not currently test either of these new changes, though. Normally I'd feel nervous about that, but IMO the changes in this PR are acceptably low-risk.
Does anyone disagree? If so: should I split this into 2-3 separate tickets/PRs? The original steps involved the Windows L&F and changing the OS's accessibility contrast settings; I don't know if those steps affect Metal/Synth L&F's at all.
| private static void setLookAndFeel() { | ||
| try { | ||
| String lf = UIManager.getSystemLookAndFeelClassName(); | ||
| UIManager.setLookAndFeel(lf); |
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.
Guess we should iterate for all L&F s, not just test the default..
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.
I went the opposite direction for now: I removed any reference to the L&F. This test is structured so it emulates what the Windows L&F was doing, but it's platform/L&F-independent (for the sake of full automation).
I tested on Mac and Windows and confirmed the test still fails against master, and it passes in this PR.
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.
If you do not want to tinker with the current test, maybe you can have another test testing the L&F s, handling exception gracefully in updateUI
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.
Since the changes are in look-and-feels, you should iterate over installed look-and-feels. Otherwise you test Aqua L&F on macOS and Metal on Windows only, which means an exception may still cause problems in other L&Fs.
Creating several tests if needed is fine, yet I don't think it's needed.
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.
I agree with Alexey. I think we should definitely iterate across all L&Fs and it can be done without creating more tests.
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.
I updated the test to iterate over all available L&F's
aivanov-jdk
left a comment
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.
Other L&F have the same problem, so it would be good to resolve it and update the test to iterate over all installed L&Fs.
This was probably left over from an earlier draft; this test uses the TestDesktopProperty class so it doesn't rely on/test any particular L&F.
This is in response to: openjdk#27205 (comment)
This is in response to: openjdk#27205 (comment)
This is in response to: https://git.openjdk.org/jdk/pull/27205#discussion_r2382574446
| @@ -100,16 +89,25 @@ protected void dispatchEvent(AWTEvent event) { | |||
| }; | |||
| Toolkit.getDefaultToolkit().getSystemEventQueue().push(newEventQueue); | |||
|
|
|||
| SwingUtilities.invokeLater( | |||
| DesktopPropertyResetPendingFlagTest::setLookAndFeel); | |||
| for (UIManager.LookAndFeelInfo info : | |||
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.
UIManager import is missing
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.
Thanks; this is updated.
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.
you can also dispose of the frame in try-finally block to be safe and consistent with headful regression tests
and you need to add @key headful to the jtreg tag
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.
OK, this is updated
This is in response to the first point here: openjdk#27205 (comment)
This is in response to the second point here: openjdk#27205 (comment)
test/jdk/com/sun/java/swing/plaf/DesktopPropertyResetPendingFlagTest.java
Show resolved
Hide resolved
…agTest.java Co-authored-by: Alexey Ivanov <alexey.ivanov@oracle.com>
|
/integrate |
|
@mickleness |
|
/sponsor |
|
Going to push as commit 7c75cb3.
Your commit was automatically rebased without conflicts. |
|
@aivanov-jdk @mickleness Pushed as commit 7c75cb3. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Previously:
If DesktopProperty#updateAllUIs threw an exception, we would never reset the update-pending property to false. This means any subsequent call to
updateUI()would not attempt to callupdateAllUIs()With this change:
Subsequent calls to DesktopProperty#updateUI() can still trigger at least one call to updateAllUIs().
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27205/head:pull/27205$ git checkout pull/27205Update a local copy of the PR:
$ git checkout pull/27205$ git pull https://git.openjdk.org/jdk.git pull/27205/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27205View PR using the GUI difftool:
$ git pr show -t 27205Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27205.diff
Using Webrev
Link to Webrev Comment