diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 5d2ff3f06..0d793ba2e 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -2227,8 +2227,15 @@ void _glfwPlatformHideWindow(_GLFWwindow* window) if (_glfwPlatformWindowVisible(w)) num_visible++; } if (!num_visible) { - [NSApp yieldActivationToApplication: app]; - [app activateWithOptions:0]; + // yieldActivationToApplication was introduced in macOS 14 + SEL selector = NSSelectorFromString(@"yieldActivationToApplication:"); + if ([NSApp respondsToSelector:selector]) { + [NSApp performSelector:selector withObject:app]; + [app activateWithOptions:0]; + } else { + #define NSApplicationActivateIgnoringOtherApps 2 + [app activateWithOptions:NSApplicationActivateIgnoringOtherApps]; + } } } }