X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JoystickController.m;h=2efd68f34586384d64133025c9bd923ef5af3c1d;hp=ab59c82ad435a34ab5ad0ae748862fa7e859cde6;hb=f563321aec9e13b8479ab3b890a9179f095a8b17;hpb=4a490c57151dd4ba9cb27cc34a0e33fc68fc4d24 diff --git a/JoystickController.m b/JoystickController.m index ab59c82..2efd68f 100644 --- a/JoystickController.m +++ b/JoystickController.m @@ -13,6 +13,7 @@ #import "JSAction.h" #import "Target.h" #import "TargetController.h" +#import "NJEvents.h" @implementation JoystickController { IOHIDManagerRef hidManager; @@ -85,7 +86,7 @@ static void input_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDVa JoystickController *controller = (__bridge JoystickController *)ctx; IOHIDDeviceRef device = IOHIDQueueGetDevice(inSender); - if (controller.sendingRealEvents) { + if (controller.translatingEvents) { [controller runTargetForDevice:device value:value]; } else if ([NSApplication sharedApplication].mainWindow.isVisible) { [controller showTargetForDevice:device value:value]; @@ -216,7 +217,19 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn } - (void)outlineViewSelectionDidChange:(NSNotification *)notification { + [targetController loadCurrent]; } +- (void)setTranslatingEvents:(BOOL)translatingEvents { + if (translatingEvents != _translatingEvents) { + _translatingEvents = translatingEvents; + NSString *name = translatingEvents + ? NJEventTranslationActivated + : NJEventTranslationDeactivated; + [NSNotificationCenter.defaultCenter postNotificationName:name + object:self]; + } +} + @end