mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-30 19:24:20 +00:00
cocoa: Don't use trick of briefly focusing the Dock on newer macOS releases.
On newer systems, the trick isn't necessary, and if you do it, if the user is moving the mouse when launching the app, it'll show a hidden Dock. Fixes #10340. (manually backported from SDL3 from commit279dabfc96) (cherry picked from commitb2c3e6fade)
This commit is contained in:
committed by
Sam Lantinga
parent
933715fa45
commit
d98087a0c3
@@ -287,9 +287,19 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
|
||||
/* The menu bar of SDL apps which don't have the typical .app bundle
|
||||
* structure fails to work the first time a window is created (until it's
|
||||
* de-focused and re-focused), if this call is in Cocoa_RegisterApp instead
|
||||
* of here. https://bugzilla.libsdl.org/show_bug.cgi?id=3051
|
||||
* of here. https://github.com/libsdl-org/SDL/issues/1913
|
||||
*/
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
|
||||
|
||||
/* this apparently became unnecessary on macOS 14.0, and will addition pop up a
|
||||
hidden dock if you're moving the mouse during launch, so change the default
|
||||
behaviour there. https://github.com/libsdl-org/SDL/issues/10340
|
||||
(13.6 still needs it, presumably 13.7 does, too.) */
|
||||
SDL_bool background_app_default = SDL_FALSE
|
||||
if (@available(macOS 14.0, *)) {
|
||||
background_app_default = SDL_TRUE; /* by default, don't explicitly activate the dock and then us again to force to foreground */
|
||||
}
|
||||
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, background_app_default)) {
|
||||
/* Get more aggressive for Catalina: activate the Dock first so we definitely reset all activation state. */
|
||||
for (NSRunningApplication *i in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) {
|
||||
[i activateWithOptions:NSApplicationActivateIgnoringOtherApps];
|
||||
|
||||
Reference in New Issue
Block a user