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.

This commit is contained in:
Jean-Paul Saman 2007-06-21 11:45:41 +00:00
parent ecf51c903d
commit f43820ebe9
4 changed files with 77 additions and 6 deletions

View File

@ -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

View File

@ -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 );

View File

@ -31,6 +31,7 @@
#include <vlc/vlc.h>
#include <vlc_interface.h>
#include <vlc_osd.h>
#include <lirc/lirc_client.h>
@ -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 );
}
}

View File

@ -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 }
};