All pastes #44577 Raw Edit

Something

public text v1 · immutable
#44577 ·published 2006-03-05 18:58 UTC
rendered paste body
KeyCode
figure_keycode(const char *name)
{
    KeySym keysym;

    if ( (keysym = XStringToKeysym(name)) == NoSymbol)
    {
        const char *alt = 0;

        cerr << "Unknown key \"" << name << '\"';

        //
        // Try to print an hint to the user.
        //
        if (strcasecmp(name, "Esc") == 0)
        {
            alt = "Escape";
        }

        if (alt != 0)
        {
            cerr << ", perhaps you meant \"" << alt << "\"?";
        }

        // If there was an hint available, it was printed.
        // Now end the message.

        cerr << endl;

        return 0;    // Failure
    }

    return XKeysymToKeycode(display, keysym);
}