Simplify if condition

This commit is contained in:
Kovid Goyal 2022-01-08 14:06:22 +05:30
parent 362c4147e4
commit ac0c10c170
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -1598,16 +1598,7 @@ - (void) removeGLFWWindow
- (BOOL)validateMenuItem:(NSMenuItem *)item {
if (item.action == @selector(performMiniaturize:)) return YES;
if (item.action == @selector(toggleSecureInput:)) {
SecureKeyboardEntryController *controller = [SecureKeyboardEntryController sharedInstance];
if (controller.isEnabled) {
if (controller.isDesired) {
item.state = NSControlStateValueOn;
} else {
item.state = NSControlStateValueMixed;
}
} else {
item.state = controller.isDesired ? NSControlStateValueOn : NSControlStateValueOff;
}
item.state = [SecureKeyboardEntryController sharedInstance].isDesired ? NSControlStateValueOn : NSControlStateValueOff;
return YES;
}
return [super validateMenuItem:item];