diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index 08510273c2907cfd946fd9898b7de4eb37cebbab..42090a658a01deafcdc99924521906d6c28639f1 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -73,6 +73,9 @@ static int Control ( vout_thread_t *, int, va_list ); static inline int GetAlignedSize( int ); +static int SendEvents( vlc_object_t *, char const *, + vlc_value_t, vlc_value_t, void * ); + /***************************************************************************** * Module descriptor *****************************************************************************/ @@ -170,6 +173,12 @@ static int CreateVout( vlc_object_t *p_this ) p_vout->pf_display = DisplayVideo; p_vout->pf_control = Control; + /* Forward events from the opengl provider */ + var_AddCallback( p_sys->p_vout, "mouse-x", SendEvents, p_vout ); + var_AddCallback( p_sys->p_vout, "mouse-y", SendEvents, p_vout ); + var_AddCallback( p_sys->p_vout, "mouse-moved", SendEvents, p_vout ); + var_AddCallback( p_sys->p_vout, "mouse-clicked", SendEvents, p_vout ); + return VLC_SUCCESS; } @@ -447,3 +456,12 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) else return vout_vaControlDefault( p_vout, i_query, args ); } + +/***************************************************************************** + * SendEvents: forward mouse and keyboard events to the parent p_vout + *****************************************************************************/ +static int SendEvents( vlc_object_t *p_this, char const *psz_var, + vlc_value_t oldval, vlc_value_t newval, void *_p_vout ) +{ + return var_Set( (vlc_object_t *)_p_vout, psz_var, newval ); +} diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 633c59437e8f8a9eae06da2941c9c0b0722d0823..cb8e0af0a6d6ee07f188e4f59c8e9b082c51ae90 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -290,17 +290,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, p_vout->pf_control = 0; p_vout->p_parent_intf = 0; - /* Mouse coordinates */ - var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER ); - var_Create( p_vout, "mouse-y", VLC_VAR_INTEGER ); - var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER ); - var_Create( p_vout, "mouse-moved", VLC_VAR_BOOL ); - var_Create( p_vout, "mouse-clicked", VLC_VAR_INTEGER ); - - var_Create( p_vout, "intf-change", VLC_VAR_BOOL ); - val.b_bool = VLC_TRUE; - var_Set( p_vout, "intf-change", val ); - /* Initialize locks */ vlc_mutex_init( p_vout, &p_vout->picture_lock ); vlc_mutex_init( p_vout, &p_vout->subpicture_lock ); diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c index 31eff0e1f17d2c5c6f26bab21f2eb626695fd30f..6507c3a909040cbb5932b6793c2e0bee27512835 100644 --- a/src/video_output/vout_intf.c +++ b/src/video_output/vout_intf.c @@ -222,6 +222,17 @@ void vout_IntfInit( vout_thread_t *p_vout ) p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; } var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL ); + + /* Mouse coordinates */ + var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER ); + var_Create( p_vout, "mouse-y", VLC_VAR_INTEGER ); + var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER ); + var_Create( p_vout, "mouse-moved", VLC_VAR_BOOL ); + var_Create( p_vout, "mouse-clicked", VLC_VAR_INTEGER ); + + var_Create( p_vout, "intf-change", VLC_VAR_BOOL ); + val.b_bool = VLC_TRUE; + var_Set( p_vout, "intf-change", val ); } /*****************************************************************************