mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 03:52:22 +02:00
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 39537f6474
)
This commit is contained in:
parent
18d3c2ab85
commit
710979e0e8
@ -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];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user