From bc49957458870cc9fb19a3450f26ba625ade1e54 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 25 Oct 2013 19:08:06 +0200 Subject: 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. --- video/out/cocoa/window.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'video') 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 . */ +#include + #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; } -- cgit v1.2.3