diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-10-28 08:28:01 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-02 19:03:50 +0100 |
commit | 1dbbd845a47a0008b79f99dced9a778189f9fd79 (patch) | |
tree | 20b7d74be42c7d621c58aa1f76f3c504aa8184e9 | |
parent | 131fad8bc94682fb81b6b331c9bf9e7aac09f1b7 (diff) | |
download | mpv-1dbbd845a47a0008b79f99dced9a778189f9fd79.tar.bz2 mpv-1dbbd845a47a0008b79f99dced9a778189f9fd79.tar.xz |
cocoa: apply the more invasive constraining only with cmd+1/2/3
Regression from bc49957
Fixes #321
-rw-r--r-- | video/out/cocoa/window.m | 12 |
1 files changed, 10 insertions, 2 deletions
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; |