VirtualBox

Changeset 7100 in vbox


Ignore:
Timestamp:
Feb 22, 2008 4:33:09 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28347
Message:

Applied VBoxSDL evdev keyboard patch submitted in public bugtracker #1231 under MIT license

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r6934 r7100  
    187187#ifdef VBOXSDL_WITH_X11
    188188static Cursor      gpDefaultOrigX11Cursor;
     189static BOOL useEvdevKeymap = FALSE;
    189190#endif
    190191static SDL_Cursor *gpCustomCursor = NULL;
     
    646647             "  -tapdev<1-N> <dev>       Use existing persistent TAP device with the given name\n"
    647648             "  -tapfd<1-N> <fd>         Use existing TAP device, don't allocate\n"
     649             "  -evdevkeymap             Use evdev keycode map\n"
    648650#endif
    649651#ifdef VBOX_VRDP
     
    11601162            }
    11611163        }
     1164#ifdef RT_OS_LINUX
     1165        else if (strcmp(argv[curArg], "-evdevkeymap") == 0)
     1166        {
     1167            useEvdevKeymap = TRUE;
     1168        }
     1169#endif /* RT_OS_LINUX  */
    11621170#if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN)
    11631171        else if (strncmp(argv[curArg], "-tapdev", 7) == 0)
     
    28542862    };
    28552863
     2864    // workaround for SDL keyboard translation issues on EVDEV
     2865    // keycodes > 0x100 are sent as 0xe0 keycode
     2866    // these values are simply pulled from x_keycode_to_pc_keycode
     2867    // not a whole lot of testing of the 'weird' values has taken
     2868    // place (I don't own a Japanese or Korean keyboard)
     2869    static const uint16_t evdev_keycode_to_pc_keycode[61] =
     2870    {
     2871       0x0,         /*  97 EVDEV - RO   ("Internet" Keyboards) */
     2872       0x0,         /*  98 EVDEV - KATA (Katakana) */
     2873       0x0,         /*  99 EVDEV - HIRA (Hiragana) */
     2874       0x79,        /* 100 EVDEV - HENK (Henkan) */
     2875       0x70,        /* 101 EVDEV - HKTG (Hiragana/Katakana toggle) */
     2876       0x7b,        /* 102 EVDEV - MUHE (Muhenkan) */
     2877       0x0,         /* 103 EVDEV - JPCM (KPJPComma) */
     2878       0x1c|0x100,  /* 104 EVDEV - KPEN */
     2879       0x1d|0x100,  /* 105 EVDEV - RCTL */
     2880       0x35|0x100,  /* 106 EVDEV - KPDV */
     2881       0x37|0x100,  /* 107 EVDEV - PRSC ***FIXME*** */
     2882       0x38|0x100,  /* 108 EVDEV - RALT */
     2883       0x0,         /* 109 EVDEV - LNFD ("Internet" Keyboards) */
     2884       0x47|0x100,  /* 110 EVDEV - HOME ***FIXME*** */
     2885       0x48|0x100,  /* 111 EVDEV - UP   */
     2886       0x49|0x100,  /* 112 EVDEV - PGUP */
     2887       0x4b|0x100,  /* 113 EVDEV - LEFT */
     2888       0x4d|0x100,  /* 114 EVDEV - RGHT */
     2889       0x4f|0x100,  /* 115 EVDEV - END  */
     2890       0x50|0x100,  /* 116 EVDEV - DOWN */
     2891       0x51|0x100,  /* 117 EVDEV - PGDN */
     2892       0x52|0x100,  /* 118 EVDEV - INS  */
     2893       0x53|0x100,  /* 119 EVDEV - DELE */
     2894       0x0,         /* 120 EVDEV - I120 ("Internet" Keyboards) */
     2895       //121-124 Solaris Compatibilty Stuff
     2896       0x0,         /* 121 EVDEV - MUTE */
     2897       0x0,         /* 122 EVDEV - VOL- */
     2898       0x0,         /* 123 EVDEV - VOL+ */
     2899       0x0,         /* 124 EVDEV - POWR */
     2900       0x0,         /* 125 EVDEV - KPEQ */
     2901       0x0,         /* 126 EVDEV - I126 ("Internet" Keyboards) */
     2902       0x0,         /* 127 EVDEV - PAUS */
     2903       0x0,         /* 128 EVDEV - ???? */
     2904       0x0,         /* 129 EVDEV - I129 ("Internet" Keyboards) */
     2905       0xf1,        /* 130 EVDEV - HNGL (Korean Hangul Latin toggle) */
     2906       0xf2,        /* 131 EVDEV - HJCV (Korean Hangul Hanja toggle) */
     2907       0x7d,        /* 132 EVDEV - AE13 (Yen) */
     2908       0x5b|0x100,  /* 133 EVDEV - LWIN */
     2909       0x5c|0x100,  /* 134 EVDEV - RWIN */
     2910       0x5d|0x100,  /* 135 EVDEV - MENU */
     2911       //136-146 Solaris Stuff
     2912       0x0,         /* 136 EVDEV - STOP */
     2913       0x0,         /* 137 EVDEV - AGAI */
     2914       0x0,         /* 138 EVDEV - PROP */
     2915       0x0,         /* 139 EVDEV - UNDO */
     2916       0x0,         /* 140 EVDEV - FRNT */
     2917       0x0,         /* 141 EVDEV - COPY */
     2918       0x0,         /* 142 EVDEV - OPEN */
     2919       0x0,         /* 143 EVDEV - PAST */
     2920       0x0,         /* 144 EVDEV - FIND */
     2921       0x0,         /* 145 EVDEV - CUT  */
     2922       0x0,         /* 146 EVDEV - HELP */
     2923       //Extended Keys ("Internet" Keyboards)
     2924       0x0,         /* 147 EVDEV - I147 */
     2925       0x0,         /* 148 EVDEV - I148 */
     2926       0x0,         /* 149 EVDEV - I149 */
     2927       0x0,         /* 150 EVDEV - I150 */
     2928       0x0,         /* 151 EVDEV - I151 */
     2929       0x0,         /* 152 EVDEV - I152 */
     2930       0x0,         /* 153 EVDEV - I153 */
     2931       0x0,         /* 154 EVDEV - I154 */
     2932       0x0,         /* 155 EVDEV - I156 */
     2933       0x0,         /* 156 EVDEV - I157 */
     2934       0x0,         /* 157 EVDEV - I158 */
     2935    };
     2936
    28562937    if (keycode < 9)
    28572938    {
     
    28622943        // just an offset (Xorg MIN_KEYCODE)
    28632944        keycode -= 8;
     2945    }
     2946    else if (keycode < 158 && useEvdevKeymap)
     2947    {
     2948        // apply EVDEV conversion table
     2949        keycode = evdev_keycode_to_pc_keycode[keycode - 97];
    28642950    }
    28652951    else if (keycode < 158)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette