diff options
author | torque <torque@1> | 2015-02-21 19:12:31 -0800 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-03-11 12:49:39 +0900 |
commit | 710979e0e85d8ed4eea55f23e60a56d2e4de03f8 (patch) | |
tree | 20ef0ac2b92c746ee6030b0b95ba30daa4ffd7d7 | |
parent | 18d3c2ab85c6b860d174ec9e5805c025941d00d5 (diff) | |
download | mpv-710979e0e85d8ed4eea55f23e60a56d2e4de03f8.tar.bz2 mpv-710979e0e85d8ed4eea55f23e60a56d2e4de03f8.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.
(cherry picked from commit 39537f64746d8e0ea0f828efee251fb84acdf11f)
-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 6dc9236c49..30fca1a332 100644 --- a/video/out/cocoa/events_view.m +++ b/video/out/cocoa/events_view.m @@ -206,6 +206,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]; } |