cocoa_common: override core's cursor visibility state

This keeps the state in sync with the current state in cocoa_common. Infact the
cocoa code in mpv can decide wether it really wants to hide the cursor based on
the result of the `canHideCursor` method (this is so that the cursor is only
hidden when hovering on the video window).
This commit is contained in:
Stefano Pigozzi 2013-09-18 08:34:28 +02:00
parent fc74574df0
commit a08802016d
1 changed files with 5 additions and 3 deletions

View File

@ -164,14 +164,16 @@ int vo_cocoa_init(struct vo *vo)
return 1;
}
static void vo_cocoa_set_cursor_visibility(struct vo *vo, bool visible)
static void vo_cocoa_set_cursor_visibility(struct vo *vo, bool *visible)
{
struct vo_cocoa_state *s = vo->cocoa;
if (visible) {
if (*visible) {
CGDisplayShowCursor(kCGDirectMainDisplay);
} else if ([s->view canHideCursor]) {
CGDisplayHideCursor(kCGDirectMainDisplay);
} else {
*visible = true;
}
}
@ -545,7 +547,7 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
vo_cocoa_update_screen_info(vo);
return VO_TRUE;
case VOCTRL_SET_CURSOR_VISIBILITY:
vo_cocoa_set_cursor_visibility(vo, *(bool *)arg);
vo_cocoa_set_cursor_visibility(vo, arg);
return VO_TRUE;
case VOCTRL_UPDATE_WINDOW_TITLE: {
cocoa_set_window_title(vo, (const char *) arg);