Ignore:
Timestamp:
Oct 20, 2010, 9:39:11 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Fixed: Make sure that pressing Shift[+Ctrl]]+<numpad_digit> will generate a cursor movement code in NumLock mode off instead of a digit. This is necessary to make it possible to select text using numpad keys with Shift pressed (closes #183).

File:
1 edited

Legend:

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

    r668 r802  
    592592        state = state ^ Qt::MetaModifier;
    593593
     594
     595
    594596    // detect numeric keypad keys
    595597    if (chm.vkey == VK_ENTER || chm.vkey == VK_NUMLOCK) {
     
    598600    } else if (((chm.vkey >= VK_PAGEUP && chm.vkey <= VK_DOWN) ||
    599601                chm.vkey == VK_INSERT || chm.vkey == VK_DELETE)) {
     602
    600603        if ((chm.chr & 0xFF) != 0xE0) {
    601604            state |= Qt::KeypadModifier;
     
    608611                return false;
    609612            }
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
    610627        }
    611628    }
     
    618635                // hide the key from Qt (see above)
    619636                return false;
    620             } else {
    621                 // scancode is zero if Numlock is set
    622                 if (!code)
    623                     code = Qt::Key_Clear;
    624             }
     637            }
     638            if (state & (Qt::KeyboardModifierMask & ~Qt::KeypadModifier)) {
     639                if (!isNumLockOn) {
     640                    // suppress generation of digits, see above (note that
     641                    // standard PM applications don't seem to do that for the
     642                    // "5" key; we correct it here as it seems more logical)
     643                    chm.chr = 0;
     644                    chm.fs &= ~KC_CHAR;
     645                }
     646            }
     647            // scancode is zero if Numlock is set
     648            if (!code)
     649                code = Qt::Key_Clear;
     650            // this key doesn't have a virtual key assigned, but pretend we're
     651            // a virtual key to avoid interpreting chm.chr as DBCS below
     652            chm.fs |= KC_VIRTUALKEY;
    625653            break;
    626654        case 0x37: // *
Note: See TracChangeset for help on using the changeset viewer.