mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
[macOS] Fix global popover clipping. (#3264)
* [macOS] Fix global popover clipping. Fixes #3263 * [macOS] Detach global popover via ugly hack.
This commit is contained in:
parent
955091ce12
commit
f8264ce957
2 changed files with 18 additions and 2 deletions
|
@ -248,6 +248,7 @@ typedef NS_ENUM(unsigned int, addType) { //
|
|||
@property(nonatomic) URLSheetWindowController* fUrlSheetController;
|
||||
|
||||
@property(nonatomic) BOOL fGlobalPopoverShown;
|
||||
@property(nonatomic) NSView* fPositioningView;
|
||||
@property(nonatomic) BOOL fSoundPlaying;
|
||||
@property(nonatomic) id fNoNapActivity;
|
||||
|
||||
|
|
|
@ -3100,7 +3100,21 @@ static void removeKeRangerRansomware()
|
|||
popover.delegate = self;
|
||||
|
||||
NSView* senderView = sender;
|
||||
[popover showRelativeToRect:senderView.frame ofView:senderView preferredEdge:NSMaxYEdge];
|
||||
CGFloat width = NSWidth(senderView.frame);
|
||||
|
||||
if (NSMinX(self.fWindow.frame) < width || NSMaxX(self.fWindow.screen.frame) - NSMinX(self.fWindow.frame) < width * 2)
|
||||
{
|
||||
// Ugly hack to hide NSPopover arrow.
|
||||
self.fPositioningView = [[NSView alloc] initWithFrame:senderView.bounds];
|
||||
self.fPositioningView.identifier = @"positioningView";
|
||||
[senderView 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:senderView.frame ofView:senderView preferredEdge:NSMaxYEdge];
|
||||
}
|
||||
}
|
||||
|
||||
//don't show multiple popovers when clicking the gear button repeatedly
|
||||
|
@ -3109,8 +3123,9 @@ static void removeKeRangerRansomware()
|
|||
self.fGlobalPopoverShown = YES;
|
||||
}
|
||||
|
||||
- (void)popoverWillClose:(NSNotification*)notification
|
||||
- (void)popoverDidClose:(NSNotification*)notification
|
||||
{
|
||||
[self.fPositioningView removeFromSuperview];
|
||||
self.fGlobalPopoverShown = NO;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue