[vlc-commits] XCB/global: update to key items as strings

Rémi Denis-Courmont git at videolan.org
Sat Feb 19 15:13:50 CET 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 19 16:03:33 2011 +0200| [fe4273defdb9d9fe46b0bfcf9e78566c289690bb] | committer: Rémi Denis-Courmont

XCB/global: update to key items as strings

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe4273defdb9d9fe46b0bfcf9e78566c289690bb
---

 modules/control/globalhotkeys/xcb.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/control/globalhotkeys/xcb.c b/modules/control/globalhotkeys/xcb.c
index 5ed108d..17d51b6 100644
--- a/modules/control/globalhotkeys/xcb.c
+++ b/modules/control/globalhotkeys/xcb.c
@@ -307,16 +307,19 @@ static bool Mapping( intf_thread_t *p_intf )
             p_hotkey->psz_action != NULL;
             p_hotkey++ )
     {
-        char *psz_hotkey;
-        if( asprintf( &psz_hotkey, "global-%s", p_hotkey->psz_action ) < 0 )
-            break;
-
         const int i_vlc_action = p_hotkey->i_action;
-        const int i_vlc_key = var_InheritInteger( p_intf, psz_hotkey );
-        free( psz_hotkey );
+        char varname[12 + strlen( p_hotkey->psz_action )];
+        sprintf( varname, "global-key-%s", p_hotkey->psz_action );
 
-        if( !i_vlc_key )
+        char *key = var_InheritString( p_intf, varname );
+        if( key == NULL )
             continue;
+
+        uint_fast32_t i_vlc_key = vlc_str2keycode( key );
+        free( key );
+        if( i_vlc_key == KEY_UNSET )
+            continue;
+
 #ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
         const xcb_keycode_t key = xcb_key_symbols_get_keycode(
                 p_sys->p_symbols, GetX11Key( i_vlc_key & ~KEY_MODIFIER ) );



More information about the vlc-commits mailing list