Skip to content
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

Closed
wants to merge 6 commits into from

Conversation

mkartashev
Copy link
Member

@mkartashev mkartashev commented Feb 23, 2024

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


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8326497: Window.toFront() fails for iconified windows on Linux (Bug - P4)

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

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 23, 2024

👋 Welcome back mkartashev! 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.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 23, 2024
@openjdk
Copy link

openjdk bot commented Feb 23, 2024

@mkartashev The following label will be automatically applied to this pull request:

  • client

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.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Feb 23, 2024
@mlbridge
Copy link

mlbridge bot commented Feb 23, 2024

Webrevs

@prrace
Copy link
Contributor

prrace commented Feb 23, 2024

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
Copy link
Contributor

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.

Copy link
Member Author

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.

@mkartashev
Copy link
Member Author

@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);
Copy link
Contributor

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.

Copy link
Member Author

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;
Copy link
Contributor

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 ?

Copy link
Member Author

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.

Copy link
Contributor

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 ?

Copy link
Member Author

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.

Copy link
Contributor

@TejeshR13 TejeshR13 left a 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.

@mkartashev
Copy link
Member Author

@prrace What say you?

@prrace
Copy link
Contributor

prrace commented Mar 6, 2024

Let me submit a new test job with this (hopefully final?) version

Copy link
Contributor

@prrace prrace left a 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

@openjdk
Copy link

openjdk bot commented Mar 7, 2024

@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:

8326497: Window.toFront() fails for iconified windows on Linux

Reviewed-by: tr, prr

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 master branch:

  • 2d4c757: 8327041: Incorrect lane size references in avx512 instructions.
  • 761ed25: 8327138: Clean up status management in cdsConfig.hpp and CDS.java
  • 53628f2: 8327492: Remove applet usage and update DisposeInActionEventTest.html
  • 2627470: 8325567: jspawnhelper without args fails with segfault
  • a6dc4bc: 8326332: Unclosed inline tags cause misalignment in summary tables
  • 33aa4b2: 8256314: JVM TI GetCurrentContendedMonitor is implemented incorrectly
  • 87b40c6: 8327167: Clarify the handling of Leap year by Calendar
  • 6efdaf8: 8326908: DecimalFormat::toPattern throws OutOfMemoryError when pattern is empty string
  • c4845f0: 8317431: Implement simpler Comparator when building certification paths
  • 585a958: 8327675: jspawnhelper should be built on all unix platforms
  • ... and 167 more: https://git.openjdk.org/jdk/compare/09a78b5da961f3575cf20c9b56bff86ddbd6545d...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.

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 in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 7, 2024
@mkartashev
Copy link
Member Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 9, 2024
@openjdk
Copy link

openjdk bot commented Mar 9, 2024

@mkartashev
Your change (at version da72dbc) is now ready to be sponsored by a Committer.

@avu
Copy link
Contributor

avu commented Mar 12, 2024

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 12, 2024

Going to push as commit 139681a.
Since your change was applied there have been 196 commits pushed to the master branch:

  • 9f7aff4: 8327788: G1: Improve concurrent reference processing documentation
  • 251347b: 8326139: C2 SuperWord: split packs (match use/def packs, implemented, mutual independence)
  • e21da4c: 8327486: java/util/Properties/PropertiesStoreTest.java fails "Text 'xxx' could not be parsed at index 20" after 8174269
  • 4d6235e: 8327716: RISC-V: Change type of vector_length param of several assembler functions from int to uint
  • 586396c: 8327705: Remove mention of "applet" from java.text package description
  • 41450e9: 8314250: CDS dump error message: Invoker type parameter must start and end with Object: L3I_L
  • 0a6e64e: 8327424: ProblemList serviceability/sa/TestJmapCore.java on all platforms with ZGC
  • c65d308: 8327812: JFR: Remove debug message in Function.Maximum
  • b9bc31f: 8327790: Improve javadoc for ResolvedJavaType.hasFinalizableSubclass
  • 18de932: 8325991: Accelerate Poly1305 on x86_64 using AVX2 instructions
  • ... and 186 more: https://git.openjdk.org/jdk/compare/09a78b5da961f3575cf20c9b56bff86ddbd6545d...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 12, 2024
@openjdk openjdk bot closed this Mar 12, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Mar 12, 2024
@openjdk
Copy link

openjdk bot commented Mar 12, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants