From: Joe Wreschnig Date: Thu, 28 Feb 2013 14:01:17 +0000 (+0100) Subject: Only refocus key input for empty/key targets. X-Git-Tag: version-1.0~97 X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=commitdiff_plain;h=08c920c47d68423c16a6deba2a59488772066f6b;ds=sidebyside Only refocus key input for empty/key targets. --- diff --git a/JoystickController.m b/JoystickController.m index 864a917..0675075 100644 --- a/JoystickController.m +++ b/JoystickController.m @@ -17,7 +17,6 @@ @implementation JoystickController { IOHIDManagerRef hidManager; - BOOL programmaticallySelecting; NSTimer *continuousTimer; } @@ -84,8 +83,8 @@ static void input_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDVa return; [controller expandRecursive:handler]; - controller->programmaticallySelecting = YES; [controller->outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:[controller->outlineView rowForItem:handler]] byExtendingSelection: NO]; + [controller->targetController focusKey]; } } @@ -192,9 +191,6 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD - (void)outlineViewSelectionDidChange: (NSNotification*) notification { [targetController reset]; [targetController load]; - if (programmaticallySelecting) - [targetController focusKey]; - programmaticallySelecting = NO; } @end diff --git a/TargetController.m b/TargetController.m index 8afaaf2..14f81a9 100644 --- a/TargetController.m +++ b/TargetController.m @@ -189,7 +189,11 @@ } -(void) focusKey { - [[[NSApplication sharedApplication] mainWindow] makeFirstResponder: keyInput]; + Target *currentTarget = configsController.currentConfig[currentJsaction]; + if (!currentTarget || [currentTarget isKindOfClass:[TargetKeyboard class]]) + [[[NSApplication sharedApplication] mainWindow] makeFirstResponder: keyInput]; + else + [keyInput resignFirstResponder]; } -(void) refreshConfigsPreservingSelection: (BOOL) preserve {