1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-04 10:38:13 +00:00

[macOS] Hide NSPopover Arrow for Torrent options. (#3294)

Fixes #3293
This commit is contained in:
Dzmitry Neviadomski 2022-06-15 21:53:23 +03:00 committed by GitHub
parent 0fa716742a
commit 57ed120a71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,6 +53,7 @@
@property(nonatomic) NSAnimation* fPiecesBarAnimation; @property(nonatomic) NSAnimation* fPiecesBarAnimation;
@property(nonatomic) BOOL fActionPopoverShown; @property(nonatomic) BOOL fActionPopoverShown;
@property(nonatomic) NSView* fPositioningView;
- (BOOL)pointInGroupStatusRect:(NSPoint)point; - (BOOL)pointInGroupStatusRect:(NSPoint)point;
@ -775,6 +776,22 @@
[popover showRelativeToRect:rect ofView:self preferredEdge:NSMaxYEdge]; [popover showRelativeToRect:rect ofView:self preferredEdge:NSMaxYEdge];
[infoViewController setInfoForTorrents:@[ torrent ]]; [infoViewController setInfoForTorrents:@[ torrent ]];
[infoViewController updateInfo]; [infoViewController updateInfo];
CGFloat width = NSWidth(rect);
if (NSMinX(self.window.frame) < width || NSMaxX(self.window.screen.frame) - NSMinX(self.window.frame) < 72)
{
// Ugly hack to hide NSPopover arrow.
self.fPositioningView = [[NSView alloc] initWithFrame:rect];
self.fPositioningView.identifier = @"positioningView";
[self addSubview:self.fPositioningView];
[popover showRelativeToRect:self.fPositioningView.bounds ofView:self.fPositioningView preferredEdge:NSMaxYEdge];
self.fPositioningView.bounds = NSOffsetRect(self.fPositioningView.bounds, 0, NSHeight(self.fPositioningView.bounds));
}
else
{
[popover showRelativeToRect:rect ofView:self preferredEdge:NSMaxYEdge];
}
} }
//don't show multiple popovers when clicking the gear button repeatedly //don't show multiple popovers when clicking the gear button repeatedly
@ -783,8 +800,10 @@
self.fActionPopoverShown = YES; self.fActionPopoverShown = YES;
} }
- (void)popoverWillClose:(NSNotification*)notification - (void)popoverDidClose:(NSNotification*)notification
{ {
[self.fPositioningView removeFromSuperview];
self.fPositioningView = nil;
self.fActionPopoverShown = NO; self.fActionPopoverShown = NO;
} }