Only refocus key input for empty/key targets.
[enjoyable.git] / TargetController.m
index 3fc0f28..14f81a9 100644 (file)
@@ -55,7 +55,6 @@
                        if(keyInput.hasKey) {
                                TargetKeyboard* k = [[TargetKeyboard alloc] init];
                                [k setVk: [keyInput vk]];
-                               [k setDescr: [keyInput descr]];
                                return k;
                        }
                        break;
 }
 
 -(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  {