From 08c920c47d68423c16a6deba2a59488772066f6b Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Thu, 28 Feb 2013 15:01:17 +0100 Subject: [PATCH] Only refocus key input for empty/key targets. --- JoystickController.m | 6 +----- TargetController.m | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) 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 { -- 2.20.1