Changeset 379 for trunk/src


Ignore:
Timestamp:
Dec 4, 2009, 2:37:54 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui/kernel: Added support for the IME input box used on DBCS systems (see #102).

Location:
trunk/src/gui/kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qapplication_pm.cpp

    r371 r379  
    889889                }
    890890                break;
     891            }
     892
     893            case WM_QUERYCONVERTPOS: { // IME input box position request
     894                // Ooops, how to get caret pos ?
     895                /// @todo (r=dmik) we should make usage of the QIMEvent
     896                //  to query widgets about IME data (see how/where this event
     897                //  is used across the sources)
     898
     899                PRECTL pcp = (PRECTL)mp1;
     900                CURSORINFO ci;
     901
     902                WinQueryCursorInfo(HWND_DESKTOP, &ci);
     903
     904                memset(pcp, 0xFF, sizeof(RECTL));
     905
     906                pcp->xLeft = ci.x;
     907                pcp->yBottom = ci.y;
     908                WinMapWindowPoints(ci.hwnd, hwnd, (PPOINTL)pcp, 2);
     909
     910                return (MRESULT)QCP_CONVERT;
    891911            }
    892912
  • trunk/src/gui/kernel/qkeymapper_pm.cpp

    r353 r379  
    7171    KeyRecorder() : nrecs(0) {}
    7272
    73     inline KeyRecord *findKey(int code, bool remove);
     73    inline KeyRecord *findKey(int scan, bool remove);
    7474    inline void storeKey(int scan, int code, int state, const QString& text);
    7575    inline void clearKeys();
     
    8484{
    8585    KeyRecord *result = 0;
     86
     87    if(scan == 0) // DBCS chars or user-injected keys
     88                return result;
     89
    8690    for (int i = 0; i < nrecs; ++i) {
    8791        if (records[i].scan == scan) {
     
    106110void KeyRecorder::storeKey(int scan, int code, int state, const QString& text)
    107111{
     112    if(scan == 0 && code == 0) // DBCS chars or user-injected keys
     113        return;
     114
    108115    Q_ASSERT_X(nrecs != QT_MAX_KEY_RECORDINGS,
    109116               "Internal KeyRecorder",
     
    369376        state = state ^ Qt::MetaModifier;
    370377
     378    // Note: code and/or chm.scancode may be zero here. We cannot ignore such
     379    // events because, for example, all non-ASCII letters have zero virtual
     380    // codes, and DBCS characters entered via IME have both zero virtual codes
     381    // and zero scancodes. However, if both code and chm.scancode are zero
     382    // (as for DBCS), storeKey()/findKey() will do nothing which means that:
     383    //
     384    //   1) QKeyEvents will not have the auto-repeat flag set when a key is
     385    //      being auto-repeated by the system;
     386    //   2) there will be no QEvent::KeyRelease event corresponding to the
     387    //      QEvent::KeyPress event.
     388    //
     389    // This seems to be acceptable.
     390
    371391    // KEYDOWN -----------------------------------------------------------------
    372392    if (!(chm.fs & KC_KEYUP)) {
Note: See TracChangeset for help on using the changeset viewer.