Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions modules/javafx.graphics/src/main/native-glass/ios/GlassWindow.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -829,16 +829,27 @@ jlong _1createWindow(JNIEnv *env, jobject jWindow, jlong jOwnerPtr, jlong jScree


if (mainWindow == nil) {
//We have to remove rootViewController of splashscreen UIWindow in order to avoid
//StatusBar orientation change ...
UIWindow *splashScreen = [[UIApplication sharedApplication] keyWindow];
splashScreen.rootViewController = nil;

GLASS_LOG("SCREEN: %@", screen);
CGRect applicationFrame = [screen bounds];
GLASS_LOG("FRAME: %@", applicationFrame);

mainWindow = [[GlassMainWindow alloc] initWithFrame:applicationFrame];
GLASS_LOG("FRAME: %.1f %.1f", applicationFrame.size.width, applicationFrame.size.height);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't the dimensions printed when you print the "object" using @ ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, CGRect is a struct, and you get this warning:

warning: format specifies type 'id' but the argument has type 'CGRect' (aka 'struct CGRect') [-Wformat]

which can be safely ignored of course, but then the logs won't show a null value:

FRAME: (null)

and that's why I applied the change.


// Remove rootViewController of the initial UIWindow in order to avoid
// StatusBar orientation changes, initialize our mainWindow (GlassMainWindow), and
// set our own rootViewController (GlassViewController).
UIWindow *initialWindow;
UIWindowScene *windowScene = (UIWindowScene *)[[UIApplication sharedApplication] connectedScenes].allObjects.firstObject;
if (windowScene) {
initialWindow = windowScene.windows.firstObject;
if (initialWindow) {
mainWindow = [[GlassMainWindow alloc] initWithWindowScene:windowScene];
}
}
if (!initialWindow) {
// fallback if no windowScene (very unlikely), or no initialWindow (if no SceneDelegate is used, for instance) are found:
initialWindow = [[UIApplication sharedApplication] keyWindow];
mainWindow = [[GlassMainWindow alloc] initWithFrame:applicationFrame];
}
initialWindow.rootViewController = nil;
mainWindowHost = [[GlassMainView alloc] initWithFrame:CGRectMake(0.0, 0.0, applicationFrame.size.width, applicationFrame.size.height)];

// Set GlassViewController - responsible for orientation change, etc.
Expand Down