JDK-8193502: Dialog height switches between correct and too small when showing and hiding one dialog repeatedly on Linux #456
Conversation
…l when showing and hiding one dialog repeatedly on Linux
@pankaj-bansal can you also review this? |
For all of the glass changes, but especially this one, I would ask you to run a full unit test, including robot tests on your local machine(s). This can be done as follows:
while running the robot tests, you need to make sure you don't interact with the system (especially don't touch the keyboard or mouse). If you don't have an up-to-date webkit library, then you will get some failures in those system tests, but don't worry about them. |
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 can confirm that this fixes the bug.
Can you provide a test case for it? An automated test in tests/system
is preferred, but if that turns out to be too difficult, then a manual test in tests/manual
would be an OK substitute.
modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp
Outdated
Show resolved
Hide resolved
jview = mainEnv->NewGlobalRef(view); | ||
gtk_window_get_size(GTK_WINDOW(gtk_widget), &width, &height); | ||
mainEnv->CallVoidMethod(view, jViewNotifyResize, width, height); | ||
CHECK_JNI_EXCEPTION_RET(mainEnv, 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.
We need to ensure that there are no cases where set_view
can be called without a subsequent call to window_configure
.
Thanks for running the tests. Some other time it would be good to know why you get so many failures, but good that your patch didn't cause any new test failures. I can confirm that on my system I also get the same pass rate: 100% pass (except for a couple known intermittent tests, which decided to behave today). |
Test provided. |
About the failing tests on my setup: It was because Wayland was enable. Switching back to X.org solved 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.
A couple comments on the test. I haven't run it yet, but will before finishing the review.
tests/system/src/test/java/test/robot/javafx/scene/dialog/JDK8193502Test.java
Outdated
Show resolved
Hide resolved
tests/system/src/test/java/test/robot/javafx/scene/dialog/JDK8193502Test.java
Outdated
Show resolved
Hide resolved
Ran full robot tests, including webkit with all pending PR from me applied - #446 #450 #451 #445 (there are other event order changes in other PRs which might affect Kevin's concern about set_view being called without window_configure). Results: 623 tests completed, 4 failed, 118 skipped
|
I ran the tests last week with all 4 patches applied as well with no failures. I've seen very occasional failures in the 4 tests you've listed, and they seem unrelated to your fixes. I'll run them again when I review your new tests. |
tests/system/src/test/java/test/robot/javafx/scene/dialog/JDK8193502Test.java
Outdated
Show resolved
Hide resolved
You might already know this, but the CI build failed due to a white-space issue. |
…haviour on up/down keys" This reverts commit 32a6ba6
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.
Both the fix and the test look good. I can confirm that on Linux, the test fails without the fix and passes with the fix.
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.
Approved
tests/system/src/test/java/test/robot/javafx/scene/dialog/DialogRepeatedShowHideTest.java
Outdated
Show resolved
Hide resolved
Will this fix be backported to JavaFX 11? It has been speculated that this could fix the problem with #222 |
Fixes:
https://bugs.openjdk.java.net/browse/JDK-8193502
The problem:
WindowContextBase::set_view is called before WindowContextTop::window_configure and it relies on size information that is not correct yet (because it's set on WindowContextTop::window_configure).
This causes DialogPane calculations to output wrong values.
So the fix was to move the call to inform java about the size to WindowContextTop::window_configure where the size is sure to be correct.
Also gtk_window_get_size doc informs about possible conditions where it might not behave as expected.
WindowContextPlug and WindowContextChild overrides set_view, so no harm caused there.