X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JoystickController.m;h=97ca74b6e10e7e42d86264d70ae50f66e2408c5a;hp=ed941ed142f12062c14d84eed08f46f73a368099;hb=68fe4de58269fc00e70e59453e05098ccd4341a2;hpb=dd1f684886c2809133356bb9b335a35293e8849e diff --git a/JoystickController.m b/JoystickController.m index ed941ed..97ca74b 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; @@ -133,7 +127,6 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD for (Target *target in [runningTargets copy]) { if (![target update:self]) { [runningTargets removeObject:target]; - NSLog(@"Removing action, now running %lu.", runningTargets.count); } } if (!runningTargets.count) { @@ -158,7 +151,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 +176,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 +184,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 { @@ -200,9 +193,8 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD return [item name]; } -- (void)outlineViewSelectionDidChange: (NSNotification*) notification { - [targetController reset]; - [targetController load]; +- (void)outlineViewSelectionDidChange:(NSNotification *)notification { + [targetController loadCurrent]; } @end