mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
macOS: Fix an OS-generated warning printed to stdout on launch in bundled apps.
This commit is contained in:
parent
fcb77f9848
commit
5501bcc834
@ -38,6 +38,8 @@
|
|||||||
- (void)terminate:(id)sender;
|
- (void)terminate:(id)sender;
|
||||||
- (void)sendEvent:(NSEvent *)theEvent;
|
- (void)sendEvent:(NSEvent *)theEvent;
|
||||||
|
|
||||||
|
+ (void)registerUserDefaults;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SDLApplication
|
@implementation SDLApplication
|
||||||
@ -90,6 +92,17 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
|
|||||||
[super sendEvent:theEvent];
|
[super sendEvent:theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (void)registerUserDefaults
|
||||||
|
{
|
||||||
|
NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||||
|
[NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported",
|
||||||
|
[NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled",
|
||||||
|
[NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState",
|
||||||
|
nil];
|
||||||
|
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
|
||||||
|
[appDefaults release];
|
||||||
|
}
|
||||||
|
|
||||||
@end // SDLApplication
|
@end // SDLApplication
|
||||||
|
|
||||||
/* setAppleMenu disappeared from the headers in 10.4 */
|
/* setAppleMenu disappeared from the headers in 10.4 */
|
||||||
@ -227,6 +240,10 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
|
|||||||
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
|
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we call this before NSApp activation, macOS might print a complaint
|
||||||
|
* about ApplePersistenceIgnoreState. */
|
||||||
|
[SDLApplication registerUserDefaults];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -379,13 +396,12 @@ Cocoa_RegisterApp(void)
|
|||||||
CreateApplicationMenus();
|
CreateApplicationMenus();
|
||||||
}
|
}
|
||||||
[NSApp finishLaunching];
|
[NSApp finishLaunching];
|
||||||
NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys:
|
if ([NSApp delegate]) {
|
||||||
[NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported",
|
/* The SDL app delegate calls this in didFinishLaunching if it's
|
||||||
[NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled",
|
* attached to the NSApp, otherwise we need to call it manually.
|
||||||
[NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState",
|
*/
|
||||||
nil];
|
[SDLApplication registerUserDefaults];
|
||||||
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
|
}
|
||||||
[appDefaults release];
|
|
||||||
}
|
}
|
||||||
if (NSApp && !appDelegate) {
|
if (NSApp && !appDelegate) {
|
||||||
appDelegate = [[SDLAppDelegate alloc] init];
|
appDelegate = [[SDLAppDelegate alloc] init];
|
||||||
|
Loading…
Reference in New Issue
Block a user