mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Mac: Change the startup windows display the window normally and start a mini runloop instead of calling using runModalForWindow.
This way, the Quit function works. git-svn-id: https://svn.eduke32.com/eduke32@5965 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
dc1bbcd419
commit
25f2a5f457
2 changed files with 32 additions and 58 deletions
|
@ -79,6 +79,8 @@ static NSPopUpButton * makeComboBox(void)
|
|||
|
||||
static id nsapp;
|
||||
|
||||
static int retval = -1;
|
||||
|
||||
static struct {
|
||||
int fullscreen;
|
||||
int xdim2d, ydim2d;
|
||||
|
@ -134,21 +136,6 @@ static struct {
|
|||
// window properties
|
||||
[self setDelegate:self];
|
||||
[self setReleasedWhenClosed:NO];
|
||||
#if defined MAC_OS_X_VERSION_10_6 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||
[self setPreventsApplicationTerminationWhenModal:NO];
|
||||
#else
|
||||
SEL selector = @selector(setPreventsApplicationTerminationWhenModal:);
|
||||
if ([self respondsToSelector:selector])
|
||||
{
|
||||
BOOL argument = NO;
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:selector]];
|
||||
[invocation setSelector:selector];
|
||||
[invocation setTarget:self];
|
||||
[invocation setArgument:&argument atIndex:2];
|
||||
[invocation invoke];
|
||||
[invocation release];
|
||||
}
|
||||
#endif
|
||||
#if defined MAC_OS_X_VERSION_10_3 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3
|
||||
[self setContentMinSize:[[self contentView] frame].size];
|
||||
#else
|
||||
|
@ -314,7 +301,7 @@ static struct {
|
|||
{
|
||||
UNREFERENCED_PARAMETER(sender);
|
||||
|
||||
[nsapp abortModal];
|
||||
retval = 0;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
@ -414,7 +401,7 @@ static struct {
|
|||
{
|
||||
UNREFERENCED_PARAMETER(sender);
|
||||
|
||||
[nsapp abortModal];
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
- (void)start:(id)sender
|
||||
|
@ -438,7 +425,7 @@ static struct {
|
|||
|
||||
settings.forcesetup = [alwaysShowButton state] == NSOnState;
|
||||
|
||||
[nsapp stopModal];
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
- (void)setupRunMode
|
||||
|
@ -575,8 +562,6 @@ int startwin_idle(void *v)
|
|||
|
||||
int startwin_run(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (startwin == nil) return 0;
|
||||
|
||||
settings.fullscreen = fullscreen;
|
||||
|
@ -589,16 +574,18 @@ int startwin_run(void)
|
|||
|
||||
[startwin setupRunMode];
|
||||
|
||||
switch ([nsapp runModalForWindow:startwin]) {
|
||||
#ifdef MAC_OS_X_VERSION_10_9
|
||||
case NSModalResponseStop: retval = 1; break;
|
||||
case NSModalResponseAbort: retval = 0; break;
|
||||
#else
|
||||
case NSRunStoppedResponse: retval = 1; break;
|
||||
case NSRunAbortedResponse: retval = 0; break;
|
||||
#endif
|
||||
default: retval = -1;
|
||||
[nsapp finishLaunching];
|
||||
|
||||
[startwin center];
|
||||
[startwin makeKeyAndOrderFront:nil];
|
||||
|
||||
do
|
||||
{
|
||||
NSEvent *event = [nsapp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||
[nsapp sendEvent:event];
|
||||
[nsapp updateWindows];
|
||||
}
|
||||
while (retval == -1);
|
||||
|
||||
[startwin setupMessagesMode];
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ static NSPopUpButton * makeComboBox(void)
|
|||
|
||||
static id nsapp;
|
||||
|
||||
static int retval = -1;
|
||||
|
||||
static struct {
|
||||
grpfile_t const * grp;
|
||||
int fullscreen;
|
||||
|
@ -141,21 +143,6 @@ static struct {
|
|||
// window properties
|
||||
[self setDelegate:self];
|
||||
[self setReleasedWhenClosed:NO];
|
||||
#if defined MAC_OS_X_VERSION_10_6 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||
[self setPreventsApplicationTerminationWhenModal:NO];
|
||||
#else
|
||||
SEL selector = @selector(setPreventsApplicationTerminationWhenModal:);
|
||||
if ([self respondsToSelector:selector])
|
||||
{
|
||||
BOOL argument = NO;
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:selector]];
|
||||
[invocation setSelector:selector];
|
||||
[invocation setTarget:self];
|
||||
[invocation setArgument:&argument atIndex:2];
|
||||
[invocation invoke];
|
||||
[invocation release];
|
||||
}
|
||||
#endif
|
||||
#if defined MAC_OS_X_VERSION_10_3 && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3
|
||||
[self setContentMinSize:[[self contentView] frame].size];
|
||||
#else
|
||||
|
@ -339,7 +326,7 @@ static struct {
|
|||
{
|
||||
UNREFERENCED_PARAMETER(sender);
|
||||
|
||||
[nsapp abortModal];
|
||||
retval = 0;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
@ -409,7 +396,7 @@ static struct {
|
|||
{
|
||||
UNREFERENCED_PARAMETER(sender);
|
||||
|
||||
[nsapp abortModal];
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
- (void)start:(id)sender
|
||||
|
@ -431,7 +418,7 @@ static struct {
|
|||
|
||||
settings.forcesetup = [alwaysShowButton state] == NSOnState;
|
||||
|
||||
[nsapp stopModal];
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
- (void)setupRunMode
|
||||
|
@ -582,8 +569,6 @@ int startwin_idle(void *v)
|
|||
|
||||
int startwin_run(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (startwin == nil) return 0;
|
||||
|
||||
settings.fullscreen = ud.config.ScreenMode;
|
||||
|
@ -595,16 +580,18 @@ int startwin_run(void)
|
|||
|
||||
[startwin setupRunMode];
|
||||
|
||||
switch ([nsapp runModalForWindow:startwin]) {
|
||||
#ifdef MAC_OS_X_VERSION_10_9
|
||||
case NSModalResponseStop: retval = 1; break;
|
||||
case NSModalResponseAbort: retval = 0; break;
|
||||
#else
|
||||
case NSRunStoppedResponse: retval = 1; break;
|
||||
case NSRunAbortedResponse: retval = 0; break;
|
||||
#endif
|
||||
default: retval = -1;
|
||||
[nsapp finishLaunching];
|
||||
|
||||
[startwin center];
|
||||
[startwin makeKeyAndOrderFront:nil];
|
||||
|
||||
do
|
||||
{
|
||||
NSEvent *event = [nsapp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||
[nsapp sendEvent:event];
|
||||
[nsapp updateWindows];
|
||||
}
|
||||
while (retval == -1);
|
||||
|
||||
[startwin setupMessagesMode];
|
||||
|
||||
|
|
Loading…
Reference in a new issue