Always create new ContentViewController for volume

This is needed to re-parent the VolumeSlider window, as there is only a
single VolumeSlider, but two different VolumeButtons and their
respective NSPopover windows. So, always recreate the view on open,
which doesn't appear to have a noticeable impact on performance.

Fixes #331

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
xcode15
Christopher Snowhill 2022-10-20 21:28:02 -07:00
parent bc66220b36
commit 0d7fd92c82
1 changed files with 4 additions and 5 deletions

View File

@ -38,11 +38,10 @@
- (void)mouseDown:(NSEvent *)theEvent {
[popover close];
if(!viewController) {
viewController = [[NSViewController alloc] init];
viewController.view = _popView;
popover.contentViewController = viewController;
}
popover.contentViewController = nil;
viewController = [[NSViewController alloc] init];
viewController.view = _popView;
popover.contentViewController = viewController;
[popover showRelativeToRect:self.bounds ofView:self preferredEdge:NSRectEdgeMaxY];