]> git.sesse.net Git - vlc/commitdiff
Added new hotkeys "key-menu-[on|off|left|right|up|down|select]". Lirc now calls the...
authorJean-Paul Saman <jpsaman@videolan.org>
Thu, 21 Jun 2007 11:45:41 +0000 (11:45 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Thu, 21 Jun 2007 11:45:41 +0000 (11:45 +0000)
include/vlc_keys.h
modules/control/hotkeys.c
modules/control/lirc.c
src/libvlc-module.c

index c2ae7377263d8e9b2825806ea0907398c0b085f7..4d008e4468c7dc6fdf134066330ee7379ef0e47a 100644 (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
index 21738f34f98840b2bcc135729f3801592915a6fe..970d215de13d222eba56241406d767d9c9d14c94 100644 (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 );
index 45a34fbaad5a78a32e39dbcab39b4f38af71276e..d549f2090f970d869f0f318d3ce874c6757a500d 100644 (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 );
     }
 }
-
index a13fa34dbbb30099fd68baee22a6a3b9cda12475..88eb1690d1be45c6c95cc75065f5bac134d7a664 100644 (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 }
 };