mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Deprecate nowx on OS X (but keep it building for sanity checking).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5598 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,109 +0,0 @@
|
||||
#import "cocoaApp.h"
|
||||
|
||||
@implementation NSApplication(i)
|
||||
- (void)appRunning
|
||||
{
|
||||
_running = 1;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface cocoaAppDelegate : NSObject
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
|
||||
@end
|
||||
|
||||
@implementation cocoaAppDelegate : NSObject
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||
{
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
@end
|
||||
|
||||
void cocoaCreateApp()
|
||||
{
|
||||
ProcessSerialNumber psn;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
if (!GetCurrentProcess(&psn)) {
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
SetFrontProcess(&psn);
|
||||
}
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (NSApp == nil) {
|
||||
[NSApplication sharedApplication];
|
||||
//TODO : Create menu
|
||||
[NSApp finishLaunching];
|
||||
}
|
||||
|
||||
if ([NSApp delegate] == nil) {
|
||||
[NSApp setDelegate:[[cocoaAppDelegate alloc] init]];
|
||||
}
|
||||
|
||||
[NSApp appRunning];
|
||||
|
||||
[pool release];
|
||||
|
||||
}
|
||||
|
||||
bool cocoaKeyCode(NSEvent *event)
|
||||
{
|
||||
static bool CMDDown = false, QDown = false;
|
||||
bool Return = false;
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSConnection *connec = [[NSConnection new] autorelease];
|
||||
|
||||
[connec setRootObject: event];
|
||||
if ([connec registerName: @"DolphinCocoaEvent"] == NO)
|
||||
{
|
||||
//printf("error creating nsconnection\n");
|
||||
}
|
||||
|
||||
if( [event type] != NSFlagsChanged )
|
||||
{
|
||||
const char *Keys = [[event characters] 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];
|
||||
return Return;
|
||||
}
|
||||
|
||||
bool cocoaSendEvent(NSEvent *event)
|
||||
{
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if ( event != nil ) {
|
||||
switch ([event type]) {
|
||||
case NSKeyDown:
|
||||
case NSKeyUp:
|
||||
case NSFlagsChanged: // For Command
|
||||
return cocoaKeyCode(event);
|
||||
break;
|
||||
default:
|
||||
[NSApp sendEvent:event];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[pool release];
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user