[vlc-devel] [PATCH 1/3] libvlc: improve libvlc_video_set_key_input prototype

Rémi Denis-Courmont remi at remlab.net
Mon Dec 2 18:41:34 CET 2019


Le maanantaina 2. joulukuuta 2019, 16.28.51 EET Alexandre Janniaux a écrit :
> Use booleans instead of unsigned when taking a boolean value.

IMO we should also switch the default values to off and preferably rename the 
functions so that there's a blatant breakage to be fixed in using code.

> ---
>  include/vlc/libvlc_media_player.h | 2 +-
>  lib/video.c                       | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/vlc/libvlc_media_player.h
> b/include/vlc/libvlc_media_player.h index 7c72c9774b..2a5dc57b22 100644
> --- a/include/vlc/libvlc_media_player.h
> +++ b/include/vlc/libvlc_media_player.h
> @@ -1414,7 +1414,7 @@ LIBVLC_API bool libvlc_get_fullscreen(
> libvlc_media_player_t *p_mi ); * \param on true to handle key press events,
> false to ignore them. */
>  LIBVLC_API
> -void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on
> ); +void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, bool on
> );
> 
>  /**
>   * Enable or disable mouse click events handling. By default, those events
> are diff --git a/lib/video.c b/lib/video.c
> index 6f8e6d7f59..dd6f514ffd 100644
> --- a/lib/video.c
> +++ b/lib/video.c
> @@ -117,9 +117,9 @@ void libvlc_toggle_fullscreen( libvlc_media_player_t
> *p_mi ) free (pp_vouts);
>  }
> 
> -void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on )
> +void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, bool on ) {
> -    var_SetBool (p_mi, "keyboard-events", !!on);
> +    var_SetBool (p_mi, "keyboard-events", on);
>  }
> 
>  void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on
> )


-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list