mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-03 23:00:14 +02:00
Added SDL_SetAppMetadata() (#10404)
Removed duplicate hints SDL_HINT_APP_NAME, SDL_HINT_APP_ID, and SDL_HINT_AUDIO_DEVICE_APP_NAME. Wired up a few things to use the metadata; more to come! Fixes https://github.com/libsdl-org/SDL/issues/4703
This commit is contained in:
@@ -362,12 +362,19 @@ static SDL3AppDelegate *appDelegate = nil;
|
||||
|
||||
static NSString *GetApplicationName(void)
|
||||
{
|
||||
NSString *appName;
|
||||
NSString *appName = nil;
|
||||
|
||||
const char *metaname = SDL_GetStringProperty(SDL_GetGlobalProperties(), SDL_PROP_APP_METADATA_NAME_STRING, NULL);
|
||||
if (metaname && *metaname) {
|
||||
appName = [NSString stringWithUTF8String:metaname];
|
||||
}
|
||||
|
||||
/* Determine the application name */
|
||||
appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
|
||||
if (!appName) {
|
||||
appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
|
||||
appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
|
||||
if (!appName) {
|
||||
appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
|
||||
}
|
||||
}
|
||||
|
||||
if (![appName length]) {
|
||||
@@ -420,6 +427,10 @@ static void CreateApplicationMenus(void)
|
||||
|
||||
/* Add menu items */
|
||||
title = [@"About " stringByAppendingString:appName];
|
||||
|
||||
// !!! FIXME: Menu items can't take parameters, just a basic selector, so this should instead call a selector
|
||||
// !!! FIXME: that itself calls -[NSApplication orderFrontStandardAboutPanelWithOptions:optionsDictionary],
|
||||
// !!! FIXME: filling in that NSDictionary with SDL_GetAppMetadataProperty()
|
||||
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
Reference in New Issue
Block a user