diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-05-17 00:36:06 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-26 16:44:19 +0200 |
commit | ea8a8af3ec096b61219588d6b8ddcb9b61ee20f1 (patch) | |
tree | 67f59ba38a05376c9002f34bfe33e55addd83c1a /video | |
parent | 8fe357380ee9c784deb67423f8debbe5b5524016 (diff) | |
download | mpv-ea8a8af3ec096b61219588d6b8ddcb9b61ee20f1.tar.bz2 mpv-ea8a8af3ec096b61219588d6b8ddcb9b61ee20f1.tar.xz |
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.
Diffstat (limited to 'video')
-rw-r--r-- | video/out/cocoa_common.m | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 6f618c296c..9af5922cf1 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -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 |