From ddf98f7a3b22e255b4414b889eeb4ea973643587 Mon Sep 17 00:00:00 2001 From: Dzmitry Neviadomski Date: Fri, 8 Jan 2021 09:35:41 +0300 Subject: [PATCH] Fix Volume Slider popover reattaching to window. --- Window/VolumeButton.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Window/VolumeButton.m b/Window/VolumeButton.m index 9faa93c23..c60005544 100644 --- a/Window/VolumeButton.m +++ b/Window/VolumeButton.m @@ -11,15 +11,12 @@ @implementation VolumeButton { NSPopover *popover; + NSViewController *viewController; } - (void)awakeFromNib { popover = [[NSPopover alloc] init]; - - NSViewController * viewController = [[NSViewController alloc] init]; - viewController.view = _popView; - popover.contentViewController = viewController; popover.behavior = NSPopoverBehaviorTransient; [popover setContentSize:_popView.bounds.size]; } @@ -42,7 +39,12 @@ - (void)mouseDown:(NSEvent *)theEvent { - [_popView hideToolTip]; + [popover close]; + + viewController = [[NSViewController alloc] init]; + viewController.view = _popView; + popover.contentViewController = viewController; + [popover showRelativeToRect:self.bounds ofView:self preferredEdge:NSRectEdgeMaxY]; [super mouseDown:theEvent];