RFR: 8237491: Undecorated stage cannot be maximized
Kevin Rushforth
kcr at openjdk.java.net
Tue Nov 3 23:17:55 UTC 2020
On Mon, 2 Nov 2020 01:08:39 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:
> Simple fix to enable maximizing functionality on the window manager.
>
> Test provided
> gradlew -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests test.javafx.stage.MaximizeUndecorated
>
> Fix for linux only.
The fix looks good. I added a couple comments with suggestions and pointed out one thing that must be fixed (the test needs to be excluded on macOS until [JDK-8255835](https://bugs.openjdk.java.net/browse/JDK-8255835) is fixed).
modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp line 1347:
> 1345: is_maximized = maximize;
> 1346: if (maximize) {
> 1347: // enable the functionality
Maybe expand this comment similar to what was done for minimize (since the reason for doing it is the same)?
tests/system/src/test/java/test/javafx/stage/MaximizeUndecorated.java line 49:
> 47: static Stage stage;
> 48: // might be offscreen and that's ok
> 49: static final int POS = 1000;
I might recommend something a little smaller (maybe 500 instead of 1000), since some window systems constrain at least the top left corner to be visible.
tests/system/src/test/java/test/javafx/stage/MaximizeUndecorated.java line 80:
> 78:
> 79: @Test
> 80: public void testMaximize() throws Exception {
This test fails on macOS, so you will need to exclude it using `assumeTrue` like this:
assumeTrue(!PlatformUtil.isMac()); // JDK-8255835
tests/system/src/test/java/test/javafx/stage/MaximizeUndecorated.java line 83:
> 81: Util.sleep(200);
> 82:
> 83: boolean movedToTopCorner = stage.getY() != POS && stage.getX() != POS;
This presumes that the window system will not reposition it (else you will get a false negative). Given that this is using an undecorated window, it should be fine, and I verified that it did correctly detect the failure when your fix is not applied on both Oracle Linux 7.7 and Ubuntu 20.04.
-------------
PR: https://git.openjdk.java.net/jfx/pull/345
More information about the openjfx-dev
mailing list