Skip to content

Commit

Permalink
Revert core changes. Fix Mac glass code so it reports maximized state…
Browse files Browse the repository at this point in the history
… correctly.
  • Loading branch information
beldenfox committed Oct 21, 2023
1 parent cc72d4a commit 94fe8dc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
16 changes: 3 additions & 13 deletions modules/javafx.graphics/src/main/java/javafx/stage/Stage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1138,19 +1138,9 @@ public String getName() {
* This can be replaced by listening for the onShowing/onHiding events
* Note: This method MUST only be called via its accessor method.
*/
private boolean postVisibleFullScreen;
private boolean postVisibleIconified;
private boolean postVisibleMaximized;

private void doVisibleChanging(boolean value) {
Toolkit toolkit = Toolkit.getToolkit();
if (value && (getPeer() == null)) {
// In case the platform window alters these
// properties while we're finishing installation.
postVisibleFullScreen = isFullScreen();
postVisibleIconified = isIconified();
postVisibleMaximized = isMaximized();

// Setup the peer
Window window = getOwner();
TKStage tkStage = (window == null ? null : window.getPeer());
Expand Down Expand Up @@ -1191,10 +1181,10 @@ private void doVisibleChanged(boolean value) {
TKStage peer = getPeer();
peer.setImportant(isImportant());
peer.setResizable(isResizable());
peer.setFullScreen(postVisibleFullScreen);
peer.setFullScreen(isFullScreen());
peer.setAlwaysOnTop(isAlwaysOnTop());
peer.setIconified(postVisibleIconified);
peer.setMaximized(postVisibleMaximized);
peer.setIconified(isIconified());
peer.setMaximized(isMaximized());
peer.setTitle(getTitle());

if (!isIconified()) {
Expand Down
16 changes: 16 additions & 0 deletions modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,22 @@ - (void)sendEvent:(NSEvent *)event

@implementation GlassWindow_Normal
GLASS_NS_WINDOW_IMPLEMENTATION

-(NSRect)windowWillUseStandardFrame:(NSWindow*)window defaultFrame:(NSRect)newFrame
{
// For windows without titlebars the OS will suggest a frame that's the
// same size as the existing window, not the screen.
if (window.screen != nil && (window.styleMask & NSWindowStyleMaskTitled) == 0) {
return window.screen.visibleFrame;
}
return newFrame;
}

-(BOOL)isZoomed
{
// Ensure the window is not reported as maximized during initialization
return self.screen != nil && [super isZoomed];
}
@end

@implementation GlassWindow_Panel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ public static void teardown() {

@Test
public void testMaximize() throws Exception {
// temporary until JDK-8255835 is fixed
assumeTrue(!PlatformUtil.isMac());
Util.sleep(200);

boolean movedToTopCorner = stage.getY() != POS && stage.getX() != POS;
Expand Down

0 comments on commit 94fe8dc

Please sign in to comment.