summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authortorque <torque@1>2015-02-21 19:12:31 -0800
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2015-03-07 19:32:02 +0100
commit39537f64746d8e0ea0f828efee251fb84acdf11f (patch)
tree48e3c8cea76e32b0cf324e434e0aea9ddb78706a /video/out
parentbce753060eb9fb99ebc64fb6027d130a37b918a6 (diff)
downloadmpv-39537f64746d8e0ea0f828efee251fb84acdf11f.tar.bz2
mpv-39537f64746d8e0ea0f828efee251fb84acdf11f.tar.xz
cocoa: clamp mouse position to window.
Prevents out-of-window coordinates being reported for mouse coordinates. Previously they could be out-of-window coordinates on init or on resize.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/cocoa/events_view.m2
1 files changed, 2 insertions, 0 deletions
diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m
index 20d1307abf..7c8283ad72 100644
--- a/video/out/cocoa/events_view.m
+++ b/video/out/cocoa/events_view.m
@@ -209,6 +209,8 @@
- (void)signalMousePosition
{
NSPoint p = [self convertPointToPixels:[self mouseLocation]];
+ p.x = MIN(MAX(p.x, 0), self.bounds.size.width-1);
+ p.y = MIN(MAX(p.y, 0), self.bounds.size.height-1);
[self.adapter signalMouseMovement:p];
}