From 5a2353545ecd33e609d13a1f22ed29cc57e57633 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Fri, 30 Sep 2022 01:36:58 +0200 Subject: [PATCH] Revert "8211301: [macos] support full window content options" This reverts commit a75beab1a2adc3e6f48eb3e571864046581cb90e. --- .../sun/lwawt/macosx/CPlatformWindow.java | 36 +++---------------- jdk/src/macosx/native/sun/awt/AWTWindow.m | 36 +++---------------- 2 files changed, 8 insertions(+), 64 deletions(-) diff --git jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 92640a63aa0..2600b1a54bd 100644 --- jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -102,8 +102,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo public static final String WINDOW_FADE_IN = "apple.awt._windowFadeIn"; public static final String WINDOW_FADE_OUT = "apple.awt._windowFadeOut"; public static final String WINDOW_FULLSCREENABLE = "apple.awt.fullscreenable"; - public static final String WINDOW_FULL_CONTENT = "apple.awt.fullWindowContent"; - public static final String WINDOW_TRANSPARENT_TITLE_BAR = "apple.awt.transparentTitleBar"; + // Yeah, I know. But it's easier to deal with ints from JNI static final int MODELESS = 0; @@ -130,10 +129,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo static final int IS_DIALOG = 1 << 25; static final int IS_MODAL = 1 << 26; static final int IS_POPUP = 1 << 27; - static final int FULL_WINDOW_CONTENT = 1 << 14; - static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE - | MINIMIZABLE | RESIZABLE | FULL_WINDOW_CONTENT; + static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE; // corresponds to method-based properties static final int HAS_SHADOW = 1 << 10; @@ -144,11 +141,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo static final int DRAGGABLE_BACKGROUND = 1 << 19; static final int DOCUMENT_MODIFIED = 1 << 21; static final int FULLSCREENABLE = 1 << 23; - static final int TRANSPARENT_TITLE_BAR = 1 << 18; - static final int _METHOD_PROP_BITMASK = RESIZABLE | HAS_SHADOW | ZOOMABLE | ALWAYS_ON_TOP | HIDES_ON_DEACTIVATE - | DRAGGABLE_BACKGROUND | DOCUMENT_MODIFIED | FULLSCREENABLE - | TRANSPARENT_TITLE_BAR; + static final int _METHOD_PROP_BITMASK = RESIZABLE | HAS_SHADOW | ZOOMABLE | ALWAYS_ON_TOP | HIDES_ON_DEACTIVATE | DRAGGABLE_BACKGROUND | DOCUMENT_MODIFIED | FULLSCREENABLE; // corresponds to callback-based properties static final int SHOULD_BECOME_KEY = 1 << 12; @@ -203,19 +197,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo final String filename = ((java.io.File)value).getAbsolutePath(); c.execute(ptr->nativeSetNSWindowRepresentedFilename(ptr, filename)); - }}, - new Property(WINDOW_FULL_CONTENT) { - public void applyProperty(final CPlatformWindow c, final Object value) { - boolean isFullWindowContent = Boolean.parseBoolean(value.toString()); - c.setStyleBits(FULL_WINDOW_CONTENT, isFullWindowContent); - } - }, - new Property(WINDOW_TRANSPARENT_TITLE_BAR) { - public void applyProperty(final CPlatformWindow c, final Object value) { - boolean isTransparentTitleBar = Boolean.parseBoolean(value.toString()); - c.setStyleBits(TRANSPARENT_TITLE_BAR, isTransparentTitleBar); - } - } + }} }) { public CPlatformWindow convertJComponentToTarget(final JRootPane p) { Component root = SwingUtilities.getRoot(p); @@ -435,16 +417,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo if (prop != null) { styleBits = SET(styleBits, DRAGGABLE_BACKGROUND, Boolean.parseBoolean(prop.toString())); } - - prop = rootpane.getClientProperty(WINDOW_FULL_CONTENT); - if (prop != null) { - styleBits = SET(styleBits, FULL_WINDOW_CONTENT, Boolean.parseBoolean(prop.toString())); - } - - prop = rootpane.getClientProperty(WINDOW_TRANSPARENT_TITLE_BAR); - if (prop != null) { - styleBits = SET(styleBits, TRANSPARENT_TITLE_BAR, Boolean.parseBoolean(prop.toString())); - } } if (isDialog) { diff --git jdk/src/macosx/native/sun/awt/AWTWindow.m jdk/src/macosx/native/sun/awt/AWTWindow.m index 92fff249ccf..2036b6a3036 100644 --- jdk/src/macosx/native/sun/awt/AWTWindow.m +++ jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -202,10 +202,9 @@ AWT_NS_WINDOW_IMPLEMENTATION NSUInteger type = 0; if (IS(styleBits, DECORATED)) { type |= NSTitledWindowMask; - if (IS(styleBits, CLOSEABLE)) type |= NSClosableWindowMask; - if (IS(styleBits, MINIMIZABLE)) type |= NSMiniaturizableWindowMask; - if (IS(styleBits, RESIZABLE)) type |= NSResizableWindowMask; - if (IS(styleBits, FULL_WINDOW_CONTENT)) type |= NSFullSizeContentViewWindowMask; + if (IS(styleBits, CLOSEABLE)) type |= NSClosableWindowMask; + if (IS(styleBits, MINIMIZABLE)) type |= NSMiniaturizableWindowMask; + if (IS(styleBits, RESIZABLE)) type |= NSResizableWindowMask; } else { type |= NSBorderlessWindowMask; } @@ -264,9 +263,6 @@ AWT_NS_WINDOW_IMPLEMENTATION } } - if (IS(mask, TRANSPARENT_TITLE_BAR) && [self.nsWindow respondsToSelector:@selector(setTitlebarAppearsTransparent:)]) { - [self.nsWindow setTitlebarAppearsTransparent:IS(bits, TRANSPARENT_TITLE_BAR)]; - } } - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)platformWindow @@ -1020,29 +1016,9 @@ JNF_COCOA_ENTER(env); AWTWindow *window = (AWTWindow*)[nsWindow delegate]; // scans the bit field, and only updates the values requested by the mask - // (this implicitly handles the _CALLBACK_PROP_BITMASK case, since those are passive reads) + // (this implicity handles the _CALLBACK_PROP_BITMASK case, since those are passive reads) jint newBits = window.styleBits & ~mask | bits & mask; - BOOL resized = NO; - - // Check for a change to the full window content view option. - // The content view must be resized first, otherwise the window will be resized to fit the existing - // content view. - if (IS(mask, FULL_WINDOW_CONTENT)) { - if (IS(newBits, FULL_WINDOW_CONTENT) != IS(window.styleBits, FULL_WINDOW_CONTENT)) { - NSRect frame = [nsWindow frame]; - NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:newBits]; - NSRect screenContentRect = [NSWindow contentRectForFrameRect:frame styleMask:styleMask]; - NSRect contentFrame = NSMakeRect(screenContentRect.origin.x - frame.origin.x, - screenContentRect.origin.y - frame.origin.y, - screenContentRect.size.width, - screenContentRect.size.height); - NSView* view = (NSView*)nsWindow.contentView; - view.frame = contentFrame; - resized = YES; - } - } - // resets the NSWindow's style mask if the mask intersects any of those bits if (mask & MASK(_STYLE_PROP_BITMASK)) { [nsWindow setStyleMask:[AWTWindow styleMaskForStyleBits:newBits]]; @@ -1054,10 +1030,6 @@ JNF_COCOA_ENTER(env); } window.styleBits = newBits; - - if (resized) { - [window _deliverMoveResizeEvent]; - } }]; JNF_COCOA_EXIT(env); -- 2.37.3