diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-08-21 18:09:48 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-08-22 11:54:28 +0200 |
commit | acbf5e826a6edaa9a11c4e431660fbdb05f183b1 (patch) | |
tree | 07d165f4c2bc92d2470052a4732c85376c306a48 /video/out/cocoa_common.m | |
parent | 45365ad99fc096f1eebc27d1e40362ea12722924 (diff) | |
download | mpv-acbf5e826a6edaa9a11c4e431660fbdb05f183b1.tar.bz2 mpv-acbf5e826a6edaa9a11c4e431660fbdb05f183b1.tar.xz |
cocoa_common: fix window positioning with `--geometry`
Regression since ff3b98d11c. The window positioning code relied on the
visibleFrame's height without taking into account the dock's presence.
Also moved the constraining code to the proper method that overrides the
original NSWindow behaviour. This avoids having to check for border since the
constraining is performed by Cocoa only for titled windows.
Fixes #190
Diffstat (limited to 'video/out/cocoa_common.m')
-rw-r--r-- | video/out/cocoa_common.m | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index cc1c51355c..7b64619909 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -762,20 +762,15 @@ int vo_cocoa_cgl_color_size(struct vo *vo) 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)); - - struct vo *vo = self.videoOutput; - if (!(vo && !vo->opts->border)) { - NSRect s = [[self screen] visibleFrame]; - if (nf.origin.y + nf.size.height > s.origin.y + s.size.height) - nf.origin.y = s.size.height - nf.size.height; - } - [self setFrame:nf display:NO animate:NO]; } -- (NSRect)constrainFrameRect:(NSRect)rect toScreen:(NSScreen *)screen +- (NSRect)constrainFrameRect:(NSRect)nf toScreen:(NSScreen *)screen { - return rect; + NSRect s = [[self screen] visibleFrame]; + if (nf.origin.y + nf.size.height > s.origin.y + s.size.height) + nf.origin.y = s.origin.y + s.size.height - nf.size.height; + return nf; } @end |