cocoa_common: remove most of the special handling for cursor autohide

This is mostly related to the fullscreen behaviour. cecbd8864 introduces an
option to make mpv behave like a OSX user would expect. This commit changes
the Cocoa parts of the code to be consistent with the behaviour on X11. Old
behaviour is still available through the option mentioned in cecbd8864.

There is still custom logic in the cocoa backend and it can probably be moved
to core:

  * Don't perform autohide if the mouse is down
  * Don't perform autohide outside of the video window

Fixes #218 (by accident)
This commit is contained in:
Stefano Pigozzi 2013-09-08 09:16:19 +02:00
parent 9f01797eac
commit 49849190dd
1 changed files with 3 additions and 17 deletions

View File

@ -179,7 +179,6 @@ void vo_cocoa_uninit(struct vo *vo)
{
dispatch_sync(dispatch_get_main_queue(), ^{
struct vo_cocoa_state *s = vo->cocoa;
vo_cocoa_set_cursor_visibility(vo, true);
enable_power_management(vo);
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
@ -545,11 +544,9 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
case VOCTRL_UPDATE_SCREENINFO:
vo_cocoa_update_screen_info(vo);
return VO_TRUE;
case VOCTRL_SET_CURSOR_VISIBILITY: {
bool visible = *(bool *)arg;
vo_cocoa_set_cursor_visibility(vo, visible);
case VOCTRL_SET_CURSOR_VISIBILITY:
vo_cocoa_set_cursor_visibility(vo, *(bool *)arg);
return VO_TRUE;
}
case VOCTRL_UPDATE_WINDOW_TITLE: {
cocoa_set_window_title(vo, (const char *) arg);
return VO_TRUE;
@ -691,14 +688,6 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
[self toggleViewFullscreen:opts->fullscreen];
}
// Do common work such as setting mouse visibility and actually setting
// the new fullscreen state
if (opts->fullscreen) {
vo_cocoa_set_cursor_visibility(self.videoOutput, false);
} else {
vo_cocoa_set_cursor_visibility(self.videoOutput, true);
}
[s->view recalcDraggableState];
// Change window size if the core attempted to change it while we were in
@ -816,9 +805,7 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
- (BOOL)canHideCursor
{
struct vo *vo = self.videoOutput;
return vo->opts->fullscreen && !self->hasMouseDown &&
[self containsMouseLocation];
return !self->hasMouseDown && [self containsMouseLocation];
}
- (void)recalcDraggableState
@ -842,7 +829,6 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
- (void)mouseExited:(NSEvent *)event
{
cocoa_put_key(MP_KEY_MOUSE_LEAVE);
vo_cocoa_set_cursor_visibility(self.videoOutput, true);
}
- (void)signalMouseMovement:(NSEvent *)event