mirror of
https://github.com/mpv-player/mpv
synced 2025-02-18 13:47:04 +00:00
cocoa_common: implement mouse movement notifications
Notify the core of mouse movement events. The coordinates are converted to a coordinate system with the origin in upper left corner, since Cocoa has it in the lower left corner.
This commit is contained in:
parent
8fe357380e
commit
ea8a8af3ec
@ -829,6 +829,16 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
|
||||
{
|
||||
if (self.videoOutput->opts->fs)
|
||||
vo_cocoa_display_cursor(self.videoOutput, 1);
|
||||
|
||||
NSView *view = self.contentView;
|
||||
NSPoint loc = [view convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
NSRect bounds = [view bounds];
|
||||
|
||||
int x = loc.x;
|
||||
int y = - loc.y + bounds.size.height; // convert to x11-like coord system
|
||||
if (CGRectContainsPoint(bounds, NSMakePoint(x, y))) {
|
||||
vo_mouse_movement(self.videoOutput, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mouseDragged:(NSEvent *)theEvent
|
||||
|
Loading…
Reference in New Issue
Block a user