mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
cocoa event wip
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1859 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
#import "cocoaApp.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@implementation NSApplication(i)
|
||||
- (void)appRunning
|
||||
@ -47,3 +46,46 @@ void cocoaCreateApp()
|
||||
|
||||
}
|
||||
|
||||
void cocoaKeyCode(NSEvent *event)
|
||||
{
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSConnection *connec = [NSConnection defaultConnection];
|
||||
|
||||
[connec setRootObject: event];
|
||||
if ([connec registerName: @"DolphinCocoaEvent"] == NO)
|
||||
{
|
||||
printf("error creating nsconnection\n");
|
||||
}
|
||||
|
||||
[pool release];
|
||||
|
||||
|
||||
}
|
||||
|
||||
void cocoaSendEvent(NSEvent *event)
|
||||
{
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if ( event != nil ) {
|
||||
switch ([event type]) {
|
||||
case NSKeyDown:
|
||||
cocoaKeyCode(event);
|
||||
break;
|
||||
case NSKeyUp:
|
||||
cocoaKeyCode(nil);
|
||||
break;
|
||||
default:
|
||||
[NSApp sendEvent:event];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[pool release];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user