diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-06-01 17:58:08 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-06-01 17:58:08 +0200 |
commit | f4dcb93be1ff35ebbaa03baf8e37976d2a622eb1 (patch) | |
tree | 2d4c68461df51821e9d73c57442fce51d52bb0b5 /video | |
parent | db7835f5d702f1f781cb29f4b23f12222fd3dd99 (diff) | |
download | mpv-f4dcb93be1ff35ebbaa03baf8e37976d2a622eb1.tar.bz2 mpv-f4dcb93be1ff35ebbaa03baf8e37976d2a622eb1.tar.xz |
cocoa_common: don't autohide mouse on mousedown
Previews code allowed to click the same spot for a long time and the cursor
would autohide. No more!
Diffstat (limited to 'video')
-rw-r--r-- | video/out/cocoa_common.m | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 8d6c270810..d74f508523 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -71,6 +71,7 @@ static bool RightAltPressed(NSEvent *event) @property(nonatomic, assign) struct vo *videoOutput; - (BOOL)containsCurrentMouseLocation; - (void)mouseEvent:(NSEvent *)theEvent; +@property(nonatomic, assign, getter=hasMouseDown) BOOL mouseDown; @end struct vo_cocoa_input_queue { @@ -218,7 +219,9 @@ static void vo_cocoa_set_cursor_visibility(struct vo *vo, bool visible) if (visible) { // show cursor unconditionally CGDisplayShowCursor(kCGDirectMainDisplay); - } else if (vo->opts->fs && [s->view containsCurrentMouseLocation]) { + } else if (vo->opts->fs && + [s->view containsCurrentMouseLocation] && + ![s->view hasMouseDown]) { // only hide cursor if in fullscreen and the video view contains the // mouse location CGDisplayHideCursor(kCGDirectMainDisplay); @@ -849,6 +852,7 @@ int vo_cocoa_cgl_color_size(struct vo *vo) @implementation GLMPlayerOpenGLView @synthesize videoOutput = _video_output; +@synthesize mouseDown = _mouse_down; - (BOOL)acceptsFirstResponder { return YES; } - (BOOL)becomeFirstResponder { return YES; } - (BOOL)resignFirstResponder { return YES; } @@ -961,18 +965,22 @@ int vo_cocoa_cgl_color_size(struct vo *vo) cocoa_async_put_key( s->input_queue, (MP_MOUSE_BTN0 + buttonNumber) | MP_KEY_STATE_DOWN); + self.mouseDown = YES; // Looks like Cocoa doesn't create MouseUp events when we are // doing the second click in a double click. Put in the key_fifo // the key that would be put from the MouseUp handling code. - if([theEvent clickCount] == 2) + if([theEvent clickCount] == 2) { cocoa_async_put_key(s->input_queue, MP_MOUSE_BTN0 + buttonNumber); + self.mouseDown = NO; + } break; case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: cocoa_async_put_key(s->input_queue, MP_MOUSE_BTN0 + buttonNumber); + self.mouseDown = NO; break; } } |