From 5af5e2e3005a6acc125f3a89135a4885c409e64e Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 16 Nov 2021 22:44:38 -0500 Subject: [PATCH] move first responder resignation code to a function. --- Ample/LaunchWindowController.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Ample/LaunchWindowController.m b/Ample/LaunchWindowController.m index 563a371..0d8cf39 100644 --- a/Ample/LaunchWindowController.m +++ b/Ample/LaunchWindowController.m @@ -594,11 +594,15 @@ static NSString *ShellQuote(NSString *s) { //return [super validateMenuItem: menuItem]; // not implemented? } +-(void)defocus { + [[self window] makeFirstResponder: nil]; // in case text is being edited... +} + # pragma mark - IBActions - (IBAction)launchAction:(id)sender { - [[self window] makeFirstResponder: nil]; // in case text is being edited... + [self defocus]; if (![_args count]) return; [LogWindowController controllerForArgs: _args]; @@ -608,7 +612,7 @@ static NSString *ShellQuote(NSString *s) { - (IBAction)listMedia:(id)sender { - [[self window] makeFirstResponder: nil]; // in case text is being edited... + [self defocus]; if (!_machine) return; NSMutableArray *argv = [NSMutableArray new]; @@ -635,7 +639,7 @@ static NSString *ShellQuote(NSString *s) { - (IBAction)listSlots:(id)sender { - [[self window] makeFirstResponder: nil]; // in case text is being edited... + [self defocus]; if (!_machine) return; NSMutableArray *argv = [NSMutableArray new]; @@ -935,7 +939,7 @@ static NSString *ShellQuote(NSString *s) { -(NSDictionary *)makeBookmark { - [[self window] makeFirstResponder: nil]; + [self defocus]; NSMutableDictionary *dict = [NSMutableDictionary new];