diff options
author | torque <torque@1> | 2015-02-21 19:12:31 -0800 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2015-03-07 19:32:02 +0100 |
commit | 39537f64746d8e0ea0f828efee251fb84acdf11f (patch) | |
tree | 48e3c8cea76e32b0cf324e434e0aea9ddb78706a /video | |
parent | bce753060eb9fb99ebc64fb6027d130a37b918a6 (diff) | |
download | mpv-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')
-rw-r--r-- | video/out/cocoa/events_view.m | 2 |
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]; } |