I looked at the code that supposedly implements the new behavior (activating full-screen mode with setExtendedState(MAXIMIZED_BOTH).) That code appears unchanged in OpenJDK 11 vs. OpenJDK 9, where it was introduced. I don't see how the code could possibly duplicate the functionality of com.apple.eawt.Application.requestToggleFullScreen(). The com.apple.eawt.Application.requestToggleFullScreen() method hooks into CPlatformWindow.toggleFullScreen(). The new code implemented in JDK-8143914 <https://bugs.openjdk.java.net/browse/JDK-8143914> provides additional hooks into CPlatformWindow.toggleFullScreen(), but they appear to be activated only if:
1. getRootPane().putClientProperty("apple.awt.fullscreenable", false) is called and the window is already in full-screen mode, or 2. setResizable(false) is called and the window is already in full-screen mode. That does not expose the same functionality to applications as com.apple.eawt.Application.requestToggleFullScreen(). Even if it did, it could not replace com.apple.eawt.FullScreenListener, which is needed in order for applications to be notified when full-screen mode is activated or deactivated. On 7/22/19 4:58 PM, Sergey Bylokhov wrote: > Hi, DRC. > > I guess this feature have to be implemented by this CR: > https://bugs.openjdk.java.net/browse/JDK-8143914 > > The idea was to use the sequence of: "setExtendedState() + > MAXIMIZED_BOTH" > to toggle the "fullscreen" window. And use the client property to > enable/disable > this functionality. But it looks like something has changed since > then, and > the window does not move to the "fullscreen" when we zoom it. > Please file a bug for this. > > Interesting that the "fullscreen" works fine if the user clicks on the > zoom button. > > > On 20/07/2019 17:03, DRC wrote: >> I've been beating my head against the wall about this for quite a while, >> but I can't figure out how to programmatically toggle "Lion Full-Screen >> Mode" (i.e. "Full-Screen Mode Using Spaces") on macOS without using the >> deprecated com.apple.eawt.FullScreen* classes, which are problematic at >> best when including a custom JRE in my app using jlink. I looked at the >> OpenJDK 12 source, and it doesn't appear that the native code to do this >> toggling has any other touch points besides the >> com.apple.eawt.FullScreen* classes. What am I missing? The problem is >> that, because I'm writing a remote desktop client, I have to provide >> users with a way to switch in and out of full-screen mode with a >> keystroke and menu option, and I also have to be able to detect when the >> user clicks the full-screen button in the window's titlebar. I don't >> know how to do that without invoking >> com.apple.eawt.FullScreenListener.addFullScreenListenerTo() and >> com.apple.eawt.Application.requestToggleFullScreen(). Any advice is >> appreciated. >> >> DRC >> > >