X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JoystickController.m;h=84366ef028e40e218d1448091c3667ac88b4b8b3;hp=ed941ed142f12062c14d84eed08f46f73a368099;hb=15a3aec049658f4a1c3c6e8c9f8a549fb8de0782;hpb=dd1f684886c2809133356bb9b335a35293e8849e diff --git a/JoystickController.m b/JoystickController.m index ed941ed..84366ef 100644 --- a/JoystickController.m +++ b/JoystickController.m @@ -20,15 +20,9 @@ NSMutableArray *runningTargets; } -@synthesize joysticks; -@synthesize selectedAction; -@synthesize frontWindowOnly; -@synthesize mouseLoc; -@synthesize sendingRealEvents; - - (id)init { if ((self = [super init])) { - joysticks = [[NSMutableArray alloc] initWithCapacity:16]; + _joysticks = [[NSMutableArray alloc] initWithCapacity:16]; runningTargets = [[NSMutableArray alloc] initWithCapacity:32]; } return self; @@ -112,7 +106,7 @@ static void add_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDevi } - (Joystick *)findJoystickByRef:(IOHIDDeviceRef)device { - for (Joystick *js in joysticks) + for (Joystick *js in _joysticks) if (js.device == device) return js; return nil; @@ -158,7 +152,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD IOHIDManagerScheduleWithRunLoop(hidManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); IOReturn ret = IOHIDManagerOpen(hidManager, kIOHIDOptionsTypeNone); - if (ret == kIOReturnSuccess) { + if (ret != kIOReturnSuccess) { [[NSAlert alertWithMessageText:@"Input devices are unavailable" defaultButton:nil alternateButton:nil @@ -183,7 +177,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD } - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { - return item ? [[item children] count] : [joysticks count]; + return item ? [[item children] count] : _joysticks.count; } - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { @@ -191,7 +185,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD } - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item { - return item ? [item children][index] : joysticks[index]; + return item ? [item children][index] : _joysticks[index]; } - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {