-
Notifications
You must be signed in to change notification settings - Fork 542
8296621: Stage steals focus on scene change #940
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
Merge master
Merge from jfx
merge from jfx
Merge upstream
Merge from upstream
Update from master
Merge from upstream
Merge with main
Merge master
Merge master
Update from jfx
Pull from origin
Merge master
|
👋 Welcome back tsayao! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
I agree that changing from one scene to another should not cause a new request focus call. My only concern is to ensure that this will not cause any regressions for the initial setting of a scene. A safer change might be to qualify the existing call to /reviewers 2 |
A In any case, Windows doesn't allow applications to force a window to the foreground, so that wouldn't work anyway. If a non-foreground process tries to set the foreground window, the call to |
|
I'll finish my testing soon. As long as the behavior for the initial display of the Stage is the same on all platforms before/after this fix, I think it is fine. In particular, the "after" behavior for switching Scenes that Ambarish documented above is what I would expect after this bug fix is integrated.
Exactly what I was going to say. |
arapte
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.
Suggesting minor changes in the test.
tests/system/src/test/java/test/robot/javafx/scene/SceneChangeShouldNotFocusStageTest.java
Outdated
Show resolved
Hide resolved
tests/system/src/test/java/test/robot/javafx/scene/SceneChangeShouldNotFocusStageTest.java
Outdated
Show resolved
Hide resolved
|
|
kevinrushforth
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.
I still need to do a little more testing, but so far, the fix looks good to me.
As for the test, I left an inline comment answering your question. More importantly, though, the test doesn't catch the bug. It passes both with and without your fix on all three platforms.
tests/system/src/test/java/test/robot/javafx/scene/SceneChangeShouldNotFocusStageTest.java
Outdated
Show resolved
Hide resolved
|
One other thing to note about the test, and also about the test case from the bug report on which it was based: The fact that the test sets the scene in rapid succession to two different values (at time = N, and immediately thereafter at time = 0) has uncovered a bug in JavaFX. I see an intermittent NPE in |
That's odd, It does consistently fail/works for me when I add/remove |
|
It might be timing problem. I ran it a couple more times without the fix and it failed once (so it failed 2 out of 3 times). I'll test it again now that you've updated the test. |
kevinrushforth
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.
Yes, it is a timing problem, most likely related to the performance of my Ubuntu 20.04 VM. I left comments inline with two suggested changes (I think only the first is necessary, but setting iconify before the stage is shown may make the test more robust). With those changes, it fails reliably without your fix and passes reliably with your fix.
tests/system/src/test/java/test/robot/javafx/scene/SceneChangeShouldNotFocusStageTest.java
Outdated
Show resolved
Hide resolved
tests/system/src/test/java/test/robot/javafx/scene/SceneChangeShouldNotFocusStageTest.java
Outdated
Show resolved
Hide resolved
kevinrushforth
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 good.
|
@tsayao 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 5 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 |
|
Going to push as commit 5b0d3b5.
Your commit was automatically rebased without conflicts. |
Simple fix to not requestFocus() on scene change.
The attached bug sample shows that the TextField focused on the scene remains focused when the scene comes back.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx pull/940/head:pull/940$ git checkout pull/940Update a local copy of the PR:
$ git checkout pull/940$ git pull https://git.openjdk.org/jfx pull/940/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 940View PR using the GUI difftool:
$ git pr show -t 940Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/940.diff