diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-10-25 19:08:06 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-02 19:02:26 +0100 |
commit | cb355443dc62d89d064dc1a8062092310014a1ef (patch) | |
tree | ffb45bc80d12767a49ec14048054de25b0e355f9 | |
parent | cc2b5c16fa018987bafa9066890ead11a4c4f34f (diff) | |
download | mpv-cb355443dc62d89d064dc1a8062092310014a1ef.tar.bz2 mpv-cb355443dc62d89d064dc1a8062092310014a1ef.tar.xz |
cocoa: constraint the window position a little more
The intention of this is to not make the window go outside the screen when
changing dimensions from 2x to .5x.
-rw-r--r-- | video/out/cocoa/window.m | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m index fa51b8d82a..e474292324 100644 --- a/video/out/cocoa/window.m +++ b/video/out/cocoa/window.m @@ -15,6 +15,8 @@ * with mpv. If not, see <http://www.gnu.org/licenses/>. */ +#include <libavutil/common.h> + #include "mpvcore/input/keycodes.h" #include "osdep/macosx_application.h" @@ -121,8 +123,11 @@ - (NSRect)constrainFrameRect:(NSRect)nf toScreen:(NSScreen *)screen { NSRect s = [[self screen] visibleFrame]; - if (nf.origin.y + nf.size.height > s.origin.y + s.size.height) + if (nf.origin.y + nf.size.height > s.origin.y + s.size.height) { + nf.size.height = s.size.height; nf.origin.y = s.origin.y + s.size.height - nf.size.height; + } + return nf; } |