On Tue, 28 Jan 2025 17:32:21 GMT, Jose Pereda <jper...@openjdk.org> wrote:

>> @jperedadnr can you add this comment to 
>> https://bugs.openjdk.org/browse/JDK-8348878 please?
>
> Done

> I'm not sure why [NSApp activateIgnoringOtherApps:YES]; works but [NSApp 
> activate]; doesn't, given that the former is deprecated, as you already 
> mentioned, and the latter is what Apple precisely 
> [recommends](https://developer.apple.com/documentation/appkit/nsapplication/activate(ignoringotherapps:)?language=objc)
>  to use instead.

The default activation mode is to only activate only when no other app is 
active, after first deactivating the launching application. This is true for 
the new `activate` method as well as the existing `activateWithOptions` method. 
`[NSApp activate]` is equivalent to `[NSApp activateIgnoringOtherApps:NO]`.

The `activateIgnoringOtherApps` method says this:

> By default, activation deactivates the calling app (assuming it was active), 
> and then the new app is activated only if there’s no currently active 
> application. This prevents the new app from stealing focus from the user, if 
> the app is slow to activate and the user has switched to a different app in 
> the interim. However, if you specify NSApplicationActivateIgnoringOtherApps, 
> the application is activated regardless of the currently active app, 
> potentially stealing focus from the user.

Let's continue looking into this in the context of 
[JDK-8348878](https://bugs.openjdk.org/browse/JDK-8348878).

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1685#discussion_r1932918326

Reply via email to