From 5882affd3fabaa576448b3143970053e3b7cca9c Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Thu, 20 Oct 2022 21:28:02 -0700 Subject: [PATCH] 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 --- Window/VolumeButton.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Window/VolumeButton.m b/Window/VolumeButton.m index b70903492..8224d4386 100644 --- a/Window/VolumeButton.m +++ b/Window/VolumeButton.m @@ -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];