JDK-8191885 : [MacOS] JavaFX main window not resizable coming back from full screen mode in MacOS
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 9,10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2017-11-24
  • Updated: 2018-12-17
  • Resolved: 2018-07-19
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.
Other
openjfx11Fixed
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin Mac-mini.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
I'm developing a x-platform desktop app with a resizable main window primaryStage.setResizable(true), after I have clicked the little green button to go into full screen mode and then back again to normal mode the resizing of the window is no longer possible. It works on Windows and Linux but not on MacOS.

I have a question out on StackOverflow regarding this issue and was told this i most likely a bug introduced from jdk-9.

https://stackoverflow.com/questions/47476328/how-to-make-main-javafx-window-still-resizable-coming-back-from-full-screen-mode/47478067#47478067

REGRESSION.  Last worked in version 8u152

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Make a JavaFX application, set primaryStage.setResizable(true)
2. Run application
3. Click the little green maximize button on window to enter full-screen mode
4. Click the little green button again to resume to normal screen mode
5. Resizable window is no longer resizable

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Window should continue to be resizable after coming back from full-screen mode.
ACTUAL -
Window not resizable after coming back from full-screen mode. It is fixed.

REPRODUCIBILITY :
This bug can be reproduced always.


Comments
[~kcr] Done. Please have a look. https://bugs.openjdk.java.net/browse/JDK-8208070
23-07-2018

[~pbansal] Please file a new follow-on bug to add a manual test.
19-07-2018

Changeset: 393bbb76e7de Author: pbansal Date: 2018-07-19 14:38 +0530 URL: http://hg.openjdk.java.net/openjfx/jfx-dev/rt/rev/393bbb76e7de
19-07-2018

+1
19-07-2018

The .02 webrev looks good to me. +1
17-07-2018

[~mbilla] I wasn't suggesting putting the manual test in the tests repo. Rather, I suggest a simple manual test program in the tests/manual directory in the rt repo: http://hg.openjdk.java.net/openjfx/jfx-dev/rt/file/tip/tests/manual
17-07-2018

Yes. I still want to review the fix though.
17-07-2018

[~kcr] Can I check-in this fix and add the manual test in separate bug?
17-07-2018

Thanks [~kcr]. For manual test, [~pbansal] can create a new JBS issue. [~pbansal] Repo to clone manual tests: http://hg.openjdk.java.net/openjfx/jfx-dev/tests +1
17-07-2018

[~mbilla] I do not recommend this approach for this particular bug. It would be a lot of work, and would still not really validate the bug fix. The only way to really validate it would be to verify whether the window could actually be resized, and I doubt that is feasible for an automated test. As an alternative, I suggest that a manual test be added, with instructions, somewhere in tests/manual.
17-07-2018

[~pbansal] Can you try with Shim class (and probably you may have to introduce one JNI call to query native NSWindow Style property) ?
17-07-2018

[~mbilla] I tried but could not find a way to access the native NSWindow style property in Java side. Using Robot test, we can maximize and restore the window, but I could not find a way to verify whether the native NSWindow is resizable or not. Please let me know if know some way of doing this.
17-07-2018

[~pbansal] is it possible to write a robot test case for this issue?
17-07-2018

[~mbilla] Thanks for the review. I have update the webrev. Please have a issue. http://cr.openjdk.java.net/~pbansal/8191885/webrev.02/
17-07-2018

I guess "NS" not needed in variable name isNSWindowResizable as the file GlassWindow.h is only for mac and i dont see "NS" in none of the instance variables.
17-07-2018

@Kevin Thanks for the review. It looks like this is correct way to create a private instance variable. I did some testing with multiple stages and it does work. https://stackoverflow.com/questions/13532862/best-way-to-define-private-variables-in-objective-C But I agree with you, it looks confusing and and I think we can move this in some header file. We can't put this in GlassWindow+Overrides.h as this is a category not subclass of GlassWindow and categories are not allowed to have instance variables (https://stackoverflow.com/questions/27414462/objective-c-instance-variables-may-not-be-placed-in-categories) . We can put this in GlassWindow.h. I have updated the webrev. Please have a look. Webrev: http://cr.openjdk.java.net/~pbansal/8191885/webrev.01/
16-07-2018

I'm pretty sure that this won't work for multiple stages, since the variable you have defined is global, but needs to be per-instance. You will need to define it within an interface block, either in GlassWindow.h, in which case it will need to be public, or in GlassWindow+Overrides.h -- something like this should work (but I'm not an objective-C expert, so the syntax might be slightly off) : @interface GlassWindow (Overrides) { @private BOOL isNSWindowResizable = false; }
14-07-2018

Hi Kevin & Murali, Please review the fix : http://cr.openjdk.java.net/~pbansal/8191885/webrev.00/ Issue: [MacOS] JavaFX main window not resizable coming back from full screen mode in MacOS Fix: This is a regression of while fixing the https://bugs.openjdk.java.net/browse/JDK-8087498. The resizable property is always set to NO in windowDidExitFullScreen. Made changes to save the state of JavaFX window resizable property in windowWillEnterFullScreen and restore the property in windowDidExitFullScreen. Earlier it was always being set to false. I have created the isNSWindowResizable in .m file inside the @implementation to make it private instance variable. Please correct me if this is not the correct way of doing so. Not able to write a automated test case for the fix as there is no way to access the native NSWindow property in Java side. The fix can be verified manually by running the attached test case "Test.java" in the bug. Steps to verify: 1. Compile and run the test case. Verify that the window is be resizable at this stage. 2. Click the little green maximize button or the "Full Screen" button to enter full-screen mode 3. Click the little green button or the "Full Screen" button again to resume to normal screen mode 4. Window is no longer resizable before the fix and is resizable after the fix
03-07-2018

Issue is reproduced on Mac OS 10.13.1.
01-12-2017

Windowing toolkit os x issue so assigning to Manajit -Praveen
28-11-2017

Issue is reproducible only in MacOS. Verified in High Sierra 10.13.1 8u152 : Pass 8u162-b08 : Pass 9-ea+146 : Pass 9-ea+147 : Fail <--- Regression introduced here 9.0.1+11 : Fail 10ea+31 : Fail
27-11-2017