Skip to content

Commit 0aa5bef

Browse files
authored
Merge pull request #1088 from ychin/fix-titlebar-hidden-fullscreen-focus
Fix switching to fullscreen loses keyboard focus if titlebar is hidden
2 parents 8b25779 + 560fae4 commit 0aa5bef

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/MacVim/MMWindowController.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,11 @@ - (void)windowDidEnterFullScreen:(NSNotification *)notification
14191419
// full-screen using :fullscreen option (including Ctrl-Cmd-f).
14201420
[vimController sendMessage:BackingPropertiesChangedMsgID data:nil];
14211421
}
1422+
1423+
// Sometimes full screen will de-focus the text view. This seems to happen
1424+
// when titlebar is configured as hidden. Simply re-assert it to make sure
1425+
// text is still focused.
1426+
[decoratedWindow makeFirstResponder:[vimView textView]];
14221427
}
14231428

14241429
- (void)windowDidFailToEnterFullScreen:(NSWindow *)window
@@ -1436,6 +1441,11 @@ - (void)windowDidFailToEnterFullScreen:(NSWindow *)window
14361441
[[vimView tabBarControl] setStyleNamed:tabBarStyle];
14371442
[self updateTablineSeparator];
14381443
[window setFrame:preFullScreenFrame display:YES];
1444+
1445+
// Sometimes full screen will de-focus the text view. This seems to happen
1446+
// when titlebar is configured as hidden. Simply re-assert it to make sure
1447+
// text is still focused.
1448+
[decoratedWindow makeFirstResponder:[vimView textView]];
14391449
}
14401450

14411451
- (NSArray *)customWindowsToExitFullScreenForWindow:(NSWindow *)window
@@ -1500,6 +1510,11 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification
15001510
}
15011511

15021512
[self updateTablineSeparator];
1513+
1514+
// Sometimes full screen will de-focus the text view. This seems to happen
1515+
// when titlebar is configured as hidden. Simply re-assert it to make sure
1516+
// text is still focused.
1517+
[decoratedWindow makeFirstResponder:[vimView textView]];
15031518
}
15041519

15051520
- (void)windowDidFailToExitFullScreen:(NSWindow *)window
@@ -1515,6 +1530,11 @@ - (void)windowDidFailToExitFullScreen:(NSWindow *)window
15151530
[[vimView tabBarControl] setStyleNamed:tabBarStyle];
15161531
[self updateTablineSeparator];
15171532
[self maximizeWindow:fullScreenOptions];
1533+
1534+
// Sometimes full screen will de-focus the text view. This seems to happen
1535+
// when titlebar is configured as hidden. Simply re-assert it to make sure
1536+
// text is still focused.
1537+
[decoratedWindow makeFirstResponder:[vimView textView]];
15181538
}
15191539

15201540
#endif // (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)

0 commit comments

Comments
 (0)