mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-19 06:40:58 +00:00
Allow OSX to quit Dolphin cleanly in NoWX build with command+Q. Not sure how to let them do it via close button in the Window
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4866 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
4927e5607e
commit
936664314f
@ -28,6 +28,6 @@ if acenv['HAVE_PULSEAUDIO']:
|
|||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
files += [ 'CoreAudioSoundStream.cpp' ]
|
files += [ 'CoreAudioSoundStream.cpp' ]
|
||||||
acenv['FRAMEWORKS'] = [ 'CoreAudio' ]
|
acenv['FRAMEWORKS'] = [ 'CoreAudio', 'AudioUnit' ]
|
||||||
|
|
||||||
acenv.StaticLibrary(env['local_libs'] + 'audiocommon', files)
|
acenv.StaticLibrary(env['local_libs'] + 'audiocommon', files)
|
||||||
|
@ -186,7 +186,11 @@ int main(int argc, char *argv[])
|
|||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
|
event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
|
||||||
cocoaSendEvent(event);
|
if(cocoaSendEvent(event))
|
||||||
|
{
|
||||||
|
PowerPC::Shutdown();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void cocoaSendEvent(NSEvent *event);
|
bool cocoaSendEvent(NSEvent *event);
|
||||||
|
|
||||||
void cocoaCreateApp();
|
void cocoaCreateApp();
|
||||||
|
|
||||||
|
@ -46,9 +46,10 @@ void cocoaCreateApp()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cocoaKeyCode(NSEvent *event)
|
bool cocoaKeyCode(NSEvent *event)
|
||||||
{
|
{
|
||||||
|
static bool CMDDown = false, QDown = false;
|
||||||
|
bool Return = false;
|
||||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
NSConnection *connec = [NSConnection defaultConnection];
|
NSConnection *connec = [NSConnection defaultConnection];
|
||||||
@ -59,12 +60,30 @@ void cocoaKeyCode(NSEvent *event)
|
|||||||
//printf("error creating nsconnection\n");
|
//printf("error creating nsconnection\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( [event type] != NSFlagsChanged )
|
||||||
|
{
|
||||||
|
NSString *NewString = [event characters];
|
||||||
|
char *Keys = [NewString UTF8String];
|
||||||
|
|
||||||
|
if( Keys[0] == 'q' && [event type] == NSKeyDown )
|
||||||
|
QDown = true;
|
||||||
|
if( Keys[0] == 'q' && [event type] == NSKeyUp )
|
||||||
|
QDown = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( [event modifierFlags] & NSCommandKeyMask )
|
||||||
|
CMDDown = true;
|
||||||
|
else
|
||||||
|
CMDDown = false;
|
||||||
|
|
||||||
|
if( QDown && CMDDown )
|
||||||
|
Return = true;
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
return Return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cocoaSendEvent(NSEvent *event)
|
bool cocoaSendEvent(NSEvent *event)
|
||||||
{
|
{
|
||||||
|
|
||||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||||
@ -73,7 +92,8 @@ void cocoaSendEvent(NSEvent *event)
|
|||||||
switch ([event type]) {
|
switch ([event type]) {
|
||||||
case NSKeyDown:
|
case NSKeyDown:
|
||||||
case NSKeyUp:
|
case NSKeyUp:
|
||||||
cocoaKeyCode(event);
|
case NSFlagsChanged: // For Command
|
||||||
|
return cocoaKeyCode(event);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
[NSApp sendEvent:event];
|
[NSApp sendEvent:event];
|
||||||
@ -83,6 +103,7 @@ void cocoaSendEvent(NSEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,6 @@ dspenv.Append(
|
|||||||
LIBS = [ 'common', 'audiocommon' ],
|
LIBS = [ 'common', 'audiocommon' ],
|
||||||
)
|
)
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
dspenv['FRAMEWORKS'] = [ 'CoreAudio', 'CoreServices' ]
|
dspenv['FRAMEWORKS'] = [ 'CoreAudio', 'CoreServices', 'AudioUnit' ]
|
||||||
|
|
||||||
dspenv.SharedLibrary(env['plugin_dir']+name, files)
|
dspenv.SharedLibrary(env['plugin_dir']+name, files)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user