@@ -477,6 +477,17 @@ - (void)zoomWithRows:(int)rows columns:(int)cols state:(int)state
477
477
478
478
- (void )setTitle : (NSString *)title
479
479
{
480
+ // Save the original title, if we haven't already.
481
+ [lastSetTitle release ];
482
+ lastSetTitle = [title retain ];
483
+
484
+ // While in live resize the window title displays the dimensions of the
485
+ // window so don't clobber this with the new title. We have already set
486
+ // lastSetTitle above so once live resize is done we will set it back.
487
+ if ([vimView inLiveResize ]) {
488
+ return ;
489
+ }
490
+
480
491
if (!title)
481
492
return ;
482
493
@@ -579,40 +590,55 @@ - (void)refreshApperanceMode
579
590
// Transparent title bar setting
580
591
decoratedWindow.titlebarAppearsTransparent = [[NSUserDefaults standardUserDefaults ]
581
592
boolForKey: MMTitlebarAppearsTransparentKey];
593
+
594
+ // No title bar setting
595
+ if ([[NSUserDefaults standardUserDefaults ]
596
+ boolForKey: MMNoTitleBarWindowKey]) {
597
+ [decoratedWindow setStyleMask: ([decoratedWindow styleMask ] & ~NSWindowStyleMaskTitled)];
598
+ } else {
599
+ [decoratedWindow setStyleMask: ([decoratedWindow styleMask ] | NSWindowStyleMaskTitled)];
600
+ }
601
+
602
+ // Title may have been lost if we hid the title-bar. Reset it.
603
+ [self setTitle: lastSetTitle];
582
604
583
605
// Dark mode only works on 10.14+ because that's when dark mode was
584
606
// introduced.
585
607
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
586
608
if (@available (macos 10.14 , *)) {
609
+ NSAppearance * desiredAppearance;
587
610
switch ([[NSUserDefaults standardUserDefaults ] integerForKey: MMAppearanceModeSelectionKey])
588
611
{
589
612
case MMAppearanceModeSelectionLight:
590
613
{
591
- decoratedWindow. appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua ];
614
+ desiredAppearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua ];
592
615
break ;
593
616
}
594
617
case MMAppearanceModeSelectionDark:
595
618
{
596
- decoratedWindow. appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua ];
619
+ desiredAppearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua ];
597
620
break ;
598
621
}
599
622
case MMAppearanceModeSelectionBackgroundOption:
600
623
{
601
624
if (backgroundDark) {
602
- decoratedWindow. appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua ];
625
+ desiredAppearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua ];
603
626
} else {
604
- decoratedWindow. appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua ];
627
+ desiredAppearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua ];
605
628
}
606
629
break ;
607
630
}
608
631
case MMAppearanceModeSelectionAuto:
609
632
default :
610
633
{
611
634
// Use the system appearance. This will also auto-switch when OS changes mode.
612
- decoratedWindow. appearance = nil ;
635
+ desiredAppearance = nil ;
613
636
break ;
614
637
}
615
638
}
639
+
640
+ decoratedWindow.appearance = desiredAppearance;
641
+ fullScreenWindow.appearance = desiredAppearance;
616
642
}
617
643
#endif
618
644
}
@@ -821,11 +847,6 @@ - (void)liveResizeWillStart
821
847
{
822
848
if (!setupDone) return ;
823
849
824
- // Save the original title, if we haven't already.
825
- if (lastSetTitle == nil ) {
826
- lastSetTitle = [[decoratedWindow title ] retain ];
827
- }
828
-
829
850
// NOTE: During live resize Cocoa goes into "event tracking mode". We have
830
851
// to add the backend connection to this mode in order for resize messages
831
852
// from Vim to reach MacVim. We do not wish to always listen to requests
@@ -849,8 +870,6 @@ - (void)liveResizeDidEnd
849
870
// If we saved the original title while resizing, restore it.
850
871
if (lastSetTitle != nil ) {
851
872
[decoratedWindow setTitle: lastSetTitle];
852
- [lastSetTitle release ];
853
- lastSetTitle = nil ;
854
873
}
855
874
856
875
// If we are in the middle of rapid resize (e.g. double-clicking on the border/corner
0 commit comments