-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8326497: Window.toFront() fails for iconified windows on Linux #17985
Conversation
👋 Welcome back mkartashev! A progress list of the required criteria for merging this PR into |
@mkartashev 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
|
Looks reasonable to me. I'm a bit surprised this hasn't come up before. On Mac I see that we already do this properly, I presume this is also the case on Windows, so the test will pass on all platforms ? I think we should submit a test job ... |
* @summary Verifies that an iconified window is restored with Window.toFront() | ||
* @requires os.family == "linux" | ||
* @library /test/lib | ||
* @run main IconifiedToFront |
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.
Well, the testing noticed for me that this fails because you don't specify
@key headless
Also the requires os.family == linux surely should not be needed
If this is the desired JDK behaviour it should do the same on all platforms.
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'm assuming you meant @key headful
, right?
The test, unfortunately, fails both on macOS and Windows. I guess the same thing has be done there as well, but I don't have the hardware handy at the moment. Will get back to it later.
And made the test not dependent on swing.
@prrace The fix was extended to Windows as well. MacOS works as it is except that the test needed some tweaking to allow for slower iconify/de-iconify effects. Please, have a look at the updated version. |
} | ||
|
||
private static void pause() { | ||
robot.delay(PAUSE_MS); |
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.
Adding robot.waitForIdle();
after delay would be better.
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.
Agreed; done.
import java.awt.Toolkit; | ||
|
||
public class IconifiedToFront { | ||
private static final int PAUSE_MS = 1500; |
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.
1.5 sec is minimum delay, can we reduced it ?
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.
Not unless there's another idea on how to measure tests' success. 1.5 seconds is about the time my MacOS needs to complete an iconify/de-iconfiy process.
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.
Did u try after adding waitForIdle
?
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 were right @TejeshR13. waitForIdle
helps and I reverted the time back to 500ms.
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.
@prrace What say you? |
Let me submit a new test job with this (hopefully final?) version |
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.
Testing all good. Approved
@mkartashev 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 177 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 (@TejeshR13, @prrace) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@mkartashev |
/sponsor |
Going to push as commit 139681a.
Your commit was automatically rebased without conflicts. |
@avu @mkartashev Pushed as commit 139681a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
XToolkit implements
toFront()
essentially by sending the_NET_ACTIVE_WINDOW
message to activate the window. This has no effect when the target window is in the iconified state. So the fix is to cancel that state prior to sending the message.The test verifies that the fix works for maximized and undecorated frames as well out of abundance of caution; they do not represent a special case from the
toFront()
standpoint.References
_NET_ACTIVE_WINDOW
: https://specifications.freedesktop.org/wm-spec/1.3/ar01s03.htmlProgress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17985/head:pull/17985
$ git checkout pull/17985
Update a local copy of the PR:
$ git checkout pull/17985
$ git pull https://git.openjdk.org/jdk.git pull/17985/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17985
View PR using the GUI difftool:
$ git pr show -t 17985
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17985.diff
Webrev
Link to Webrev Comment