Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic behind Mac theme variant inference #1109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/MacVim/MMVimController.m
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
Expand Up @@ -664,10 +664,6 @@ - (void)setFrame:(NSRect)frame
[self frameSizeMayHaveChanged:NO];
}

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


Expand Down