- Timestamp:
- Jul 3, 2001, 8:33:28 PM (24 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibwin.cpp
r6149 r6156 1 /* $Id: oslibwin.cpp,v 1.10 3 2001-07-03 13:23:31sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.104 2001-07-03 18:33:26 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 827 827 //****************************************************************************** 828 828 //****************************************************************************** 829 #define TC_CHARTOSCANCODE 0830 #define TC_SCANCODETOCHAR 1831 #define TC_VIRTUALKEYTOSCANCODE 2832 #define TC_SCANCODETOVIRTUALKEY 3833 #define TC_SCANTOOEMSCAN 4834 #define TC_OEMSCANTOSCAN 5835 836 829 USHORT APIENTRY WinTranslateChar2( USHORT /* Codepage (currently ignored) */ 837 830 , PUSHORT /* Ptr to char to translate */ … … 842 835 //****************************************************************************** 843 836 //****************************************************************************** 844 USHORT OSLibWinTranslateChar(USHORT usScanCode) 845 { 846 USHORT fsShift = 0; 847 848 WinTranslateChar2(0, &usScanCode, NULL, TC_SCANCODETOVIRTUALKEY, 849 &fsShift); 837 USHORT OSLibWinTranslateChar(USHORT usScanCode, ULONG type, USHORT shiftstate) 838 { 839 WinTranslateChar2(0, &usScanCode, NULL, type, &shiftstate); 850 840 return usScanCode; 851 841 } -
trunk/src/user32/oslibwin.h
r6149 r6156 1 /* $Id: oslibwin.h,v 1.5 8 2001-07-03 13:23:32sandervl Exp $ */1 /* $Id: oslibwin.h,v 1.59 2001-07-03 18:33:27 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 278 278 BOOL OSLibWinGetKeyboardStateTable(unsigned char * PMKeyState); 279 279 BOOL OSLibWinSetKeyboardStateTable(unsigned char * PMKeyState); 280 USHORT OSLibWinTranslateChar(USHORT usScanCode); 280 281 #define TCF_LSHIFT 0x0001 282 #define TCF_RSHIFT 0x0002 283 #define TCF_SHIFT (TCF_LSHIFT | TCF_RSHIFT) 284 #define TCF_LCONTROL 0x0004 285 #define TCF_RCONTROL 0x0008 286 #define TCF_CONTROL (TCF_LCONTROL | TCF_RCONTROL) 287 #define TCF_ALT 0x0010 288 #define TCF_ALTGR 0x0020 289 #define TCF_CAPSLOCK 0x0040 290 #define TCF_NUMLOCK 0x0080 291 #define TCF_OEMSCANCODE 0x0100 292 #define TCF_EXTENDEDKEY 0x0200 293 294 #define TC_CHARTOSCANCODE 0 295 #define TC_SCANCODETOCHAR 1 296 #define TC_VIRTUALKEYTOSCANCODE 2 297 #define TC_SCANCODETOVIRTUALKEY 3 298 #define TC_SCANTOOEMSCAN 4 299 #define TC_OEMSCANTOSCAN 5 300 301 USHORT OSLibWinTranslateChar(USHORT usScanCode, ULONG type, USHORT shiftstate); 281 302 282 303 #define HTOS_NORMAL 0 -
trunk/src/user32/user32.cpp
r6082 r6156 1 /* $Id: user32.cpp,v 1.10 3 2001-06-23 09:14:06sandervl Exp $ */1 /* $Id: user32.cpp,v 1.104 2001-07-03 18:33:27 sandervl Exp $ */ 2 2 3 3 /* … … 1036 1036 nlen = 0; 1037 1037 size = sizeof(WINHELP) + nlen + dsize; 1038 hwh = GlobalAlloc(0,size); 1038 #if 1 1039 hwh = GlobalAlloc(GMEM_SHARE,size); 1039 1040 lpwh = (WINHELP*)GlobalLock(hwh); 1041 #else 1042 hwh = (HANDLE)_smalloc(size); 1043 lpwh = (WINHELP*)hwh; 1044 #endif 1040 1045 lpwh->size = size; 1041 1046 lpwh->command = uCommand; … … 1322 1327 } 1323 1328 /***************************************************************************** 1324 * Name : int WIN32API ToUnicode1325 * Purpose : The ToUnicode function translates the specified virtual-key code1326 * and keyboard state to the corresponding Unicode character or characters.1327 * Parameters: UINT wVirtKey virtual-key code1328 * UINT wScanCode scan code1329 * PBYTE lpKeyState address of key-state array1330 * LPWSTR pwszBuff buffer for translated key1331 * int cchBuff size of translated key buffer1332 * UINT wFlags set of function-conditioning flags1333 * Variables :1334 * Result : - 1 The specified virtual key is a dead-key character (accent or1335 * diacritic). This value is returned regardless of the keyboard1336 * layout, even if several characters have been typed and are1337 * stored in the keyboard state. If possible, even with Unicode1338 * keyboard layouts, the function has written a spacing version of1339 * the dead-key character to the buffer specified by pwszBuffer.1340 * For example, the function writes the character SPACING ACUTE1341 * (0x00B4), rather than the character NON_SPACING ACUTE (0x0301).1342 * 0 The specified virtual key has no translation for the current1343 * state of the keyboard. Nothing was written to the buffer1344 * specified by pwszBuffer.1345 * 1 One character was written to the buffer specified by pwszBuffer.1346 * 2 or more Two or more characters were written to the buffer specified by1347 * pwszBuff. The most common cause for this is that a dead-key1348 * character (accent or diacritic) stored in the keyboard layout1349 * could not be combined with the specified virtual key to form a1350 * single character.1351 * Remark :1352 * Status : UNTESTED STUB1353 *1354 * Author : Patrick Haller [Thu, 1998/02/26 11:55]1355 *****************************************************************************/1356 int WIN32API ToUnicode(UINT uVirtKey,1357 UINT uScanCode,1358 PBYTE lpKeyState,1359 LPWSTR pwszBuff,1360 int cchBuff,1361 UINT wFlags)1362 {1363 dprintf(("USER32:ToUnicode (%u,%u,%08xh,%08xh,%u,%08x) not implemented.\n",1364 uVirtKey,1365 uScanCode,1366 lpKeyState,1367 pwszBuff,1368 cchBuff,1369 wFlags));1370 1371 return (0);1372 }1373 /*****************************************************************************1374 1329 * Name : BOOL WIN32API UnloadKeyboardLayout 1375 1330 * Purpose : The UnloadKeyboardLayout function removes a keyboard layout. -
trunk/src/user32/winkeyboard.cpp
r6149 r6156 1 /* $Id: winkeyboard.cpp,v 1. 9 2001-07-03 13:23:32sandervl Exp $ */1 /* $Id: winkeyboard.cpp,v 1.10 2001-07-03 18:33:28 sandervl Exp $ */ 2 2 /* 3 3 * Win32 <-> PM key translation … … 563 563 for(int i=1;i<nrkeys;i++) { 564 564 if(abWinVKeyToPMScan[i]) { 565 winkey[i] = pmkey[OSLibWinTranslateChar(abWinVKeyToPMScan[i] )];565 winkey[i] = pmkey[OSLibWinTranslateChar(abWinVKeyToPMScan[i], TC_SCANCODETOVIRTUALKEY, 0)]; 566 566 } 567 567 } … … 716 716 * Status : UNTESTED STUB 717 717 * 718 * Author : Based on Wine code (windows\x11drv\keyboard.c718 * Author : Partly based on Wine code (windows\x11drv\keyboard.c 719 719 * Copyright 1993 Bob Amstadt 720 720 * Copyright 1996 Albrecht Kleine … … 747 747 return 0; 748 748 } 749 #if 0 750 /* We have a special case to handle : Shift + arrow, shift + home, ... 751 X returns a char for it, but Windows doesn't. Let's eat it. */ 752 if(!(lpbKeyState[VK_NUMLOCK] & 0x01) /* NumLock is off */ 753 && (lpbKeyState[VK_SHIFT] & 0x80) /* Shift is pressed */ 754 && (uVirtKey >= VK_0) && (uVirtKey >= VK_9)) 755 { 756 *(char*)lpwTransKey = 0; 757 ret = 0; 758 } 759 else 760 #endif 749 761 750 /* We have another special case for delete key (XK_Delete) on an 762 751 extended keyboard. X returns a char for it, but Windows doesn't */ … … 767 756 } 768 757 else { 769 if(uVirtKey >= VK_A && uVirtKey <= VK_Z && !(lpbKeyState[VK_SHIFT] & 0x80)) { 770 *(char*)lpwTransKey = uVirtKey + 32; //translate to lower case 771 } 772 else *(char*)lpwTransKey = uVirtKey; 758 ULONG shiftstate = 0; 759 760 //TODO: multiple characters returned (DBCS??) 761 762 if(lpbKeyState[VK_LSHIFT] & 0x80) shiftstate |= TCF_LSHIFT; 763 if(lpbKeyState[VK_RSHIFT] & 0x80) shiftstate |= TCF_RSHIFT; 764 if(lpbKeyState[VK_LCONTROL] & 0x80) shiftstate |= TCF_LCONTROL; 765 if(lpbKeyState[VK_RCONTROL] & 0x80) shiftstate |= TCF_RCONTROL; 766 if(lpbKeyState[VK_LMENU] & 0x80) shiftstate |= TCF_ALT; 767 if(lpbKeyState[VK_RMENU] & 0x80) shiftstate |= TCF_ALTGR; 768 if(lpbKeyState[VK_CAPITAL] & 1) shiftstate |= TCF_CAPSLOCK; 769 if(lpbKeyState[VK_NUMLOCK] & 1) shiftstate |= TCF_NUMLOCK; 770 771 *(char*)lpwTransKey = OSLibWinTranslateChar(uScanCode, TC_SCANCODETOCHAR, shiftstate); 772 773 773 ret = 1; 774 774 } … … 815 815 return (0); 816 816 } 817 //****************************************************************************** 818 //****************************************************************************** 817 /***************************************************************************** 818 * Name : int WIN32API ToUnicode 819 * Purpose : The ToUnicode function translates the specified virtual-key code 820 * and keyboard state to the corresponding Unicode character or characters. 821 * Parameters: UINT wVirtKey virtual-key code 822 * UINT wScanCode scan code 823 * PBYTE lpKeyState address of key-state array 824 * LPWSTR pwszBuff buffer for translated key 825 * int cchBuff size of translated key buffer 826 * UINT wFlags set of function-conditioning flags 827 * Variables : 828 * Result : - 1 The specified virtual key is a dead-key character (accent or 829 * diacritic). This value is returned regardless of the keyboard 830 * layout, even if several characters have been typed and are 831 * stored in the keyboard state. If possible, even with Unicode 832 * keyboard layouts, the function has written a spacing version of 833 * the dead-key character to the buffer specified by pwszBuffer. 834 * For example, the function writes the character SPACING ACUTE 835 * (0x00B4), rather than the character NON_SPACING ACUTE (0x0301). 836 * 0 The specified virtual key has no translation for the current 837 * state of the keyboard. Nothing was written to the buffer 838 * specified by pwszBuffer. 839 * 1 One character was written to the buffer specified by pwszBuffer. 840 * 2 or more Two or more characters were written to the buffer specified by 841 * pwszBuff. The most common cause for this is that a dead-key 842 * character (accent or diacritic) stored in the keyboard layout 843 * could not be combined with the specified virtual key to form a 844 * single character. 845 * Remark : 846 * Status : UNTESTED STUB 847 * 848 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 849 *****************************************************************************/ 850 int WIN32API ToUnicode(UINT uVirtKey, 851 UINT uScanCode, 852 PBYTE lpKeyState, 853 LPWSTR pwszBuff, 854 int cchBuff, 855 UINT wFlags) 856 { 857 dprintf(("USER32:ToUnicode (%u,%u,%08xh,%08xh,%u,%08x) not implemented.\n", 858 uVirtKey, 859 uScanCode, 860 lpKeyState, 861 pwszBuff, 862 cchBuff, 863 wFlags)); 864 865 return (0); 866 } 867 //****************************************************************************** 868 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.