Add SDL_MAC_REGISTER_ACTIVATION_HANDLERS hint to allow disabling the normal application startup/activation/deactivation handlers
This commit is contained in:
parent
7c5e694022
commit
d6b1fc9576
1 changed files with 14 additions and 8 deletions
|
@ -142,9 +142,11 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||||
|
SDL_bool registerActivationHandlers = SDL_GetHintBoolean("SDL_MAC_REGISTER_ACTIVATION_HANDLERS", SDL_TRUE);
|
||||||
|
|
||||||
seenFirstActivate = NO;
|
seenFirstActivate = NO;
|
||||||
|
|
||||||
|
if (registerActivationHandlers) {
|
||||||
[center addObserver:self
|
[center addObserver:self
|
||||||
selector:@selector(windowWillClose:)
|
selector:@selector(windowWillClose:)
|
||||||
name:NSWindowWillCloseNotification
|
name:NSWindowWillCloseNotification
|
||||||
|
@ -154,6 +156,7 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
|
||||||
selector:@selector(focusSomeWindow:)
|
selector:@selector(focusSomeWindow:)
|
||||||
name:NSApplicationDidBecomeActiveNotification
|
name:NSApplicationDidBecomeActiveNotification
|
||||||
object:nil];
|
object:nil];
|
||||||
|
}
|
||||||
|
|
||||||
[center addObserver:self
|
[center addObserver:self
|
||||||
selector:@selector(localeDidChange:)
|
selector:@selector(localeDidChange:)
|
||||||
|
@ -293,6 +296,9 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
|
if (!SDL_GetHintBoolean("SDL_MAC_REGISTER_ACTIVATION_HANDLERS", SDL_TRUE))
|
||||||
|
return;
|
||||||
|
|
||||||
/* The menu bar of SDL apps which don't have the typical .app bundle
|
/* 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
|
* 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
|
* de-focused and re-focused), if this call is in Cocoa_RegisterApp instead
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue