move first responder resignation code to a function.

This commit is contained in:
Kelvin Sherlock 2021-11-16 22:44:38 -05:00
parent afc3ac608a
commit 5af5e2e300
1 changed files with 8 additions and 4 deletions

View File

@ -594,11 +594,15 @@ static NSString *ShellQuote(NSString *s) {
//return [super validateMenuItem: menuItem]; // not implemented? //return [super validateMenuItem: menuItem]; // not implemented?
} }
-(void)defocus {
[[self window] makeFirstResponder: nil]; // in case text is being edited...
}
# pragma mark - IBActions # pragma mark - IBActions
- (IBAction)launchAction:(id)sender { - (IBAction)launchAction:(id)sender {
[[self window] makeFirstResponder: nil]; // in case text is being edited... [self defocus];
if (![_args count]) return; if (![_args count]) return;
[LogWindowController controllerForArgs: _args]; [LogWindowController controllerForArgs: _args];
@ -608,7 +612,7 @@ static NSString *ShellQuote(NSString *s) {
- (IBAction)listMedia:(id)sender { - (IBAction)listMedia:(id)sender {
[[self window] makeFirstResponder: nil]; // in case text is being edited... [self defocus];
if (!_machine) return; if (!_machine) return;
NSMutableArray *argv = [NSMutableArray new]; NSMutableArray *argv = [NSMutableArray new];
@ -635,7 +639,7 @@ static NSString *ShellQuote(NSString *s) {
- (IBAction)listSlots:(id)sender { - (IBAction)listSlots:(id)sender {
[[self window] makeFirstResponder: nil]; // in case text is being edited... [self defocus];
if (!_machine) return; if (!_machine) return;
NSMutableArray *argv = [NSMutableArray new]; NSMutableArray *argv = [NSMutableArray new];
@ -935,7 +939,7 @@ static NSString *ShellQuote(NSString *s) {
-(NSDictionary *)makeBookmark { -(NSDictionary *)makeBookmark {
[[self window] makeFirstResponder: nil]; [self defocus];
NSMutableDictionary *dict = [NSMutableDictionary new]; NSMutableDictionary *dict = [NSMutableDictionary new];