Skip to content
Snippets Groups Projects
Commit 35f3dcb7 authored by George Nachman's avatar George Nachman
Browse files

When rolling a hotkey window in or out, do not animate it so that it begins or...

When rolling a hotkey window in or out, do not animate it so that it begins or ends (respectively) on another screen. When screens have their own spaces windows can't span displays and the setting of the initial/final frame does something unexpected (like choosing a different frame in a completely different place). Issue 5871.
parent 6c40a849
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -236,12 +236,29 @@ static NSString *const kArrangement = @"Arrangement";
return rect.origin;
}
 
- (BOOL)rect:(NSRect)rect intersectsAnyScreenExcept:(NSScreen *)allowedScreen {
return [[NSScreen screens] anyWithBlock:^BOOL(NSScreen *screen) {
if (screen == allowedScreen) {
return NO;
}
NSRect screenFrame = screen.frame;
return NSIntersectsRect(rect, screenFrame);
}];
}
- (void)rollInAnimatingInDirection:(iTermAnimationDirection)direction {
[self moveToPreferredScreen];
[self.windowController.window setFrameOrigin:[self hiddenOriginForScreen:self.windowController.screen]];
self.windowController.window.alphaValue = 0;
 
NSRect destination = [self preferredFrameForWindowController:self.windowController];
self.windowController.window.alphaValue = 0;
NSRect proposedHiddenRect = self.windowController.window.frame;
proposedHiddenRect.origin = [self hiddenOriginForScreen:self.windowController.screen];
if ([self rect:proposedHiddenRect intersectsAnyScreenExcept:self.windowController.window.screen]) {
[self.windowController.window setFrame:destination display:YES];
} else {
[self.windowController.window setFrameOrigin:proposedHiddenRect.origin];
}
[NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
[context setDuration:[iTermAdvancedSettingsModel hotkeyTermAnimationDuration]];
[context setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
Loading
Loading
@@ -259,6 +276,10 @@ static NSString *const kArrangement = @"Arrangement";
NSRect destination = source;
destination.origin = [self hiddenOriginForScreen:self.windowController.window.screen];
 
if ([self rect:destination intersectsAnyScreenExcept:self.windowController.window.screen]) {
destination = source;
}
[NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
[context setDuration:[iTermAdvancedSettingsModel hotkeyTermAnimationDuration]];
[context setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment