RFR: 8348744: Application window not always activated on macOS 15
Andy Goryachev
angorya at openjdk.org
Tue Jan 28 15:59:58 UTC 2025
On Tue, 28 Jan 2025 12:35:13 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
> The fix for [JDK-8319066](https://bugs.openjdk.org/browse/JDK-8319066) added a needed call to activate a JavaFX window on macOS 14 or later via `[NSApp activate]`. In macOS 15, this doesn't always activate the window; even on macOS 14 there are certain cases where it might not. In all other places where we need to activate a window we call `[NSApp activateIgnoringOtherApps:YES]`. This is also what AWT uses in all places.
>
> The fix is to replace the call to `activate` with a call to `activateIgnoringOtherApps`. I ran a full set of headful tests on macOS 15, 14, and 13 (although the code is not executed on macOS 13), and everything looks good on my end.
>
> Worth noting is that `NSApp::activateIgnoringOtherApps` is deprecated as of MacOS SDK 14, which means that we might have problems in the future when we update the Xcode toolchain (or if they eventually degrade it so that the `ignoringOtherApps` part of this call stops doing anything), but that will be a problem we need to address anyway, affecting other places in JavaFX and AWT.
>
> I intend to backported this fix to `jfx24` after it is integrated into mainline (for 25).
works as expected (test app stage gets focused even when the terminal window running the test script loses focus) on macOS 15.1.1 M1, running the following script:
#! /bin/bash
set -x
sleep 5
gradle --continue --info -PBUILD_TOOLS_DOWNLOAD_SCRIPT=../build-tools.gradle -PTEST_ONLY=true -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests CSSRoundingTest
modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m line 286:
> 284: LOG("-> need to active application");
> 285: dispatch_async(dispatch_get_main_queue(), ^{
> 286: [NSApp activateIgnoringOtherApps:YES];
should we add a comment about possible removal of this API in newer platforms?
(I would suggest also include the JBS reference so the context can be obtained by the person who will be fixing this code in the future).
-------------
Marked as reviewed by angorya (Reviewer).
PR Review: https://git.openjdk.org/jfx/pull/1685#pullrequestreview-2578656328
PR Review Comment: https://git.openjdk.org/jfx/pull/1685#discussion_r1932396827
More information about the openjfx-dev
mailing list