Commit ef8cc371 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Forward port of revision 12566: Ignore menu select|right|left|up|down when OSD Menu is not visible

parent 266e4aa0
...@@ -402,7 +402,7 @@ static inline void osd_SetMenuVisible( osd_menu_t *p_osd, vlc_bool_t b_value ) ...@@ -402,7 +402,7 @@ static inline void osd_SetMenuVisible( osd_menu_t *p_osd, vlc_bool_t b_value )
static inline void osd_SetMenuUpdate( osd_menu_t *p_osd, vlc_bool_t b_value ) static inline void osd_SetMenuUpdate( osd_menu_t *p_osd, vlc_bool_t b_value )
{ {
vlc_value_t val; vlc_value_t val;
val.b_bool = p_osd->p_state->b_update = b_value; val.b_bool = p_osd->p_state->b_update = b_value;
var_Set( p_osd, "osd-menu-update", val ); var_Set( p_osd, "osd-menu-update", val );
} }
......
...@@ -40,6 +40,15 @@ ...@@ -40,6 +40,15 @@
static void osd_UpdateState( osd_menu_state_t *, int, int, int, int, picture_t * ); static void osd_UpdateState( osd_menu_state_t *, int, int, int, int, picture_t * );
static inline osd_state_t *osd_VolumeStateChange( osd_state_t *, int ); static inline osd_state_t *osd_VolumeStateChange( osd_state_t *, int );
static int osd_VolumeStep( vlc_object_t *, int, int ); static int osd_VolumeStep( vlc_object_t *, int, int );
static vlc_bool_t osd_isVisible( osd_menu_t *p_osd );
static vlc_bool_t osd_isVisible( osd_menu_t *p_osd )
{
vlc_value_t val;
var_Get( p_osd, "osd-menu-visible", &val );
return val.b_bool;
}
/***************************************************************************** /*****************************************************************************
* OSD menu Funtions * OSD menu Funtions
...@@ -256,16 +265,22 @@ void __osd_MenuActivate( vlc_object_t *p_this ) ...@@ -256,16 +265,22 @@ void __osd_MenuActivate( vlc_object_t *p_this )
osd_menu_t *p_osd = NULL; osd_menu_t *p_osd = NULL;
osd_button_t *p_button = NULL; osd_button_t *p_button = NULL;
vlc_value_t lockval; vlc_value_t lockval;
if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
{ {
msg_Err( p_this, "osd_MenuNext failed" ); msg_Err( p_this, "osd_MenuNext failed" );
return; return;
} }
if( osd_isVisible( p_osd ) == VLC_FALSE )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
}
var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
vlc_mutex_lock( lockval.p_address ); vlc_mutex_lock( lockval.p_address );
#if defined(OSD_MENU_DEBUG) #if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "select" ); msg_Dbg( p_osd, "select" );
#endif #endif
...@@ -279,9 +294,9 @@ void __osd_MenuActivate( vlc_object_t *p_this ) ...@@ -279,9 +294,9 @@ void __osd_MenuActivate( vlc_object_t *p_this )
vlc_mutex_unlock( lockval.p_address ); vlc_mutex_unlock( lockval.p_address );
__osd_MenuUp( p_this ); /* "menu select" means go to menu item above. */ __osd_MenuUp( p_this ); /* "menu select" means go to menu item above. */
return; return;
} }
if( p_button && p_button->p_down) if( p_button && p_button->p_down)
{ {
vlc_object_release( (vlc_object_t*) p_osd ); vlc_object_release( (vlc_object_t*) p_osd );
vlc_mutex_unlock( lockval.p_address ); vlc_mutex_unlock( lockval.p_address );
__osd_MenuDown( p_this ); /* "menu select" means go to menu item below. */ __osd_MenuDown( p_this ); /* "menu select" means go to menu item below. */
...@@ -304,24 +319,30 @@ void __osd_MenuActivate( vlc_object_t *p_this ) ...@@ -304,24 +319,30 @@ void __osd_MenuActivate( vlc_object_t *p_this )
#endif #endif
} }
vlc_object_release( (vlc_object_t*) p_osd ); vlc_object_release( (vlc_object_t*) p_osd );
vlc_mutex_unlock( lockval.p_address ); vlc_mutex_unlock( lockval.p_address );
} }
void __osd_MenuNext( vlc_object_t *p_this ) void __osd_MenuNext( vlc_object_t *p_this )
{ {
osd_menu_t *p_osd = NULL; osd_menu_t *p_osd = NULL;
osd_button_t *p_button = NULL; osd_button_t *p_button = NULL;
vlc_value_t lockval; vlc_value_t lockval;
if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
{ {
msg_Err( p_this, "osd_MenuNext failed" ); msg_Err( p_this, "osd_MenuNext failed" );
return; return;
} }
if( osd_isVisible( p_osd ) == VLC_FALSE )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
}
var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
vlc_mutex_lock( lockval.p_address ); vlc_mutex_lock( lockval.p_address );
p_button = p_osd->p_state->p_visible; p_button = p_osd->p_state->p_visible;
if( p_button ) if( p_button )
{ {
...@@ -331,11 +352,11 @@ void __osd_MenuNext( vlc_object_t *p_this ) ...@@ -331,11 +352,11 @@ void __osd_MenuNext( vlc_object_t *p_this )
p_osd->p_state->p_visible = p_button->p_next; p_osd->p_state->p_visible = p_button->p_next;
else else
p_osd->p_state->p_visible = p_osd->p_button; p_osd->p_state->p_visible = p_osd->p_button;
if( !p_osd->p_state->p_visible->b_range ) if( !p_osd->p_state->p_visible->b_range )
p_osd->p_state->p_visible->p_current_state = p_osd->p_state->p_visible->p_current_state =
osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT ); osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
osd_UpdateState( p_osd->p_state, osd_UpdateState( p_osd->p_state,
p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y, p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch, p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
...@@ -344,9 +365,9 @@ void __osd_MenuNext( vlc_object_t *p_this ) ...@@ -344,9 +365,9 @@ void __osd_MenuNext( vlc_object_t *p_this )
osd_SetMenuUpdate( p_osd, VLC_TRUE ); osd_SetMenuUpdate( p_osd, VLC_TRUE );
} }
#if defined(OSD_MENU_DEBUG) #if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "direction right [button %s]", p_osd->p_state->p_visible->psz_action ); msg_Dbg( p_osd, "direction right [button %s]", p_osd->p_state->p_visible->psz_action );
#endif #endif
vlc_object_release( (vlc_object_t*) p_osd ); vlc_object_release( (vlc_object_t*) p_osd );
vlc_mutex_unlock( lockval.p_address ); vlc_mutex_unlock( lockval.p_address );
} }
...@@ -356,30 +377,36 @@ void __osd_MenuPrev( vlc_object_t *p_this ) ...@@ -356,30 +377,36 @@ void __osd_MenuPrev( vlc_object_t *p_this )
osd_menu_t *p_osd = NULL; osd_menu_t *p_osd = NULL;
osd_button_t *p_button = NULL; osd_button_t *p_button = NULL;
vlc_value_t lockval; vlc_value_t lockval;
if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
{ {
msg_Err( p_this, "osd_MenuPrev failed" ); msg_Err( p_this, "osd_MenuPrev failed" );
return; return;
} }
if( osd_isVisible( p_osd ) == VLC_FALSE )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
}
var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
vlc_mutex_lock( lockval.p_address ); vlc_mutex_lock( lockval.p_address );
p_button = p_osd->p_state->p_visible; p_button = p_osd->p_state->p_visible;
if( p_button ) if( p_button )
{ {
if( !p_button->b_range ) if( !p_button->b_range )
p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_UNSELECT ); p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_UNSELECT );
if( p_button->p_prev ) if( p_button->p_prev )
p_osd->p_state->p_visible = p_button->p_prev; p_osd->p_state->p_visible = p_button->p_prev;
else else
p_osd->p_state->p_visible = p_osd->p_last_button; p_osd->p_state->p_visible = p_osd->p_last_button;
if( !p_osd->p_state->p_visible->b_range ) if( !p_osd->p_state->p_visible->b_range )
p_osd->p_state->p_visible->p_current_state = p_osd->p_state->p_visible->p_current_state =
osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT ); osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
osd_UpdateState( p_osd->p_state, osd_UpdateState( p_osd->p_state,
p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y, p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch, p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
...@@ -388,9 +415,9 @@ void __osd_MenuPrev( vlc_object_t *p_this ) ...@@ -388,9 +415,9 @@ void __osd_MenuPrev( vlc_object_t *p_this )
osd_SetMenuUpdate( p_osd, VLC_TRUE ); osd_SetMenuUpdate( p_osd, VLC_TRUE );
} }
#if defined(OSD_MENU_DEBUG) #if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "direction left [button %s]", p_osd->p_state->p_visible->psz_action ); msg_Dbg( p_osd, "direction left [button %s]", p_osd->p_state->p_visible->psz_action );
#endif #endif
vlc_object_release( (vlc_object_t*) p_osd ); vlc_object_release( (vlc_object_t*) p_osd );
vlc_mutex_unlock( lockval.p_address ); vlc_mutex_unlock( lockval.p_address );
} }
...@@ -400,16 +427,22 @@ void __osd_MenuUp( vlc_object_t *p_this ) ...@@ -400,16 +427,22 @@ void __osd_MenuUp( vlc_object_t *p_this )
osd_menu_t *p_osd = NULL; osd_menu_t *p_osd = NULL;
osd_button_t *p_button = NULL; osd_button_t *p_button = NULL;
vlc_value_t lockval; vlc_value_t lockval;
#if defined(OSD_MENU_DEBUG) #if defined(OSD_MENU_DEBUG)
vlc_value_t val; vlc_value_t val;
#endif #endif
if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL ) if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
{ {
msg_Err( p_this, "osd_MenuDown failed" ); msg_Err( p_this, "osd_MenuDown failed" );
return; return;
} }
if( osd_isVisible( p_osd ) == VLC_FALSE )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
}
var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
vlc_mutex_lock( lockval.p_address ); vlc_mutex_lock( lockval.p_address );
...@@ -420,21 +453,21 @@ void __osd_MenuUp( vlc_object_t *p_this ) ...@@ -420,21 +453,21 @@ void __osd_MenuUp( vlc_object_t *p_this )
{ {
p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_SELECT ); p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_SELECT );
if( p_button->p_up ) if( p_button->p_up )
p_osd->p_state->p_visible = p_button->p_up; p_osd->p_state->p_visible = p_button->p_up;
} }
if( p_button->b_range && p_osd->p_state->p_visible->b_range ) if( p_button->b_range && p_osd->p_state->p_visible->b_range )
{ {
osd_state_t *p_temp = p_osd->p_state->p_visible->p_current_state; osd_state_t *p_temp = p_osd->p_state->p_visible->p_current_state;
if( p_temp && p_temp->p_next ) if( p_temp && p_temp->p_next )
p_osd->p_state->p_visible->p_current_state = p_temp->p_next; p_osd->p_state->p_visible->p_current_state = p_temp->p_next;
} }
else if( !p_osd->p_state->p_visible->b_range ) else if( !p_osd->p_state->p_visible->b_range )
{ {
p_osd->p_state->p_visible->p_current_state = p_osd->p_state->p_visible->p_current_state =
osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT ); osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
} }
osd_UpdateState( p_osd->p_state, osd_UpdateState( p_osd->p_state,
p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y, p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch, p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
...@@ -453,9 +486,9 @@ void __osd_MenuUp( vlc_object_t *p_this ) ...@@ -453,9 +486,9 @@ void __osd_MenuUp( vlc_object_t *p_this )
} }
} }
#if defined(OSD_MENU_DEBUG) #if defined(OSD_MENU_DEBUG)
msg_Dbg( p_osd, "direction up [button %s]", p_osd->p_state->p_visible->psz_action ); msg_Dbg( p_osd, "direction up [button %s]", p_osd->p_state->p_visible->psz_action );
#endif #endif
vlc_object_release( (vlc_object_t*) p_osd ); vlc_object_release( (vlc_object_t*) p_osd );
vlc_mutex_unlock( lockval.p_address ); vlc_mutex_unlock( lockval.p_address );
} }
...@@ -474,7 +507,13 @@ void __osd_MenuDown( vlc_object_t *p_this ) ...@@ -474,7 +507,13 @@ void __osd_MenuDown( vlc_object_t *p_this )
msg_Err( p_this, "osd_MenuDown failed" ); msg_Err( p_this, "osd_MenuDown failed" );
return; return;
} }
if( osd_isVisible( p_osd ) == VLC_FALSE )
{
vlc_object_release( (vlc_object_t*) p_osd );
return;
}
var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
vlc_mutex_lock( lockval.p_address ); vlc_mutex_lock( lockval.p_address );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment