VirtualBox

Changeset 7455 in vbox


Ignore:
Timestamp:
Mar 14, 2008 10:33:04 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28893
Message:

Frontends/VirtualBox4: remove some legacy from the X11 keyboard code

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox4/include/XKeyboard.h

    r5999 r7455  
    2020#define __XKeyboard_h__
    2121
    22 // our structure used to return keyboard event information
    23 typedef struct _WINEKEYBOARDINFO
    24 {
    25     unsigned short wVk;
    26     unsigned short wScan;
    27     unsigned long dwFlags;
    28     unsigned long time;
    29 } WINEKEYBOARDINFO;
    30 
    3122// initialize the X keyboard subsystem
    3223bool initXKeyboard(Display *dpy);
    3324// our custom keyboard handler
    34 void handleXKeyEvent(Display *dpy, XEvent *event, WINEKEYBOARDINFO *wineKbdInfo);
     25unsigned handleXKeyEvent(XEvent *event);
    3526// returns the number of keysyms per keycode (only valid after initXKeyboard())
    3627int getKeysymsPerKeycode();
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp

    r7453 r7455  
    18831883bool VBoxConsoleView::x11Event (XEvent *event)
    18841884{
    1885     static WINEKEYBOARDINFO wineKeyboardInfo;
    1886 
    18871885    switch (event->type)
    18881886    {
     
    19001898                break;
    19011899            /*  else fall through */
    1902         /// @todo (AH) later, we might want to handle these as well
    1903         case KeymapNotify:
    1904         case MappingNotify:
    19051900        default:
    19061901            return false; /* pass the event to Qt */
    19071902    }
    19081903
    1909     /* perform the mega-complex translation using the wine algorithms */
    1910     handleXKeyEvent (QX11Info::display(), event, &wineKeyboardInfo);
     1904    /* Translate the keycode to a PC scan code. */
     1905    unsigned scan = handleXKeyEvent (event);
    19111906
    19121907#if 0
    19131908    char buf [256];
    1914     sprintf (buf, "pr=%d kc=%08X st=%08X fl=%08lX scan=%04X",
     1909    sprintf (buf, "pr=%d kc=%08X st=%08X extended=%s scan=%04X",
    19151910             event->type == XKeyPress ? 1 : 0, event->xkey.keycode,
    1916              event->xkey.state, wineKeyboardInfo.dwFlags, wineKeyboardInfo.wScan);
     1911             event->xkey.state, scan >> 8 ? "true" : "false", scan & 0x7F);
    19171912    mMainWnd->statusBar()->message (buf);
    19181913    LogFlow (("### %s\n", buf));
    19191914#endif
    19201915
    1921     int scan = wineKeyboardInfo.wScan & 0x7F;
    19221916    // scancodes 0x00 (no valid translation) and 0x80 are ignored
    1923     if (!scan)
     1917    if (!scan & 0x7F)
    19241918        return true;
    19251919
     
    19271921
    19281922    int flags = 0;
    1929     if (wineKeyboardInfo.dwFlags & 0x0001)
     1923    if (scan >> 8)
    19301924        flags |= KeyExtended;
    19311925    if (event->type == XKeyPress)
    19321926        flags |= KeyPressed;
    19331927
     1928    /* Remove the extended flag */
     1929    scan &= 0x7F;
     1930
    19341931    switch (ks)
    19351932    {
    1936         case XK_Num_Lock:
    1937             // Wine sets the extended bit for the NumLock key. Reset it.
    1938             flags &= ~KeyExtended;
    1939             break;
    19401933        case XK_Print:
    19411934            flags |= KeyPrint;
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox4/src/linux/XKeyboard-new.cpp

    r5999 r7455  
    158158 * Translate an X server scancode to a PC keyboard scancode.
    159159 */
    160 void handleXKeyEvent(Display *, XEvent *event, WINEKEYBOARDINFO *wineKbdInfo)
     160unsigned handleXKeyEvent(XEvent *event)
    161161{
    162162    // call the WINE event handler
    163     XKeyEvent *keyEvent = &event->xkey;
    164     unsigned scan = X11DRV_KeyEvent(keyEvent->keycode);
    165     wineKbdInfo->wScan = scan & 0xFF;
    166     wineKbdInfo->dwFlags = scan >> 8;
     163    return X11DRV_KeyEvent(event->xkey.keycode);
    167164}
    168165
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox4/src/linux/keyboard-tables.h

    r6503 r7455  
    8282    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,              /* FF58 */
    8383    /* misc keys */
    84 /* innotek FIX */
    8584    /*?*/ 0, 0x137, /*?*/ 0, 0x152, 0x00, 0x00, 0x00, 0x15D,     /* FF60 */
    8685    /*?*/ 0, /*?*/ 0, 0x38, 0x146, 0x00, 0x00, 0x00, 0x00,       /* FF68 */
    8786    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,              /* FF70 */
    8887    /* keypad keys */
    89     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x138, 0x145,            /* FF78 */
     88    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x138, 0x45,             /* FF78 */
    9089    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,              /* FF80 */
    9190    0x00, 0x00, 0x00, 0x00, 0x00, 0x11C, 0x00, 0x00,             /* FF88 */
     
    9392    0x4D, 0x50, 0x49, 0x51, 0x4F, 0x4C, 0x52, 0x53,              /* FF98 */
    9493    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,              /* FFA0 */
    95 /* innotek FIX */
    9694    0x00, 0x00, 0x37, 0x4E, 0x53, 0x4A, 0x7e, 0x135,             /* FFA8 */
    9795    0x52, 0x4F, 0x50, 0x51, 0x4B, 0x4C, 0x4D, 0x47,              /* FFB0 */
     
    105103    /* modifier keys */
    106104    0x00, 0x2A, 0x36, 0x1D, 0x11D, 0x3A, 0x00, 0x38,             /* FFE0 */
    107 /* innotek FIX */
    108105    0x138, 0x38, 0x138, 0x15B, 0x15C, 0x00, 0x00, 0x00,          /* FFE8 */
    109106    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,              /* FFF0 */
     
    111108};
    112109
    113 /* innotek FIX */
    114110/* This list was put together using /usr/include/X11/XF86keysym.h and
    115111   http://www.win.tue.nl/~aeb/linux/kbd/scancodes-6.html.  It has not yet
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