Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/MacVim/MMVimController.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ - (void)handleBrowseForFile:(NSDictionary *)attr;
- (void)handleShowDialog:(NSDictionary *)attr;
- (void)handleDeleteSign:(NSDictionary *)attr;
- (void)setToolTipDelay:(NSTimeInterval)seconds;
- (void)themeChanged:(NSNotification *)notification;
- (void)themeChangedOnMainThread;
@end


Expand Down Expand Up @@ -201,6 +203,10 @@ - (id)initWithBackend:(id)backend pid:(int)processIdentifier
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification object:connection];

[NSDistributedNotificationCenter.defaultCenter addObserver:self
selector:@selector(themeChanged:)
name:@"AppleInterfaceThemeChangedNotification" object:nil];

// Set up a main menu with only a "MacVim" menu (copied from a template
// which itself is set up in MainMenu.nib). The main menu is populated
// by Vim later on.
Expand All @@ -224,7 +230,7 @@ - (id)initWithBackend:(id)backend pid:(int)processIdentifier

// After MMVimController's initialization is completed,
// set up the variable `v:os_appearance`.
[self appearanceChanged:getCurrentAppearance([windowController vimView].effectiveAppearance)];
[self appearanceChanged:getCurrentAppearance(NSApp.effectiveAppearance)];

return self;
}
Expand Down Expand Up @@ -1910,6 +1916,14 @@ - (void)setToolTipDelay:(NSTimeInterval)seconds
}
}

- (void)themeChanged:(NSNotification *)notification {
[self performSelectorOnMainThread:@selector(themeChangedOnMainThread) withObject:nil waitUntilDone:false];
}

- (void)themeChangedOnMainThread {
[self appearanceChanged:getCurrentAppearance(NSApp.effectiveAppearance)];
}

@end // MMVimController (Private)


Expand Down
4 changes: 0 additions & 4 deletions src/MacVim/MMVimView.m
Original file line number Diff line number Diff line change
Expand Up @@ -664,10 +664,6 @@ - (void)setFrame:(NSRect)frame
[self frameSizeMayHaveChanged:NO];
}

- (void)viewDidChangeEffectiveAppearance
{
[vimController appearanceChanged:getCurrentAppearance(self.effectiveAppearance)];
}
@end // MMVimView


Expand Down