Allow clicking on the key field directly.
[enjoyable.git] / JoystickController.m
index 13db938..97ca74b 100644 (file)
     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) {
@@ -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