summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-10-25 19:08:06 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-10-25 20:01:32 +0200
commitbc49957458870cc9fb19a3450f26ba625ade1e54 (patch)
tree83f2b527ef2b85c302d224aded81ca0f65df9a5c /video
parent607892b741cf8d8f73923cf874ecd7518ed74337 (diff)
downloadmpv-bc49957458870cc9fb19a3450f26ba625ade1e54.tar.bz2
mpv-bc49957458870cc9fb19a3450f26ba625ade1e54.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.
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa/window.m7
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;
}