Fix Volume Slider popover reattaching to window.

CQTexperiment
Dzmitry Neviadomski 2021-01-08 09:35:41 +03:00
parent 0fdabd55dd
commit ddf98f7a3b
1 changed files with 7 additions and 5 deletions

View File

@ -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];