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 parent
c0d29add82
commit
4fd0f3035a
3 files changed
+123
-7
No files matched your search
@@ -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