# HG changeset patch # User serb # Date 1411442014 -14400 # Node ID cba0cc16cfbf1393af83118a484c214e3cee6b62 # Parent eee24e5c8048da31205dff6dd48011977aad5934 8041734: JFrame in full screen mode leaves empty workspace after close Reviewed-by: azvegint, alexsch diff -r eee24e5c8048 -r cba0cc16cfbf src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri Aug 08 21:46:29 2014 +0400 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Sep 23 07:13:34 2014 +0400 @@ -568,7 +568,10 @@ CWrapper.NSWindow.makeKeyWindow(nsWindowPtr); } } else { + // immediately hide the window CWrapper.NSWindow.orderOut(nsWindowPtr); + // process the close + CWrapper.NSWindow.close(nsWindowPtr); } } else { // otherwise, put it in a proper z-order diff -r eee24e5c8048 -r cba0cc16cfbf src/macosx/classes/sun/lwawt/macosx/CWrapper.java --- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Fri Aug 08 21:46:29 2014 +0400 +++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Tue Sep 23 07:13:34 2014 +0400 @@ -54,8 +54,26 @@ static native void orderFront(long window); static native void orderFrontRegardless(long window); static native void orderWindow(long window, int ordered, long relativeTo); + + /** + * Removes the window from the screen. + * + * @param window the pointer of the NSWindow + */ static native void orderOut(long window); + /** + * Removes the window from the screen and releases it. According to + * documentation this method should be similar to {@link #orderOut}, + * because we use ReleasedWhenClosed:NO, so the window shouldn't be + * released. But the close method works differently, for example it + * close the space if the window was in the full screen via + * {@link CPlatformWindow#toggleFullScreen()}. + * + * @param window the pointer of the NSWindow + */ + static native void close(long window); + static native void addChildWindow(long parent, long child, int ordered); static native void removeChildWindow(long parent, long child); diff -r eee24e5c8048 -r cba0cc16cfbf src/macosx/native/sun/awt/CWrapper.m --- a/src/macosx/native/sun/awt/CWrapper.m Fri Aug 08 21:46:29 2014 +0400 +++ b/src/macosx/native/sun/awt/CWrapper.m Tue Sep 23 07:13:34 2014 +0400 @@ -175,6 +175,23 @@ /* * Class: sun_lwawt_macosx_CWrapper$NSWindow + * Method: close + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_sun_lwawt_macosx_CWrapper_00024NSWindow_close + (JNIEnv *env, jclass cls, jlong windowPtr) +{ +JNF_COCOA_ENTER(env); + NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr); + [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ + [window close]; + }]; +JNF_COCOA_EXIT(env); +} + +/* + * Class: sun_lwawt_macosx_CWrapper$NSWindow * Method: orderFrontRegardless * Signature: (J)V */