mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
bce753060e
commit
39537f6474
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue