Changeset 802
- Timestamp:
- Oct 20, 2010, 9:39:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qkeymapper_pm.cpp
r668 r802 592 592 state = state ^ Qt::MetaModifier; 593 593 594 bool isNumLockOn = WinGetKeyState(HWND_DESKTOP, VK_NUMLOCK) & 0x0001; 595 594 596 // detect numeric keypad keys 595 597 if (chm.vkey == VK_ENTER || chm.vkey == VK_NUMLOCK) { … … 598 600 } else if (((chm.vkey >= VK_PAGEUP && chm.vkey <= VK_DOWN) || 599 601 chm.vkey == VK_INSERT || chm.vkey == VK_DELETE)) { 602 // these are numbers 0-9 and the numeric comma/dot 600 603 if ((chm.chr & 0xFF) != 0xE0) { 601 604 state |= Qt::KeypadModifier; … … 608 611 return false; 609 612 } 613 if (state & (Qt::KeyboardModifierMask & ~Qt::KeypadModifier)) { 614 // the OS/2 keyboard driver tends to invert the NumLock state 615 // when some modifiers (e.g. Shift) are pressed so that cursor 616 // movement event becomes a digit and and vice versa; we want 617 // to cancel replacing movements with digits to make it possible 618 // to e.g. select the text using numpad keys in NumLock OFF mode 619 // with Shift pressed. It seems that other applications (e.g. 620 // standard PM controls) do exactly the same. 621 if (!isNumLockOn) { 622 // suppress generation of digits 623 chm.chr = 0; 624 chm.fs &= ~KC_CHAR; 625 } 626 } 610 627 } 611 628 } … … 618 635 // hide the key from Qt (see above) 619 636 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; 625 653 break; 626 654 case 0x37: // *
Note:
See TracChangeset
for help on using the changeset viewer.