[vlc-devel] commit: globalhotkeys xcb : fix modifiers with xcb-keysyms >= 0.3.4 ( cherry picked from commit ba423412ed87bdfadfb09941500ee742c8cad8b1) ( Rafaël Carré )

git version control git at videolan.org
Mon Nov 16 21:48:01 CET 2009


vlc | branch: 1.0-bugfix | Rafaël Carré <rafael.carre at gmail.com> | Fri Oct  9 02:39:20 2009 +0200| [489ee7975b8db2666005e00d27f5c3b01d466eae] | committer: Rafaël Carré 

globalhotkeys xcb : fix modifiers with xcb-keysyms >= 0.3.4 (cherry picked from commit ba423412ed87bdfadfb09941500ee742c8cad8b1)

Signed-off-by: Rafaël Carré <rafael.carre at gmail.com>

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

 modules/control/globalhotkeys/xcb.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/modules/control/globalhotkeys/xcb.c b/modules/control/globalhotkeys/xcb.c
index f1ab4fc..2e51c8d 100644
--- a/modules/control/globalhotkeys/xcb.c
+++ b/modules/control/globalhotkeys/xcb.c
@@ -182,6 +182,9 @@ static unsigned GetModifier( xcb_connection_t *p_connection, xcb_key_symbols_t *
         XCB_MOD_MASK_4, XCB_MOD_MASK_5
     };
 
+    if( sym == 0 )
+        return 0; /* no modifier */
+
 #ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
     const xcb_keycode_t key = xcb_key_symbols_get_keycode( p_symbols, sym );
     if( key == 0 )
@@ -190,6 +193,21 @@ static unsigned GetModifier( xcb_connection_t *p_connection, xcb_key_symbols_t *
     const xcb_keycode_t *p_keys = xcb_key_symbols_get_keycode( p_symbols, sym );
     if( !p_keys )
         return 0;
+
+    int i = 0;
+    bool no_modifier = true;
+    while( p_keys[i] != XCB_NO_SYMBOL )
+    {
+        if( p_keys[i] != 0 )
+        {
+            no_modifier = false;
+            break;
+        }
+        i++;
+    }
+
+    if( no_modifier )
+        return 0;
 #endif
 
     xcb_get_modifier_mapping_cookie_t r =
@@ -344,7 +362,7 @@ static void Mapping( intf_thread_t *p_intf )
         {
             const unsigned i_ignored = GetModifier( p_sys->p_connection,
                     p_sys->p_symbols, p_x11_modifier_ignored[i] );
-            if( i != 0 && i_ignored == 0x00)
+            if( i != 0 && i_ignored == 0)
                 continue;
 
             hotkey_mapping_t *p_map_old = p_sys->p_map;




More information about the vlc-devel mailing list