X-Git-Url: https://git.yukkurigames.com/?a=blobdiff_plain;f=Classes%2FNJDeviceController.m;h=cb7b9175a9d9a9a2f40bc521f350ca773a71b230;hb=63a4e78b77b29d91a0f3cb592b07bd65a70b82b8;hp=8417927dbb5ddb029c7a530150d842bef13ebd2c;hpb=53afd7c25f4423020c805c3587875cdce99ba3f4;p=enjoyable.git diff --git a/Classes/NJDeviceController.m b/Classes/NJDeviceController.m index 8417927..cb7b917 100644 --- a/Classes/NJDeviceController.m +++ b/Classes/NJDeviceController.m @@ -26,6 +26,11 @@ if ((self = [super init])) { _devices = [[NSMutableArray alloc] initWithCapacity:16]; _continousOutputs = [[NSMutableArray alloc] initWithCapacity:32]; + [NSNotificationCenter.defaultCenter + addObserver:self + selector:@selector(setup) + name:NSApplicationDidFinishLaunchingNotification + object:nil]; } return self; } @@ -44,7 +49,10 @@ } - (void)addRunningOutput:(NJOutput *)output { - [_continousOutputs addObject:output]; + // Axis events will trigger every small movement, don't keep + // re-adding them or they trigger multiple times each time. + if (![_continousOutputs containsObject:output]) + [_continousOutputs addObject:output]; if (!_continuousOutputsTick) { _continuousOutputsTick = [NSTimer scheduledTimerWithTimeInterval:1.0/60.0 target:self @@ -235,7 +243,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn _translatingEvents = translatingEvents; NSInteger state = translatingEvents ? NSOnState : NSOffState; translatingEventsButton.state = state; - translatingEventsMenu.title = translatingEvents ? @"Disable" : @"Enable"; NSString *name = translatingEvents ? NJEventTranslationActivated : NJEventTranslationDeactivated; @@ -248,5 +255,4 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn self.translatingEvents = sender.state == NSOnState; } - @end