Fix building on older Cocoa

This commit is contained in:
Kovid Goyal
2025-05-13 07:45:11 +05:30
parent a47babc87d
commit 20d6a8e4c5

View File

@@ -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];
}
}
}
}