Partial fix (Linux) [#21395] Command key for keyboard mapping not functional
authorNathan Letwory <nathan@letworyinteractive.com>
Thu, 16 Sep 2010 06:52:12 +0000 (06:52 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Thu, 16 Sep 2010 06:52:12 +0000 (06:52 +0000)
Reported by Andy Braham

Handle XK_Super_L and XK_Super_R as the GHOST_kKeyCommand. Since Command key is
not discerned (yet) in left/right variants, read both and set accordingly.

This now completes fixes for [#21395]

intern/ghost/intern/GHOST_SystemX11.cpp

index 961a637e6169178e6be6fe176dc0f9f197fd968b..b07dba7319fe0c3707660b8af7d5ce05d504769c 100644 (file)
@@ -851,6 +851,8 @@ getModifierKeys(
        const KeyCode control_r = XKeysymToKeycode(m_display,XK_Control_R);
        const KeyCode alt_l = XKeysymToKeycode(m_display,XK_Alt_L);
        const KeyCode alt_r = XKeysymToKeycode(m_display,XK_Alt_R);
+       const KeyCode super_l = XKeysymToKeycode(m_display,XK_Super_L);
+       const KeyCode super_r = XKeysymToKeycode(m_display,XK_Super_R);
 
        // Shift
        if ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) {
@@ -888,6 +890,15 @@ getModifierKeys(
        } else {
                keys.set(GHOST_kModifierKeyRightAlt,false);
        }
+
+       // Super (Windows) - only one GHOST-kModifierKeyCommand, so mapping
+       // to either
+       if ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) || 
+            ((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) {
+               keys.set(GHOST_kModifierKeyCommand,true);
+       } else {
+               keys.set(GHOST_kModifierKeyCommand,false);
+       }
        return GHOST_kSuccess;
 }
 
@@ -1095,6 +1106,8 @@ convertXKey(
                        GXMAP(type,XK_Control_R,        GHOST_kKeyRightControl);
                        GXMAP(type,XK_Alt_L,            GHOST_kKeyLeftAlt);
                        GXMAP(type,XK_Alt_R,            GHOST_kKeyRightAlt);
+                       GXMAP(type,XK_Super_L,          GHOST_kKeyCommand);
+                       GXMAP(type,XK_Super_R,          GHOST_kKeyCommand);
 
                        GXMAP(type,XK_Insert,           GHOST_kKeyInsert);
                        GXMAP(type,XK_Delete,           GHOST_kKeyDelete);