diff options
author | Damiano Galassi <[email protected]> | 2017-03-16 11:03:25 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2017-03-16 11:03:25 +0100 |
commit | cdf2b1d0efe8265b66df05f428cf01ff67bb4621 (patch) | |
tree | 81ff681ab24a40415a3c8bbfa5ffc73eb937db87 /macosx/NSWindow+HBAdditions.m | |
parent | 1f54807178d50df83d9643e8ca05370f1b7f73a5 (diff) |
MacGui: end the textfields editing before adding a job to queue or creating a preset, so all the current job settings will be saved.
Diffstat (limited to 'macosx/NSWindow+HBAdditions.m')
-rw-r--r-- | macosx/NSWindow+HBAdditions.m | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/macosx/NSWindow+HBAdditions.m b/macosx/NSWindow+HBAdditions.m index 2951d7a1f..fbf65f116 100644 --- a/macosx/NSWindow+HBAdditions.m +++ b/macosx/NSWindow+HBAdditions.m @@ -1,10 +1,8 @@ -// -// NSWindow+HBAdditions.m -// HandBrake -// -// Created by Damiano Galassi on 25/04/16. -// -// +/* NSWindow+HBAdditions.m + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ #import "NSWindow+HBAdditions.h" @@ -75,5 +73,34 @@ return center; } +- (BOOL)HB_endEditing; +{ + BOOL success; + id responder = self.firstResponder; + + // If we're dealing with the field editor, the real first responder is + // its delegate. + if ((responder != nil) && [responder isKindOfClass:[NSTextView class]] && [(NSTextView*)responder isFieldEditor]) + { + responder = ([[responder delegate] isKindOfClass:[NSResponder class]]) ? [responder delegate] : nil; + } + + success = [self makeFirstResponder:nil]; + + // Return first responder status. + if (success && responder != nil) + { + [self makeFirstResponder:responder]; + } + + return success; +} + +- (void)HB_forceEndEditing; +{ + [self endEditingFor:nil]; +} + + @end |