From e4d23dd01d68e2ef0f0ffd4f49277afb15432208 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 28 Oct 2013 08:28:01 +0100 Subject: cocoa: apply the more invasive constraining only with cmd+1/2/3 Regression from bc49957 Fixes #321 --- video/out/cocoa/window.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m index e474292324..97f5af1dd9 100644 --- a/video/out/cocoa/window.m +++ b/video/out/cocoa/window.m @@ -31,6 +31,7 @@ @implementation MpvVideoWindow { NSSize _queued_video_size; bool _fs_resize_scheduled; + bool _recenter_window_during_constraint; } @synthesize adapter = _adapter; @@ -117,6 +118,7 @@ CGFloat dx = (f.size.width - ns.width) / 2; CGFloat dy = (f.size.height - ns.height - [self titleHeight]) / 2; NSRect nf = NSRectFromCGRect(CGRectInset(NSRectToCGRect(f), dx, dy)); + self->_recenter_window_during_constraint = true; [self setFrame:nf display:NO animate:NO]; } @@ -124,13 +126,19 @@ { NSRect s = [[self screen] visibleFrame]; if (nf.origin.y + nf.size.height > s.origin.y + s.size.height) { - nf.size.height = s.size.height; + if (self->_recenter_window_during_constraint) + nf.size.height = s.size.height; nf.origin.y = s.origin.y + s.size.height - nf.size.height; } - return nf; } +- (void)setFrame:(NSRect)frame display:(BOOL)display animate:(BOOL)animate +{ + [super setFrame:frame display:display animate:animate]; + self->_recenter_window_during_constraint = false; +} + - (void)queueNewVideoSize:(NSSize)new_size { NSSize prev_size = self->_queued_video_size; -- cgit v1.2.3