src/gui/kernel/qkeymapper_x11.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    78 #undef IsPrivateKeypadKey
    78 #undef IsPrivateKeypadKey
    79 #define IsPrivateKeypadKey(keysym) \
    79 #define IsPrivateKeypadKey(keysym) \
    80       (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
    80       (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
    81 #endif
    81 #endif
    82 
    82 
    83 void q_getLocaleAndDirection(QLocale *locale,
    83 QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &variantName)
    84                                   Qt::LayoutDirection *direction,
       
    85                                   const QByteArray &layoutName,
       
    86                                   const QByteArray &variantName)
       
    87 {
    84 {
    88     int i = 0;
    85     int i = 0;
    89     while (xkbLayoutData[i].layout != 0) {
    86     while (xkbLayoutData[i].layout != 0) {
    90         if (layoutName == xkbLayoutData[i].layout && variantName == xkbLayoutData[i].variant) {
    87         if (layoutName == xkbLayoutData[i].layout && variantName == xkbLayoutData[i].variant)
    91             *locale = QLocale(xkbLayoutData[i].language, xkbLayoutData[i].country);
    88             return QLocale(xkbLayoutData[i].language, xkbLayoutData[i].country);
    92             *direction = xkbLayoutData[i].direction;
       
    93             return;
       
    94         }
       
    95         ++i;
    89         ++i;
    96     }
    90     }
    97     *locale = QLocale::c();
    91     return QLocale::c();
    98     *direction = Qt::LeftToRight;
       
    99 }
    92 }
   100 #endif // QT_NO_XKB
    93 #endif // QT_NO_XKB
   101 
    94 
   102 
    95 
   103 // from qapplication_x11.cpp
    96 // from qapplication_x11.cpp
   521 
   514 
   522         // ### ???
   515         // ### ???
   523         // if (keyboardLayoutName.isEmpty())
   516         // if (keyboardLayoutName.isEmpty())
   524         //     qWarning("Qt: unable to determine keyboard layout, please talk to qt-bugs@trolltech.com"); ?
   517         //     qWarning("Qt: unable to determine keyboard layout, please talk to qt-bugs@trolltech.com"); ?
   525 
   518 
   526         q_getLocaleAndDirection(&keyboardInputLocale,
   519         keyboardInputLocale = q_getKeyboardLocale(layoutName, variantName);
   527                               &keyboardInputDirection,
   520         keyboardInputDirection = keyboardInputLocale.textDirection();
   528                               layoutName,
       
   529                               variantName);
       
   530 
   521 
   531 #if 0
   522 #if 0
   532         qDebug() << "keyboard input locale ="
   523         qDebug() << "keyboard input locale ="
   533                  << keyboardInputLocale.name()
   524                  << keyboardInputLocale.name()
   534                  << "direction ="
   525                  << "direction ="