Changeset 846 for trunk/src/gui/inputmethod/qximinputcontext_x11.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/inputmethod/qximinputcontext_x11.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 345 345 } 346 346 347 347 extern bool qt_use_rtl_extensions; // from qapplication_x11.cpp 348 #ifndef QT_NO_XKB 349 extern QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &variantName); 350 #endif 348 351 349 352 QXIMInputContext::QXIMInputContext() … … 376 379 QXIMInputContext::create_xim(); 377 380 #endif // USE_X11R6_XIM 381 382 #ifndef QT_NO_XKB 383 if (X11->use_xkb) { 384 QByteArray layoutName; 385 QByteArray variantName; 386 387 Atom type = XNone; 388 int format = 0; 389 ulong nitems = 0; 390 ulong bytesAfter = 0; 391 uchar *data = 0; 392 if (XGetWindowProperty(X11->display, RootWindow(X11->display, 0), ATOM(_XKB_RULES_NAMES), 0, 1024, 393 false, XA_STRING, &type, &format, &nitems, &bytesAfter, &data) == Success 394 && type == XA_STRING && format == 8 && nitems > 2) { 395 396 char *names[5] = { 0, 0, 0, 0, 0 }; 397 char *p = reinterpret_cast<char *>(data), *end = p + nitems; 398 int i = 0; 399 do { 400 names[i++] = p; 401 p += qstrlen(p) + 1; 402 } while (p < end); 403 404 QList<QByteArray> layoutNames = QByteArray::fromRawData(names[2], qstrlen(names[2])).split(','); 405 QList<QByteArray> variantNames = QByteArray::fromRawData(names[3], qstrlen(names[3])).split(','); 406 for (int i = 0; i < qMin(layoutNames.count(), variantNames.count()); ++i ) { 407 QByteArray variantName = variantNames.at(i); 408 const int dashPos = variantName.indexOf("-"); 409 if (dashPos >= 0) 410 variantName.truncate(dashPos); 411 QLocale keyboardInputLocale = q_getKeyboardLocale(layoutNames.at(i), variantName); 412 if (keyboardInputLocale.textDirection() == Qt::RightToLeft) 413 qt_use_rtl_extensions = true; 414 } 415 } 416 417 if (data) 418 XFree(data); 419 } 420 #endif // QT_NO_XKB 421 378 422 } 379 423
Note:
See TracChangeset
for help on using the changeset viewer.