mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-10 10:08:51 +00: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:
parent
c0d29add82
commit
4fd0f3035a
3 changed files with 123 additions and 7 deletions
|
@ -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];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue