Skip to content

Commit 862067d

Browse files
committed
Added OS version guard for NSApp activate call
1 parent 1c4c4e9 commit 862067d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m

+9-7
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,15 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
295295
[pool drain];
296296
GLASS_CHECK_EXCEPTION(env);
297297

298-
if (!NSApp.isActive && requiresActivation) {
299-
// As of macOS 14, application gets to the foreground,
300-
// but it doesn't get activated, so this is needed:
301-
LOG("-> need to active application");
302-
dispatch_async(dispatch_get_main_queue(), ^{
303-
[NSApp activate];
304-
});
298+
if (@available(macOS 14.0, *)) {
299+
if (!NSApp.isActive && requiresActivation) {
300+
// As of macOS 14, application gets to the foreground,
301+
// but it doesn't get activated, so this is needed:
302+
LOG("-> need to active application");
303+
dispatch_async(dispatch_get_main_queue(), ^{
304+
[NSApp activate];
305+
});
306+
}
305307
}
306308
}
307309

0 commit comments

Comments
 (0)