From: Jean-Paul Saman Date: Thu, 21 Jun 2007 11:45:41 +0000 (+0000) Subject: Added new hotkeys "key-menu-[on|off|left|right|up|down|select]". Lirc now calls the... X-Git-Tag: 0.9.0-test0~6966 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f43820ebe977501dfb3ad403c4d97fa99c384641;p=vlc Added new hotkeys "key-menu-[on|off|left|right|up|down|select]". Lirc now calls the osd_Menu*() functions directly when prefix "menu " followed by one of: on, off, left, right, up, down or select is found. --- diff --git a/include/vlc_keys.h b/include/vlc_keys.h index c2ae737726..4d008e4468 100644 --- a/include/vlc_keys.h +++ b/include/vlc_keys.h @@ -309,3 +309,10 @@ static inline int StringToKey( char *psz_key ) #define ACTIONID_LOOP 82 #define ACTIONID_WALLPAPER 83 #define ACTIONID_LEAVE_FULLSCREEN 84 +#define ACTIONID_MENU_ON 85 +#define ACTIONID_MENU_OFF 86 +#define ACTIONID_MENU_RIGHT 87 +#define ACTIONID_MENU_LEFT 88 +#define ACTIONID_MENU_UP 89 +#define ACTIONID_MENU_DOWN 90 +#define ACTIONID_MENU_SELECT 91 diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c index 21738f34f9..970d215de1 100644 --- a/modules/control/hotkeys.c +++ b/modules/control/hotkeys.c @@ -760,6 +760,34 @@ static void Run( intf_thread_t *p_intf ) playlist_Play( p_playlist ); } } + else if( i_action == ACTIONID_MENU_ON ) + { + osd_MenuShow( VLC_OBJECT(p_intf) ); + } + else if( i_action == ACTIONID_MENU_OFF ) + { + osd_MenuHide( VLC_OBJECT(p_intf) ); + } + else if( i_action == ACTIONID_MENU_LEFT ) + { + osd_MenuPrev( VLC_OBJECT(p_intf) ); + } + else if( i_action == ACTIONID_MENU_RIGHT ) + { + osd_MenuNext( VLC_OBJECT(p_intf) ); + } + else if( i_action == ACTIONID_MENU_UP ) + { + osd_MenuUp( VLC_OBJECT(p_intf) ); + } + else if( i_action == ACTIONID_MENU_DOWN ) + { + osd_MenuDown( VLC_OBJECT(p_intf) ); + } + else if( i_action == ACTIONID_MENU_SELECT ) + { + osd_MenuActivate( VLC_OBJECT(p_intf) ); + } } if( p_vout ) vlc_object_release( p_vout ); diff --git a/modules/control/lirc.c b/modules/control/lirc.c index 45a34fbaad..d549f2090f 100644 --- a/modules/control/lirc.c +++ b/modules/control/lirc.c @@ -31,6 +31,7 @@ #include #include +#include #include @@ -53,6 +54,7 @@ static void Run ( intf_thread_t * ); * Module descriptor *****************************************************************************/ vlc_module_begin(); + set_shortname( _("Infrared") ); set_category( CAT_INTERFACE ); set_subcategory( SUBCAT_INTERFACE_CONTROL ); set_description( _("Infrared remote control interface") ); @@ -137,20 +139,47 @@ static void Run( intf_thread_t *p_intf ) } while( !intf_ShouldDie( p_intf ) - && lirc_code2char( p_intf->p_sys->config, code, &c ) == 0 - && c != NULL ) + && (lirc_code2char( p_intf->p_sys->config, code, &c ) == 0) + && (c != NULL) ) { vlc_value_t keyval; - if( strncmp( "key-", c, 4 ) ) + if( !strncmp( "key-", c, 4 ) ) + { + keyval.i_int = config_GetInt( p_intf, c ); + var_Set( p_intf->p_libvlc, "key-pressed", keyval ); + } + else if( !strncmp( "menu ", c, 5) ) + { + if( !strncmp( c, "menu on", 7 ) || + !strncmp( c, "menu show", 9 )) + osd_MenuShow( VLC_OBJECT(p_intf) ); + else if( !strncmp( c, "menu off", 8 ) || + !strncmp( c, "menu hide", 9 ) ) + osd_MenuHide( VLC_OBJECT(p_intf) ); + else if( !strncmp( c, "menu up", 7 ) ) + osd_MenuUp( VLC_OBJECT(p_intf) ); + else if( !strncmp( c, "menu down", 9 ) ) + osd_MenuDown( VLC_OBJECT(p_intf) ); + else if( !stnrcmp( c, "menu left", 9 ) ) + osd_MenuPrev( VLC_OBJECT(p_intf) ); + else if( !strncmp( c, "menu right", 10 ) ) + osd_MenuNext( VLC_OBJECT(p_intf) ); + else if( !strncmp( c, "menu select", 11 ) ) + osd_MenuActivate( VLC_OBJECT(p_intf) ); + else + { + msg_Err( p_intf, _("Please provide one of the following parameters:") ); + msg_Err( p_intf, "[on|off|up|down|left|right|select]" ); + break; + } + } + else { msg_Err( p_intf, "this doesn't appear to be a valid keycombo lirc sent us. Please look at the doc/lirc/example.lirc file in VLC" ); break; } - keyval.i_int = config_GetInt( p_intf, c ); - var_Set( p_intf->p_libvlc, "key-pressed", keyval ); } free( code ); } } - diff --git a/src/libvlc-module.c b/src/libvlc-module.c index a13fa34dbb..88eb1690d1 100644 --- a/src/libvlc-module.c +++ b/src/libvlc-module.c @@ -2397,6 +2397,13 @@ const struct hotkey libvlc_hotkeys[] = { "key-random", ACTIONID_RANDOM, 0, 0, 0, 0 }, { "key-loop", ACTIONID_LOOP, 0, 0, 0, 0 }, { "key-wallpaper", ACTIONID_WALLPAPER, 0, 0, 0, 0 }, + { "key-menu-on", ACTIONID_MENU_ON, 0, 0, 0, 0 }, + { "key-menu-off", ACTIONID_MENU_OFF, 0, 0, 0, 0 }, + { "key-menu-right", ACTIONID_MENU_RIGHT, 0, 0, 0, 0 }, + { "key-menu-left", ACTIONID_MENU_LEFT, 0, 0, 0, 0 }, + { "key-menu-up", ACTIONID_MENU_UP, 0, 0, 0, 0 }, + { "key-menu-down", ACTIONID_MENU_DOWN, 0, 0, 0, 0 }, + { "key-menu-select", ACTIONID_MENU_SELECT, 0, 0, 0, 0 }, { NULL, 0, 0, 0, 0, 0 } };