Index: trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
===================================================================
--- trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp	(revision 98369)
+++ trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp	(revision 98370)
@@ -2906,477 +2906,4 @@
 }
 
-#if defined(RT_OS_DARWIN) || defined(RT_OS_OS2)
-/**
- * Fallback keycode conversion using SDL symbols.
- *
- * This is used to catch keycodes that's missing from the translation table.
- *
- * @returns XT scancode
- * @param   ev SDL scancode
- */
-static uint16_t Keyevent2KeycodeFallback(const SDL_KeyboardEvent *ev)
-{
-    const SDLKey sym = ev->keysym.sym;
-    Log(("SDL key event: sym=%d scancode=%#x unicode=%#x\n",
-         sym, ev->keysym.scancode, ev->keysym.unicode));
-    switch (sym)
-    {                               /* set 1 scan code */
-        case SDLK_ESCAPE:           return 0x01;
-        case SDLK_EXCLAIM:
-        case SDLK_1:                return 0x02;
-        case SDLK_AT:
-        case SDLK_2:                return 0x03;
-        case SDLK_HASH:
-        case SDLK_3:                return 0x04;
-        case SDLK_DOLLAR:
-        case SDLK_4:                return 0x05;
-        /* % */
-        case SDLK_5:                return 0x06;
-        case SDLK_CARET:
-        case SDLK_6:                return 0x07;
-        case SDLK_AMPERSAND:
-        case SDLK_7:                return 0x08;
-        case SDLK_ASTERISK:
-        case SDLK_8:                return 0x09;
-        case SDLK_LEFTPAREN:
-        case SDLK_9:                return 0x0a;
-        case SDLK_RIGHTPAREN:
-        case SDLK_0:                return 0x0b;
-        case SDLK_UNDERSCORE:
-        case SDLK_MINUS:            return 0x0c;
-        case SDLK_EQUALS:
-        case SDLK_PLUS:             return 0x0d;
-        case SDLK_BACKSPACE:        return 0x0e;
-        case SDLK_TAB:              return 0x0f;
-        case SDLK_q:                return 0x10;
-        case SDLK_w:                return 0x11;
-        case SDLK_e:                return 0x12;
-        case SDLK_r:                return 0x13;
-        case SDLK_t:                return 0x14;
-        case SDLK_y:                return 0x15;
-        case SDLK_u:                return 0x16;
-        case SDLK_i:                return 0x17;
-        case SDLK_o:                return 0x18;
-        case SDLK_p:                return 0x19;
-        case SDLK_LEFTBRACKET:      return 0x1a;
-        case SDLK_RIGHTBRACKET:     return 0x1b;
-        case SDLK_RETURN:           return 0x1c;
-        case SDLK_KP_ENTER:         return 0x1c | 0x100;
-        case SDLK_LCTRL:            return 0x1d;
-        case SDLK_RCTRL:            return 0x1d | 0x100;
-        case SDLK_a:                return 0x1e;
-        case SDLK_s:                return 0x1f;
-        case SDLK_d:                return 0x20;
-        case SDLK_f:                return 0x21;
-        case SDLK_g:                return 0x22;
-        case SDLK_h:                return 0x23;
-        case SDLK_j:                return 0x24;
-        case SDLK_k:                return 0x25;
-        case SDLK_l:                return 0x26;
-        case SDLK_COLON:
-        case SDLK_SEMICOLON:        return 0x27;
-        case SDLK_QUOTEDBL:
-        case SDLK_QUOTE:            return 0x28;
-        case SDLK_BACKQUOTE:        return 0x29;
-        case SDLK_LSHIFT:           return 0x2a;
-        case SDLK_BACKSLASH:        return 0x2b;
-        case SDLK_z:                return 0x2c;
-        case SDLK_x:                return 0x2d;
-        case SDLK_c:                return 0x2e;
-        case SDLK_v:                return 0x2f;
-        case SDLK_b:                return 0x30;
-        case SDLK_n:                return 0x31;
-        case SDLK_m:                return 0x32;
-        case SDLK_LESS:
-        case SDLK_COMMA:            return 0x33;
-        case SDLK_GREATER:
-        case SDLK_PERIOD:           return 0x34;
-        case SDLK_KP_DIVIDE:        /*??*/
-        case SDLK_QUESTION:
-        case SDLK_SLASH:            return 0x35;
-        case SDLK_RSHIFT:           return 0x36;
-        case SDLK_KP_MULTIPLY:
-        case SDLK_PRINT:            return 0x37; /* fixme */
-        case SDLK_LALT:             return 0x38;
-        case SDLK_MODE: /* alt gr*/
-        case SDLK_RALT:             return 0x38 | 0x100;
-        case SDLK_SPACE:            return 0x39;
-        case SDLK_CAPSLOCK:         return 0x3a;
-        case SDLK_F1:               return 0x3b;
-        case SDLK_F2:               return 0x3c;
-        case SDLK_F3:               return 0x3d;
-        case SDLK_F4:               return 0x3e;
-        case SDLK_F5:               return 0x3f;
-        case SDLK_F6:               return 0x40;
-        case SDLK_F7:               return 0x41;
-        case SDLK_F8:               return 0x42;
-        case SDLK_F9:               return 0x43;
-        case SDLK_F10:              return 0x44;
-        case SDLK_PAUSE:            return 0x45; /* not right */
-        case SDLK_NUMLOCK:          return 0x45;
-        case SDLK_SCROLLOCK:        return 0x46;
-        case SDLK_KP7:              return 0x47;
-        case SDLK_HOME:             return 0x47 | 0x100;
-        case SDLK_KP8:              return 0x48;
-        case SDLK_UP:               return 0x48 | 0x100;
-        case SDLK_KP9:              return 0x49;
-        case SDLK_PAGEUP:           return 0x49 | 0x100;
-        case SDLK_KP_MINUS:         return 0x4a;
-        case SDLK_KP4:              return 0x4b;
-        case SDLK_LEFT:             return 0x4b | 0x100;
-        case SDLK_KP5:              return 0x4c;
-        case SDLK_KP6:              return 0x4d;
-        case SDLK_RIGHT:            return 0x4d | 0x100;
-        case SDLK_KP_PLUS:          return 0x4e;
-        case SDLK_KP1:              return 0x4f;
-        case SDLK_END:              return 0x4f | 0x100;
-        case SDLK_KP2:              return 0x50;
-        case SDLK_DOWN:             return 0x50 | 0x100;
-        case SDLK_KP3:              return 0x51;
-        case SDLK_PAGEDOWN:         return 0x51 | 0x100;
-        case SDLK_KP0:              return 0x52;
-        case SDLK_INSERT:           return 0x52 | 0x100;
-        case SDLK_KP_PERIOD:        return 0x53;
-        case SDLK_DELETE:           return 0x53 | 0x100;
-        case SDLK_SYSREQ:           return 0x54;
-        case SDLK_F11:              return 0x57;
-        case SDLK_F12:              return 0x58;
-        case SDLK_F13:              return 0x5b;
-        case SDLK_LMETA:
-        case SDLK_LSUPER:           return 0x5b | 0x100;
-        case SDLK_F14:              return 0x5c;
-        case SDLK_RMETA:
-        case SDLK_RSUPER:           return 0x5c | 0x100;
-        case SDLK_F15:              return 0x5d;
-        case SDLK_MENU:             return 0x5d | 0x100;
-#if 0
-        case SDLK_CLEAR:            return 0x;
-        case SDLK_KP_EQUALS:        return 0x;
-        case SDLK_COMPOSE:          return 0x;
-        case SDLK_HELP:             return 0x;
-        case SDLK_BREAK:            return 0x;
-        case SDLK_POWER:            return 0x;
-        case SDLK_EURO:             return 0x;
-        case SDLK_UNDO:             return 0x;
-#endif
-        default:
-            Log(("Unhandled sdl key event: sym=%d scancode=%#x unicode=%#x\n",
-                 ev->keysym.sym, ev->keysym.scancode, ev->keysym.unicode));
-            return 0;
-    }
-}
-#endif /* RT_OS_DARWIN */
-
-/**
- * Converts an SDL keyboard eventcode to a XT scancode.
- *
- * @returns XT scancode
- * @param   ev SDL scancode
- */
-static uint16_t Keyevent2Keycode(const SDL_KeyboardEvent *ev)
-{
-    // start with the scancode determined by SDL
-    int keycode = ev->keysym.scancode;
-
-#ifdef VBOXSDL_WITH_X11
-    switch (ev->keysym.sym)
-    {
-        case SDLK_ESCAPE:           return 0x01;
-        case SDLK_EXCLAIM:
-        case SDLK_1:                return 0x02;
-        case SDLK_AT:
-        case SDLK_2:                return 0x03;
-        case SDLK_HASH:
-        case SDLK_3:                return 0x04;
-        case SDLK_DOLLAR:
-        case SDLK_4:                return 0x05;
-        /* % */
-        case SDLK_5:                return 0x06;
-        case SDLK_CARET:
-        case SDLK_6:                return 0x07;
-        case SDLK_AMPERSAND:
-        case SDLK_7:                return 0x08;
-        case SDLK_ASTERISK:
-        case SDLK_8:                return 0x09;
-        case SDLK_LEFTPAREN:
-        case SDLK_9:                return 0x0a;
-        case SDLK_RIGHTPAREN:
-        case SDLK_0:                return 0x0b;
-        case SDLK_UNDERSCORE:
-        case SDLK_MINUS:            return 0x0c;
-        case SDLK_PLUS:             return 0x0d;
-        case SDLK_BACKSPACE:        return 0x0e;
-        case SDLK_TAB:              return 0x0f;
-        case SDLK_q:                return 0x10;
-        case SDLK_w:                return 0x11;
-        case SDLK_e:                return 0x12;
-        case SDLK_r:                return 0x13;
-        case SDLK_t:                return 0x14;
-        case SDLK_y:                return 0x15;
-        case SDLK_u:                return 0x16;
-        case SDLK_i:                return 0x17;
-        case SDLK_o:                return 0x18;
-        case SDLK_p:                return 0x19;
-        case SDLK_RETURN:           return 0x1c;
-        case SDLK_KP_ENTER:         return 0x1c | 0x100;
-        case SDLK_LCTRL:            return 0x1d;
-        case SDLK_RCTRL:            return 0x1d | 0x100;
-        case SDLK_a:                return 0x1e;
-        case SDLK_s:                return 0x1f;
-        case SDLK_d:                return 0x20;
-        case SDLK_f:                return 0x21;
-        case SDLK_g:                return 0x22;
-        case SDLK_h:                return 0x23;
-        case SDLK_j:                return 0x24;
-        case SDLK_k:                return 0x25;
-        case SDLK_l:                return 0x26;
-        case SDLK_COLON:            return 0x27;
-        case SDLK_QUOTEDBL:
-        case SDLK_QUOTE:            return 0x28;
-        case SDLK_BACKQUOTE:        return 0x29;
-        case SDLK_LSHIFT:           return 0x2a;
-        case SDLK_z:                return 0x2c;
-        case SDLK_x:                return 0x2d;
-        case SDLK_c:                return 0x2e;
-        case SDLK_v:                return 0x2f;
-        case SDLK_b:                return 0x30;
-        case SDLK_n:                return 0x31;
-        case SDLK_m:                return 0x32;
-        case SDLK_LESS:             return 0x33;
-        case SDLK_GREATER:          return 0x34;
-        case SDLK_KP_DIVIDE:        /*??*/
-        case SDLK_QUESTION:         return 0x35;
-        case SDLK_RSHIFT:           return 0x36;
-        case SDLK_KP_MULTIPLY:
-            //case SDLK_PRINT:            return 0x37; /* fixme */
-        case SDLK_LALT:             return 0x38;
-        case SDLK_MODE: /* alt gr*/
-        case SDLK_RALT:             return 0x38 | 0x100;
-        case SDLK_SPACE:            return 0x39;
-        case SDLK_CAPSLOCK:         return 0x3a;
-        case SDLK_F1:               return 0x3b;
-        case SDLK_F2:               return 0x3c;
-        case SDLK_F3:               return 0x3d;
-        case SDLK_F4:               return 0x3e;
-        case SDLK_F5:               return 0x3f;
-        case SDLK_F6:               return 0x40;
-        case SDLK_F7:               return 0x41;
-        case SDLK_F8:               return 0x42;
-        case SDLK_F9:               return 0x43;
-        case SDLK_F10:              return 0x44;
-        case SDLK_PAUSE:            return 0x45; /* not right */
-            //case SDLK_NUMLOCK:          return 0x45;
-            //case SDLK_SCROLLOCK:        return 0x46;
-            //case SDLK_KP7:              return 0x47;
-        case SDLK_HOME:             return 0x47 | 0x100;
-            //case SDLK_KP8:              return 0x48;
-        case SDLK_UP:               return 0x48 | 0x100;
-            //case SDLK_KP9:              return 0x49;
-        case SDLK_PAGEUP:           return 0x49 | 0x100;
-        case SDLK_KP_MINUS:         return 0x4a;
-            //case SDLK_KP4:              return 0x4b;
-        case SDLK_LEFT:             return 0x4b | 0x100;
-            //case SDLK_KP5:              return 0x4c;
-            //case SDLK_KP6:              return 0x4d;
-        case SDLK_RIGHT:            return 0x4d | 0x100;
-        case SDLK_KP_PLUS:          return 0x4e;
-            //case SDLK_KP1:              return 0x4f;
-        case SDLK_END:              return 0x4f | 0x100;
-            //case SDLK_KP2:              return 0x50;
-        case SDLK_DOWN:             return 0x50 | 0x100;
-            //case SDLK_KP3:              return 0x51;
-        case SDLK_PAGEDOWN:         return 0x51 | 0x100;
-            //case SDLK_KP0:              return 0x52;
-        case SDLK_INSERT:           return 0x52 | 0x100;
-        case SDLK_KP_PERIOD:        return 0x53;
-        case SDLK_DELETE:           return 0x53 | 0x100;
-        case SDLK_SYSREQ:           return 0x54;
-        case SDLK_F11:              return 0x57;
-        case SDLK_F12:              return 0x58;
-        case SDLK_F13:              return 0x5b;
-        case SDLK_F14:              return 0x5c;
-        case SDLK_F15:              return 0x5d;
-        case SDLK_MENU:             return 0x5d | 0x100;
-        default:
-                                    return 0;
-    }
-#elif defined(RT_OS_DARWIN)
-    /* This is derived partially from SDL_QuartzKeys.h and partially from testing. */
-    static const uint16_t s_aMacToSet1[] =
-    {
-     /*  set-1            SDL_QuartzKeys.h    */
-        0x1e,        /* QZ_a            0x00 */
-        0x1f,        /* QZ_s            0x01 */
-        0x20,        /* QZ_d            0x02 */
-        0x21,        /* QZ_f            0x03 */
-        0x23,        /* QZ_h            0x04 */
-        0x22,        /* QZ_g            0x05 */
-        0x2c,        /* QZ_z            0x06 */
-        0x2d,        /* QZ_x            0x07 */
-        0x2e,        /* QZ_c            0x08 */
-        0x2f,        /* QZ_v            0x09 */
-        0x56,        /* between lshift and z. 'INT 1'? */
-        0x30,        /* QZ_b            0x0B */
-        0x10,        /* QZ_q            0x0C */
-        0x11,        /* QZ_w            0x0D */
-        0x12,        /* QZ_e            0x0E */
-        0x13,        /* QZ_r            0x0F */
-        0x15,        /* QZ_y            0x10 */
-        0x14,        /* QZ_t            0x11 */
-        0x02,        /* QZ_1            0x12 */
-        0x03,        /* QZ_2            0x13 */
-        0x04,        /* QZ_3            0x14 */
-        0x05,        /* QZ_4            0x15 */
-        0x07,        /* QZ_6            0x16 */
-        0x06,        /* QZ_5            0x17 */
-        0x0d,        /* QZ_EQUALS       0x18 */
-        0x0a,        /* QZ_9            0x19 */
-        0x08,        /* QZ_7            0x1A */
-        0x0c,        /* QZ_MINUS        0x1B */
-        0x09,        /* QZ_8            0x1C */
-        0x0b,        /* QZ_0            0x1D */
-        0x1b,        /* QZ_RIGHTBRACKET 0x1E */
-        0x18,        /* QZ_o            0x1F */
-        0x16,        /* QZ_u            0x20 */
-        0x1a,        /* QZ_LEFTBRACKET  0x21 */
-        0x17,        /* QZ_i            0x22 */
-        0x19,        /* QZ_p            0x23 */
-        0x1c,        /* QZ_RETURN       0x24 */
-        0x26,        /* QZ_l            0x25 */
-        0x24,        /* QZ_j            0x26 */
-        0x28,        /* QZ_QUOTE        0x27 */
-        0x25,        /* QZ_k            0x28 */
-        0x27,        /* QZ_SEMICOLON    0x29 */
-        0x2b,        /* QZ_BACKSLASH    0x2A */
-        0x33,        /* QZ_COMMA        0x2B */
-        0x35,        /* QZ_SLASH        0x2C */
-        0x31,        /* QZ_n            0x2D */
-        0x32,        /* QZ_m            0x2E */
-        0x34,        /* QZ_PERIOD       0x2F */
-        0x0f,        /* QZ_TAB          0x30 */
-        0x39,        /* QZ_SPACE        0x31 */
-        0x29,        /* QZ_BACKQUOTE    0x32 */
-        0x0e,        /* QZ_BACKSPACE    0x33 */
-        0x9c,        /* QZ_IBOOK_ENTER  0x34 */
-        0x01,        /* QZ_ESCAPE       0x35 */
-        0x5c|0x100,  /* QZ_RMETA        0x36 */
-        0x5b|0x100,  /* QZ_LMETA        0x37 */
-        0x2a,        /* QZ_LSHIFT       0x38 */
-        0x3a,        /* QZ_CAPSLOCK     0x39 */
-        0x38,        /* QZ_LALT         0x3A */
-        0x1d,        /* QZ_LCTRL        0x3B */
-        0x36,        /* QZ_RSHIFT       0x3C */
-        0x38|0x100,  /* QZ_RALT         0x3D */
-        0x1d|0x100,  /* QZ_RCTRL        0x3E */
-           0,        /*                      */
-           0,        /*                      */
-        0x53,        /* QZ_KP_PERIOD    0x41 */
-           0,        /*                      */
-        0x37,        /* QZ_KP_MULTIPLY  0x43 */
-           0,        /*                      */
-        0x4e,        /* QZ_KP_PLUS      0x45 */
-           0,        /*                      */
-        0x45,        /* QZ_NUMLOCK      0x47 */
-           0,        /*                      */
-           0,        /*                      */
-           0,        /*                      */
-        0x35|0x100,  /* QZ_KP_DIVIDE    0x4B */
-        0x1c|0x100,  /* QZ_KP_ENTER     0x4C */
-           0,        /*                      */
-        0x4a,        /* QZ_KP_MINUS     0x4E */
-           0,        /*                      */
-           0,        /*                      */
-        0x0d/*?*/,   /* QZ_KP_EQUALS    0x51 */
-        0x52,        /* QZ_KP0          0x52 */
-        0x4f,        /* QZ_KP1          0x53 */
-        0x50,        /* QZ_KP2          0x54 */
-        0x51,        /* QZ_KP3          0x55 */
-        0x4b,        /* QZ_KP4          0x56 */
-        0x4c,        /* QZ_KP5          0x57 */
-        0x4d,        /* QZ_KP6          0x58 */
-        0x47,        /* QZ_KP7          0x59 */
-           0,        /*                      */
-        0x48,        /* QZ_KP8          0x5B */
-        0x49,        /* QZ_KP9          0x5C */
-           0,        /*                      */
-           0,        /*                      */
-           0,        /*                      */
-        0x3f,        /* QZ_F5           0x60 */
-        0x40,        /* QZ_F6           0x61 */
-        0x41,        /* QZ_F7           0x62 */
-        0x3d,        /* QZ_F3           0x63 */
-        0x42,        /* QZ_F8           0x64 */
-        0x43,        /* QZ_F9           0x65 */
-           0,        /*                      */
-        0x57,        /* QZ_F11          0x67 */
-           0,        /*                      */
-        0x37|0x100,  /* QZ_PRINT / F13  0x69 */
-        0x63,        /* QZ_F16          0x6A */
-        0x46,        /* QZ_SCROLLOCK    0x6B */
-           0,        /*                      */
-        0x44,        /* QZ_F10          0x6D */
-        0x5d|0x100,  /*                      */
-        0x58,        /* QZ_F12          0x6F */
-           0,        /*                      */
-           0/* 0xe1,0x1d,0x45*/, /* QZ_PAUSE        0x71 */
-        0x52|0x100,  /* QZ_INSERT / HELP 0x72 */
-        0x47|0x100,  /* QZ_HOME         0x73 */
-        0x49|0x100,   /* QZ_PAGEUP       0x74 */
-        0x53|0x100,  /* QZ_DELETE       0x75 */
-        0x3e,        /* QZ_F4           0x76 */
-        0x4f|0x100,  /* QZ_END          0x77 */
-        0x3c,        /* QZ_F2           0x78 */
-        0x51|0x100,  /* QZ_PAGEDOWN     0x79 */
-        0x3b,        /* QZ_F1           0x7A */
-        0x4b|0x100,  /* QZ_LEFT         0x7B */
-        0x4d|0x100,  /* QZ_RIGHT        0x7C */
-        0x50|0x100,  /* QZ_DOWN         0x7D */
-        0x48|0x100,  /* QZ_UP           0x7E */
-        0x5e|0x100,  /* QZ_POWER        0x7F */ /* have different break key! */
-    };
-
-    if (keycode == 0)
-    {
-        /* This could be a modifier or it could be 'a'. */
-        switch (ev->keysym.sym)
-        {
-            case SDLK_LSHIFT:           keycode = 0x2a; break;
-            case SDLK_RSHIFT:           keycode = 0x36; break;
-            case SDLK_LCTRL:            keycode = 0x1d; break;
-            case SDLK_RCTRL:            keycode = 0x1d | 0x100; break;
-            case SDLK_LALT:             keycode = 0x38; break;
-            case SDLK_MODE: /* alt gr */
-            case SDLK_RALT:             keycode = 0x38 | 0x100; break;
-            case SDLK_RMETA:
-            case SDLK_RSUPER:           keycode = 0x5c | 0x100; break;
-            case SDLK_LMETA:
-            case SDLK_LSUPER:           keycode = 0x5b | 0x100; break;
-            /* Assumes normal key. */
-            default:                    keycode = s_aMacToSet1[keycode]; break;
-        }
-    }
-    else
-    {
-        if ((unsigned)keycode < RT_ELEMENTS(s_aMacToSet1))
-            keycode = s_aMacToSet1[keycode];
-        else
-            keycode = 0;
-        if (!keycode)
-        {
-# ifdef DEBUG_bird
-            RTPrintf("Untranslated: keycode=%#x (%d)\n", keycode, keycode);
-# endif
-            keycode = Keyevent2KeycodeFallback(ev);
-        }
-    }
-# ifdef DEBUG_bird
-    RTPrintf("scancode=%#x -> %#x\n", ev->keysym.scancode, keycode);
-# endif
-
-#elif defined(RT_OS_OS2)
-    keycode = Keyevent2KeycodeFallback(ev);
-#endif /* RT_OS_DARWIN */
-    return keycode;
-}
 
 /**
@@ -3409,166 +2936,8 @@
 static void ProcessKey(SDL_KeyboardEvent *ev)
 {
-#if 0 //(defined(DEBUG) || defined(VBOX_WITH_STATISTICS)) && !defined(VBOX_WITH_SDL2)
-    if (gpMachineDebugger && ev->type == SDL_KEYDOWN)
-    {
-        // first handle the debugger hotkeys
-        uint8_t *keystate = SDL_GetKeyState(NULL);
-#if 0
-        // CTRL+ALT+Fn is not free on Linux hosts with Xorg ..
-        if (keystate[SDLK_LALT] && !keystate[SDLK_LCTRL])
-#else
-        if (keystate[SDLK_LALT] && keystate[SDLK_LCTRL])
-#endif
-        {
-            switch (ev->keysym.sym)
-            {
-                // pressing CTRL+ALT+F11 dumps the statistics counter
-                case SDLK_F12:
-                    RTPrintf("ResetStats\n"); /* Visual feedback in console window */
-                    gpMachineDebugger->ResetStats(NULL);
-                    break;
-                // pressing CTRL+ALT+F12 resets all statistics counter
-                case SDLK_F11:
-                    gpMachineDebugger->DumpStats(NULL);
-                    RTPrintf("DumpStats\n");  /* Vistual feedback in console window */
-                    break;
-                default:
-                    break;
-            }
-        }
-#if 1
-        else if (keystate[SDLK_LALT] && !keystate[SDLK_LCTRL])
-        {
-            switch (ev->keysym.sym)
-            {
-                // pressing Alt-F8 toggles singlestepping mode
-                case SDLK_F8:
-                {
-                    BOOL singlestepEnabled;
-                    gpMachineDebugger->COMGETTER(SingleStep)(&singlestepEnabled);
-                    gpMachineDebugger->COMSETTER(SingleStep)(!singlestepEnabled);
-                    break;
-                }
-                default:
-                    break;
-            }
-        }
-#endif
-        // pressing Ctrl-F12 toggles the logger
-        else if ((keystate[SDLK_RCTRL] || keystate[SDLK_LCTRL]) && ev->keysym.sym == SDLK_F12)
-        {
-            BOOL logEnabled = TRUE;
-            gpMachineDebugger->COMGETTER(LogEnabled)(&logEnabled);
-            gpMachineDebugger->COMSETTER(LogEnabled)(!logEnabled);
-#ifdef DEBUG_bird
-            return;
-#endif
-        }
-        // pressing F12 sets a logmark
-        else if (ev->keysym.sym == SDLK_F12)
-        {
-            RTLogPrintf("****** LOGGING MARK ******\n");
-            RTLogFlush(NULL);
-        }
-        // now update the titlebar flags
-        UpdateTitlebar(TITLEBAR_NORMAL);
-    }
-#endif // DEBUG || VBOX_WITH_STATISTICS
-
-    // the pause key is the weirdest, needs special handling
-    if (ev->keysym.sym == SDLK_PAUSE)
-    {
-        int v = 0;
-        if (ev->type == SDL_KEYUP)
-            v |= 0x80;
-        gpKeyboard->PutScancode(0xe1);
-        gpKeyboard->PutScancode(0x1d | v);
-        gpKeyboard->PutScancode(0x45 | v);
-        return;
-    }
-
-    /*
-     * Perform SDL key event to scancode conversion
-     */
-    int keycode = Keyevent2Keycode(ev);
-
-    switch(keycode)
-    {
-        case 0x00:
-        {
-            /* sent when leaving window: reset the modifiers state */
-            ResetKeys();
-            return;
-        }
-
-        case 0x2a:        /* Left Shift */
-        case 0x36:        /* Right Shift */
-        case 0x1d:        /* Left CTRL */
-        case 0x1d|0x100:  /* Right CTRL */
-        case 0x38:        /* Left ALT */
-        case 0x38|0x100:  /* Right ALT */
-        {
-            if (ev->type == SDL_KEYUP)
-                gaModifiersState[keycode & ~0x100] = 0;
-            else
-                gaModifiersState[keycode & ~0x100] = 1;
-            break;
-        }
-
-        case 0x45: /* Num Lock */
-        case 0x3a: /* Caps Lock */
-        {
-            /*
-             * SDL generates a KEYDOWN event if the lock key is active and a  KEYUP event
-             * if the lock key is inactive. See SDL_DISABLE_LOCK_KEYS.
-             */
-            if (ev->type == SDL_KEYDOWN || ev->type == SDL_KEYUP)
-            {
-                gpKeyboard->PutScancode(keycode);
-                gpKeyboard->PutScancode(keycode | 0x80);
-            }
-            return;
-        }
-    }
-
-    if (ev->type != SDL_KEYDOWN)
-    {
-        /*
-         * Some keyboards (e.g. the one of mine T60) don't send a NumLock scan code on every
-         * press of the key. Both the guest and the host should agree on the NumLock state.
-         * If they differ, we try to alter the guest NumLock state by sending the NumLock key
-         * scancode. We will get a feedback through the KBD_CMD_SET_LEDS command if the guest
-         * tries to set/clear the NumLock LED. If a (silly) guest doesn't change the LED, don't
-         * bother him with NumLock scancodes. At least our BIOS, Linux and Windows handle the
-         * NumLock LED well.
-         */
-        if (   gcGuestNumLockAdaptions
-            && (gfGuestNumLockPressed ^ !!(SDL_GetModState() & KMOD_NUM)))
-        {
-            gcGuestNumLockAdaptions--;
-            gpKeyboard->PutScancode(0x45);
-            gpKeyboard->PutScancode(0x45 | 0x80);
-        }
-        if (   gcGuestCapsLockAdaptions
-            && (gfGuestCapsLockPressed ^ !!(SDL_GetModState() & KMOD_CAPS)))
-        {
-            gcGuestCapsLockAdaptions--;
-            gpKeyboard->PutScancode(0x3a);
-            gpKeyboard->PutScancode(0x3a | 0x80);
-        }
-    }
-
-    /*
-     * Now we send the event. Apply extended and release prefixes.
-     */
-#ifdef RT_OS_WINDOWS
+    /* According to SDL2/SDL_scancodes.h ev->keysym.sym stores scancodes which are
+    * based on USB usage page standard. This is what we can directly pass to
+    * IKeyboard::putUsageCode. */
     gpKeyboard->PutUsageCode(SDL_GetScancodeFromKey(ev->keysym.sym), 0x07, ev->type == SDL_KEYUP ? TRUE : FALSE);
-#else
-    if (keycode & 0x100)
-        gpKeyboard->PutScancode(0xe0);
-
-    gpKeyboard->PutScancode(ev->type == SDL_KEYUP ? (keycode & 0x7f) | 0x80
-                                                 : (keycode & 0x7f));
-#endif /* RT_OS_WINDOWS */
 }
 
@@ -4592,4 +3961,5 @@
         {
             // /* send Ctrl-Alt-Fx to guest */
+#if 0 // Fix me. I was not working with PutScancodes API. Need to find the corect way to do this with PutUsagecode API
             com::SafeArray<LONG> keys(6);
 
@@ -4602,4 +3972,5 @@
 
             gpKeyboard->PutScancodes(ComSafeArrayAsInParam(keys), NULL);
+#endif
             return VINF_SUCCESS;
         }
