JDK-8089230 : Mac: Window.maximize(false) won't restore a window into its original rectangle
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 7u6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2012-07-04
  • Updated: 2017-05-09
  • Resolved: 2017-05-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
1. create a window
2. setBounds() it to a particular location/size
3. call maximize(true)
4. call maximize(false)

The window won't be restored at the same rectangle as set at step #2.
Comments
Changeset: 97dc48e51225 Author: aniyogi Date: 2017-05-09 12:35 -0400 URL: http://hg.openjdk.java.net/openjfx/10-dev/rt/rev/97dc48e51225 8089230: Mac: Window.maximize(false) won't restore a window into its original rectangle Reviewed-by: ddhill ! modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Java.m
09-05-2017

Oh, actually, there already is one. It needs to be enabled as part of this, presuming that this fix is sufficient to allow it to run: tests/system/src/test/java/test/javafx/stage/RestoreStagePositionTest.java: // Disable on Mac until JDK-8089230 is fixed assumeTrue(!PlatformUtil.isMac());
09-05-2017

I haven't looked at the fix itself (but don't have any comment on it). I note that this seems like a good case for a unit test. Would it be possible to add one?
09-05-2017

I will commit this as Avik is not a committer yet.
09-05-2017

Please fix white space before committing. +1 [ddhill rt]$ bash tools/scripts/checkWhiteSpace -EF modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Java.m: fixed Corrected 1 whitespace or executable issues
09-05-2017

Please review http://cr.openjdk.java.net/~aniyogi/8089230/webrev.00/ Cause: setFlipFrame method in native Obj C code was implemented wrongly for restorePreZoomedRect method as the calling method.
09-05-2017

As part of this fix, the following unit test must be re-enabled (after verifying that it works correctly). test.javafx.stage.RestoreStagePositionTest#testUfullscreenPosition This will require fixing the following code, preferably by changing the Platform.runLater() to Utils.runAndWait(), if the test has not already been fixed by that time. Platform.runLater(() -> stage.setMaximized(true)); Thread.sleep(200); Assert.assertTrue(stage.isMaximized());
16-03-2017

Note that the failing test case is a slight variant of the new test case that tests the window position after exiting from full-screen or maximized windows in FX 9-dev tests/system/src/test/java/test/javafx/stage/RestoreStagePositionTest.java The test as it currently exists doesn't fail, because the text exits maximized mode too soon and the window is never actually drawn as maximized. Changing the sleep after setting maximize to true and before setting it back to false to 2000 msec will make it fail.
21-02-2017

I rediscovered this bug just last week. I will attach a test case.
20-02-2017