VirtualBox

Ignore:
Timestamp:
Feb 20, 2013 3:25:56 PM (12 years ago)
Author:
vboxsync
Message:

FE/Common/VBoxKeyboard: only use XKB if it really returns the data we need.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/Common/VBoxKeyboard/keyboard.c

    r36335 r44765  
    548548/**
    549549 * Checks for the XKB extension, and if it is found initialises the X11 keycode
    550  * to XT scan code mapping by looking at the XKB names for each keycode.
     550 * to XT scan code mapping by looking at the XKB names for each keycode.  As it
     551 * turns out that XKB can return an empty list we make sure that the list holds
     552 * enough data to be useful to us.
    551553 */
    552554static unsigned
     
    555557    int major = XkbMajorVersion, minor = XkbMinorVersion;
    556558    XkbDescPtr pKBDesc;
     559    unsigned cFound = 0;
     560
    557561    if (!XkbLibraryVersion(&major, &minor))
    558562        return 0;
     
    575579                {
    576580                    keyc2scan[i] = xkbMap[j].uScan;
     581                    ++cFound;
    577582                    break;
    578583                }
     
    580585    XkbFreeNames(pKBDesc, XkbKeyNamesMask, True);
    581586    XkbFreeKeyboard(pKBDesc, XkbAllComponentsMask, True);
    582     return 1;
     587    return cFound >= 45 ? 1 : 0;
    583588}
    584589
Note: See TracChangeset for help on using the changeset viewer.

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