зеркало из https://github.com/github/Rebel.git
Merge remote-tracking branch 'origin/master' into autolayout
This commit is contained in:
Коммит
c3c8a99cc2
|
@ -330,7 +330,8 @@ static CGFloat RBLRectsGetMedianY(CGRect r1, CGRect r2) {
|
||||||
if (strongSelf.behavior == RBLPopoverBehaviorTransient) {
|
if (strongSelf.behavior == RBLPopoverBehaviorTransient) {
|
||||||
shouldClose = !mouseInPopoverWindow;
|
shouldClose = !mouseInPopoverWindow;
|
||||||
} else {
|
} else {
|
||||||
shouldClose = strongSelf.popoverWindow.parentWindow.isKeyWindow && NSPointInRect(NSEvent.mouseLocation, strongSelf.popoverWindow.parentWindow.frame) && !mouseInPopoverWindow;
|
BOOL inParentWindow = NSPointInRect(NSEvent.mouseLocation, strongSelf.popoverWindow.parentWindow.frame);
|
||||||
|
shouldClose = strongSelf.popoverWindow.parentWindow.isKeyWindow && inParentWindow && !mouseInPopoverWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldClose) [strongSelf close];
|
if (shouldClose) [strongSelf close];
|
||||||
|
@ -385,7 +386,17 @@ static CGFloat RBLRectsGetMedianY(CGRect r1, CGRect r2) {
|
||||||
closeButton.action = @selector(performClose:);
|
closeButton.action = @selector(performClose:);
|
||||||
[self.popoverWindow.contentView addSubview:closeButton];
|
[self.popoverWindow.contentView addSubview:closeButton];
|
||||||
|
|
||||||
[positioningView.window addChildWindow:self.popoverWindow ordered:NSWindowAbove];
|
NSWindow *topmostParentWindow = positioningView.window;
|
||||||
|
while (topmostParentWindow.parentWindow != nil) {
|
||||||
|
topmostParentWindow = topmostParentWindow.parentWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.behavior != RBLPopoverBehaviorApplicationDefined) {
|
||||||
|
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(fullScreenChanged:) name:NSWindowWillEnterFullScreenNotification object:topmostParentWindow];
|
||||||
|
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(fullScreenChanged:) name:NSWindowWillExitFullScreenNotification object:topmostParentWindow];
|
||||||
|
}
|
||||||
|
|
||||||
|
[topmostParentWindow addChildWindow:self.popoverWindow ordered:NSWindowAbove];
|
||||||
[self.popoverWindow makeKeyAndOrderFront:self];
|
[self.popoverWindow makeKeyAndOrderFront:self];
|
||||||
|
|
||||||
void (^postDisplayBlock)(void) = ^{
|
void (^postDisplayBlock)(void) = ^{
|
||||||
|
@ -443,12 +454,23 @@ static CGFloat RBLRectsGetMedianY(CGRect r1, CGRect r2) {
|
||||||
self.transientEventMonitors = nil;
|
self.transientEventMonitors = nil;
|
||||||
[NSNotificationCenter.defaultCenter removeObserver:self name:NSApplicationDidResignActiveNotification object:NSApp];
|
[NSNotificationCenter.defaultCenter removeObserver:self name:NSApplicationDidResignActiveNotification object:NSApp];
|
||||||
[NSNotificationCenter.defaultCenter removeObserver:self name:NSWindowDidResignKeyNotification object:nil];
|
[NSNotificationCenter.defaultCenter removeObserver:self name:NSWindowDidResignKeyNotification object:nil];
|
||||||
|
[NSNotificationCenter.defaultCenter removeObserver:self name:NSWindowWillEnterFullScreenNotification object:nil];
|
||||||
|
[NSNotificationCenter.defaultCenter removeObserver:self name:NSWindowWillExitFullScreenNotification object:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)appResignedActive:(NSNotification *)notification {
|
- (void)appResignedActive:(NSNotification *)notification {
|
||||||
if (self.behavior == RBLPopoverBehaviorTransient) [self close];
|
if (self.behavior == RBLPopoverBehaviorTransient) [self close];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)fullScreenChanged:(NSNotification *)notification {
|
||||||
|
// Turn off animations. We want the close to be instantaneous since the
|
||||||
|
// parent window's going to be animating too.
|
||||||
|
BOOL shouldAnimate = self.animates;
|
||||||
|
self.animates = NO;
|
||||||
|
[self close];
|
||||||
|
self.animates = shouldAnimate;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
|
Загрузка…
Ссылка в новой задаче