Changeset 6157 for trunk/src/user32/winkeyboard.cpp
- Timestamp:
- Jul 3, 2001, 10:36:54 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/winkeyboard.cpp
r6156 r6157 1 /* $Id: winkeyboard.cpp,v 1.1 0 2001-07-03 18:33:28sandervl Exp $ */1 /* $Id: winkeyboard.cpp,v 1.11 2001-07-03 20:36:54 sandervl Exp $ */ 2 2 /* 3 3 * Win32 <-> PM key translation … … 599 599 } 600 600 for(i=0;i<256;i++) { 601 if(lpKeyState[i] & 0x80) {601 if(lpKeyState[i]) { 602 602 dprintf2(("Win key 0x%0x = %x", i, lpKeyState[i])); 603 603 } … … 716 716 * Status : UNTESTED STUB 717 717 * 718 * Author : Partly based on Wine code (windows\x11drv\keyboard.c 719 * Copyright 1993 Bob Amstadt 720 * Copyright 1996 Albrecht Kleine 721 * Copyright 1997 David Faure 722 * Copyright 1998 Morten Welinder 723 * Copyright 1998 Ulrich Weigand 724 * Copyright 1999 Ove Kåven 725 * 718 * Author : SvL 726 719 *****************************************************************************/ 727 720 int WIN32API ToAscii(UINT uVirtKey, … … 731 724 UINT fuState) 732 725 { 733 dprintf(("USER32:ToAscii (% u,%u,%08xh,%08xh,%u) partially implemented",726 dprintf(("USER32:ToAscii (%x,%x,%08xh,%08xh,%x) partially implemented", 734 727 uVirtKey, uScanCode, lpbKeyState, lpwTransKey, fuState)); 735 728 … … 755 748 ret = 0; 756 749 } 750 else 751 if (uVirtKey == VK_ESCAPE) { 752 //NT returns VK_ESCAPE here 753 *(char*)lpwTransKey = VK_ESCAPE; 754 ret = 1; 755 } 757 756 else { 758 757 ULONG shiftstate = 0; … … 762 761 if(lpbKeyState[VK_LSHIFT] & 0x80) shiftstate |= TCF_LSHIFT; 763 762 if(lpbKeyState[VK_RSHIFT] & 0x80) shiftstate |= TCF_RSHIFT; 763 if(lpbKeyState[VK_SHIFT] & 0x80) shiftstate |= TCF_SHIFT; 764 764 if(lpbKeyState[VK_LCONTROL] & 0x80) shiftstate |= TCF_LCONTROL; 765 765 if(lpbKeyState[VK_RCONTROL] & 0x80) shiftstate |= TCF_RCONTROL; 766 if(lpbKeyState[VK_CONTROL] & 0x80) shiftstate |= TCF_CONTROL; 766 767 if(lpbKeyState[VK_LMENU] & 0x80) shiftstate |= TCF_ALT; 767 768 if(lpbKeyState[VK_RMENU] & 0x80) shiftstate |= TCF_ALTGR; 769 if(lpbKeyState[VK_MENU] & 0x80) shiftstate |= TCF_ALT; 768 770 if(lpbKeyState[VK_CAPITAL] & 1) shiftstate |= TCF_CAPSLOCK; 769 771 if(lpbKeyState[VK_NUMLOCK] & 1) shiftstate |= TCF_NUMLOCK; 770 772 771 *(char*)lpwTransKey = OSLibWinTranslateChar(uScanCode, TC_SCANCODETOCHAR, shiftstate); 772 773 ret = 1; 773 //NT only modifies the bytes it returns 774 *(char *)lpwTransKey = OSLibWinTranslateChar(uScanCode, TC_SCANCODETOCHAR, shiftstate); 775 776 if(shiftstate & TCF_CONTROL) { 777 if(uVirtKey >= VK_A && uVirtKey <= VK_Z) { 778 //NT returns key-0x60 (or so it seems) for ctrl-(shift-)-a..z 779 if(shiftstate & TCF_SHIFT) { 780 *(char *)lpwTransKey -= 0x40; 781 } 782 else *(char *)lpwTransKey -= 0x60; 783 } 784 else 785 if(uVirtKey == VK_SPACE) { 786 if(shiftstate & TCF_SHIFT) { 787 //NT returns 0 for ctrl-shift-space 788 *lpwTransKey = 0; 789 } 790 } 791 else { 792 //NT returns 0 for ctrl-0, ctrl-. 793 *lpwTransKey = 0; 794 } 795 } 796 797 if(*(char *)lpwTransKey == 0) { 798 ret = 0; 799 } 800 else ret = 1; 774 801 } 802 dprintf2(("USER32:ToAscii returned %x, len %d", *lpwTransKey, ret)); 775 803 return ret; 776 804 }
Note:
See TracChangeset
for help on using the changeset viewer.