Skip to content

Commit 2c1841d

Browse files
committed
Report focus change on window key (not main)
MacVim should report FocusGained and FocusLost events not just when its windows become main, but when they become key -- if a panel is opened, or a background application (i.e. an LSUIElement app) becomes active, MacVim should reflect the focus state.
1 parent 87243e3 commit 2c1841d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/MacVim/MMWindowController.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,15 +969,19 @@ - (BOOL)validateMenuItem:(NSMenuItem *)item
969969
- (void)windowDidBecomeMain:(NSNotification *)notification
970970
{
971971
[[MMAppController sharedInstance] setMainMenu:[vimController mainMenu]];
972-
[vimController sendMessage:GotFocusMsgID data:nil];
973972

974973
if ([vimView textView]) {
975974
NSFontManager *fm = [NSFontManager sharedFontManager];
976975
[fm setSelectedFont:[[vimView textView] font] isMultiple:NO];
977976
}
978977
}
979978

980-
- (void)windowDidResignMain:(NSNotification *)notification
979+
- (void)windowDidBecomeKey:(NSNotificationCenter *)notification
980+
{
981+
[vimController sendMessage:GotFocusMsgID data:nil];
982+
}
983+
984+
- (void)windowDidResignKey:(NSNotification *)notification
981985
{
982986
[vimController sendMessage:LostFocusMsgID data:nil];
983987
}

0 commit comments

Comments
 (0)