Changeset 6801 for trunk/src/user32/winkeyboard.cpp
- Timestamp:
- Sep 24, 2001, 6:24:59 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/winkeyboard.cpp
r6339 r6801 1 /* $Id: winkeyboard.cpp,v 1.1 4 2001-07-15 14:58:12 sandervlExp $ */1 /* $Id: winkeyboard.cpp,v 1.15 2001-09-24 16:24:59 phaller Exp $ */ 2 2 /* 3 3 * Win32 <-> PM key translation … … 7 7 * 8 8 */ 9 10 #include <odin.h> 11 #include <odinwrap.h> 12 #include <os2sel.h> 13 9 14 #include <os2win.h> 10 #include <odin.h> 15 11 16 #include <string.h> 12 17 #include <stdio.h> … … 20 25 #define DBG_LOCALLOG DBG_winkeyboard 21 26 #include "dbglocal.h" 27 28 29 30 31 ODINDEBUGCHANNEL(USER32-WINKBD) 32 22 33 23 34 BOOL OPEN32API _O32_GetKeyboardState( PBYTE lpKeyState ); … … 561 572 //****************************************************************************** 562 573 //****************************************************************************** 563 void WIN32API KeyTranslatePMToWinBuf(BYTE *pmkey, BYTE *winkey, int nrkeys) 574 575 ODINPROCEDURE3(KeyTranslatePMToWinBuf, 576 BYTE *, pmkey, 577 BYTE *, winkey, 578 int, nrkeys) 564 579 { 565 580 for(int i=1;i<nrkeys;i++) { … … 574 589 //****************************************************************************** 575 590 //****************************************************************************** 576 int WIN32API GetKeyboardType( int nTypeFlag) 591 ODINFUNCTION1(int, GetKeyboardType, 592 int, nTypeFlag) 577 593 { 578 594 dprintf(("USER32: GetKeyboardType %x", nTypeFlag)); … … 581 597 //****************************************************************************** 582 598 //****************************************************************************** 583 BOOL WIN32API GetKeyboardState(PBYTE lpKeyState) 599 ODINFUNCTION1(BOOL, GetKeyboardState, 600 PBYTE, lpKeyState) 584 601 { 585 602 BYTE PMKeyState[256]; … … 612 629 //****************************************************************************** 613 630 //****************************************************************************** 614 BOOL WIN32API SetKeyboardState(PBYTE lpKeyState) 631 ODINFUNCTION1(BOOL, SetKeyboardState, 632 PBYTE, lpKeyState) 615 633 { 616 634 dprintf(("USER32: SetKeyboardState %x not implemented", lpKeyState)); … … 625 643 */ 626 644 // * Remark : Based on Wine version (991031) 627 HKL WIN32API GetKeyboardLayout(DWORD dwLayout) 645 ODINFUNCTION1(HKL, GetKeyboardLayout, 646 DWORD, dwLayout) 628 647 { 629 648 HKL layout; … … 647 666 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 648 667 *****************************************************************************/ 649 INT WIN32API GetKeyboardLayoutNameA(LPTSTR pwszKLID) 650 { 651 dprintf(("USER32:GetKeyboardLayoutNameA")); 668 ODINFUNCTION1(INT, GetKeyboardLayoutNameA, 669 LPSTR, pwszKLID) 670 { 671 dprintf(("not correctly implemented")); 652 672 653 673 sprintf(pwszKLID, "%08x",GetKeyboardLayout(0)); 654 674 return 1; 655 675 } 676 677 656 678 /***************************************************************************** 657 679 * Name : BOOL WIN32API GetKeyboardLayoutNameW … … 668 690 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 669 691 *****************************************************************************/ 670 INT WIN32API GetKeyboardLayoutNameW(LPWSTR pwszKLID) 692 ODINFUNCTION1(INT, GetKeyboardLayoutNameW, 693 LPWSTR, pwszKLID) 671 694 { 672 695 LPSTR buf = (LPSTR)HEAP_xalloc( GetProcessHeap(), 0, strlen("00000409")+1); 673 696 674 dprintf(("USER32:GetKeyboardLayoutNameA"));675 697 int res = GetKeyboardLayoutNameA(buf); 676 698 lstrcpyAtoW(pwszKLID,buf); … … 689 711 * Remark : Based on Wine version (991031) 690 712 */ 691 INT WINAPI GetKeyboardLayoutList(INT nBuff,HKL *layouts) 692 { 693 dprintf(("GetKeyboardLayoutList(%d,%p)\n",nBuff,layouts));694 if (!nBuff || !layouts) 695 return 1;696 if (layouts)697 layouts[0] = GetKeyboardLayout(0);713 ODINFUNCTION2(INT, GetKeyboardLayoutList, 714 INT, nBuff, 715 HKL *, layouts) 716 { 717 dprintf(("not correctly implemented")); 718 719 if (!nBuff || !layouts) 698 720 return 1; 721 722 if (layouts) 723 layouts[0] = GetKeyboardLayout(0); 724 725 return 1; 699 726 } 700 727 /***************************************************************************** … … 720 747 * Author : SvL 721 748 *****************************************************************************/ 722 int WIN32API ToAscii(UINT uVirtKey, 723 UINT uScanCode, 724 PBYTE lpbKeyState, 725 LPWORD lpwTransKey, 726 UINT fuState) 727 { 728 dprintf(("USER32:ToAscii (%x,%x,%08xh,%08xh,%x) partially implemented", 729 uVirtKey, uScanCode, lpbKeyState, lpwTransKey, fuState)); 730 749 750 ODINFUNCTION5(int, ToAscii, 751 UINT, uVirtKey, 752 UINT, uScanCode, 753 PBYTE, lpbKeyState, 754 LPWORD, lpwTransKey, 755 UINT, fuState) 756 { 731 757 INT ret; 732 758 … … 828 854 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 829 855 *****************************************************************************/ 830 int WIN32API ToAsciiEx(UINT uVirtKey, 831 UINT uScanCode, 832 PBYTE lpbKeyState, 833 LPWORD lpwTransKey, 834 UINT fuState, 835 HKL hkl) 836 { 837 dprintf(("USER32:ToAsciiEx (%u,%u,%08xh,%08xh,%u,%08x) partially implemented", 838 uVirtKey, 839 uScanCode, 840 lpbKeyState, 841 lpwTransKey, 842 fuState, 843 hkl)); 856 857 ODINFUNCTION6(int, ToAsciiEx, 858 UINT, uVirtKey, 859 UINT, uScanCode, 860 PBYTE, lpbKeyState, 861 LPWORD, lpwTransKey, 862 UINT, fuState, 863 HKL, hkl) 864 { 865 dprintf(("imcompletely implemented")); 844 866 845 867 return ToAscii(uVirtKey, uScanCode, lpbKeyState, lpwTransKey, fuState); … … 878 900 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 879 901 *****************************************************************************/ 880 int WIN32API ToUnicode(UINT uVirtKey, 881 UINT uScanCode, 882 PBYTE lpKeyState, 883 LPWSTR pwszBuff, 884 int cchBuff, 885 UINT wFlags) 886 { 887 dprintf(("USER32:ToUnicode (%u,%u,%08xh,%08xh,%u,%08x) not implemented.\n", 888 uVirtKey, 889 uScanCode, 890 lpKeyState, 891 pwszBuff, 892 cchBuff, 893 wFlags)); 902 903 ODINFUNCTION6(int, ToUnicode, 904 UINT, uVirtKey, 905 UINT, uScanCode, 906 PBYTE, lpKeyState, 907 LPWSTR, pwszBuff, 908 int, cchBuff, 909 UINT, wFlags) 910 { 911 dprintf(("not implemented.\n")); 894 912 895 913 return (0); … … 912 930 *****************************************************************************/ 913 931 914 UINT WIN32API GetKBCodePage(VOID)932 ODINFUNCTION0(UINT, GetKBCodePage) 915 933 { 916 934 return (GetOEMCP()); … … 918 936 //****************************************************************************** 919 937 //****************************************************************************** 920 int WIN32API GetKeyNameTextA( LPARAM lParam, LPSTR lpString, int nSize) 921 { 922 dprintf(("USER32: GetKeyNameTextA\n")); 923 return O32_GetKeyNameText(lParam,lpString,nSize); 924 } 925 //****************************************************************************** 926 //****************************************************************************** 927 int WIN32API GetKeyNameTextW( LPARAM lParam, LPWSTR lpString, int nSize) 928 { 929 dprintf(("USER32: GetKeyNameTextW DOES NOT WORK\n")); 938 ODINFUNCTION3(int, GetKeyNameTextA, 939 LPARAM, lParam, 940 LPSTR, lpString, 941 int, nSize) 942 { 943 return O32_GetKeyNameText(lParam,lpString,nSize); 944 } 945 //****************************************************************************** 946 //****************************************************************************** 947 ODINFUNCTION3(int, GetKeyNameTextW, 948 LPARAM, lParam, 949 LPWSTR, lpString, 950 int, nSize) 951 { 952 dprintf(("USER32: GetKeyNameTextW DOES NOT WORK (not implemented)\n")); 930 953 // NOTE: This will not work as is (needs UNICODE support) 931 954 return 0; … … 934 957 //****************************************************************************** 935 958 //****************************************************************************** 936 SHORT WIN32API GetKeyState( int nVirtKey) 937 { 938 dprintf2(("USER32: GetKeyState %x", nVirtKey)); 959 ODINFUNCTION1(SHORT, GetKeyState, 960 int, nVirtKey) 961 { 962 return O32_GetKeyState(nVirtKey); 963 } 964 //****************************************************************************** 965 //****************************************************************************** 966 ODINFUNCTION1(WORD, GetAsyncKeyState, 967 INT, nVirtKey) 968 { 969 if(fVersionWarp3) 970 { 971 dprintf(("WARNING: not correctly implemented for Warp 3")); 972 //Not present in Warp 3's PMWINX 939 973 return O32_GetKeyState(nVirtKey); 940 } 941 //****************************************************************************** 942 //****************************************************************************** 943 WORD WIN32API GetAsyncKeyState(INT nVirtKey) 944 { 945 dprintf2(("USER32: GetAsyncKeyState %x", nVirtKey)); 946 if(fVersionWarp3) {//Not present in Warp 3's PMWINX 947 return O32_GetKeyState(nVirtKey); 948 } 949 else return O32_GetAsyncKeyState(nVirtKey); 950 } 951 //****************************************************************************** 952 //****************************************************************************** 953 UINT WIN32API MapVirtualKeyA( UINT uCode, UINT uMapType) 954 { 955 dprintf(("USER32: MapVirtualKeyA %x %x", uCode, uMapType)); 956 /* A quick fix for Commandos, very incomplete */ 957 switch (uMapType) { 974 } 975 else 976 return O32_GetAsyncKeyState(nVirtKey); 977 } 978 //****************************************************************************** 979 //****************************************************************************** 980 ODINFUNCTION2(UINT, MapVirtualKeyA, 981 UINT, uCode, 982 UINT, uMapType) 983 { 984 dprintf(("imcompletely implemented")); 985 /* A quick fix for Commandos, very incomplete */ 986 switch (uMapType) 987 { 958 988 case 2: 959 if (uCode >= VK_A && uCode <= VK_Z) { 960 return 'A' + uCode - VK_A; 989 if (uCode >= VK_A && uCode <= VK_Z) 990 { 991 return 'A' + uCode - VK_A; 961 992 } 962 993 break; 963 } 964 return O32_MapVirtualKey(uCode,uMapType); 965 } 966 //****************************************************************************** 967 //****************************************************************************** 968 UINT WIN32API MapVirtualKeyW( UINT uCode, UINT uMapType) 969 { 970 dprintf(("USER32: MapVirtualKeyW\n")); 971 // NOTE: This will not work as is (needs UNICODE support) 972 return O32_MapVirtualKey(uCode,uMapType); 994 } 995 return O32_MapVirtualKey(uCode, uMapType); 996 } 997 //****************************************************************************** 998 //****************************************************************************** 999 ODINFUNCTION2(UINT, MapVirtualKeyW, 1000 UINT, uCode, 1001 UINT, uMapType) 1002 { 1003 dprintf(("incorrectly implemented\n")); 1004 1005 // NOTE: This will not work as is (needs UNICODE support) 1006 return O32_MapVirtualKey(uCode,uMapType); 973 1007 } 974 1008 /***************************************************************************** … … 989 1023 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 990 1024 *****************************************************************************/ 991 UINT WIN32API MapVirtualKeyExA(UINT uCode, UINT uMapType, HKL dwhkl) 992 { 993 dprintf(("USER32:MapVirtualKeyExA (%u,%u,%08x) partially implemented",994 uCode,995 uMapType, 996 dwhkl));1025 ODINFUNCTION3(UINT, MapVirtualKeyExA, 1026 UINT, uCode, 1027 UINT, uMapType, 1028 HKL, dwhkl) 1029 { 1030 dprintf(("incompletely implemented")); 997 1031 998 1032 return MapVirtualKeyA(uCode, uMapType); … … 1015 1049 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1016 1050 *****************************************************************************/ 1017 UINT WIN32API MapVirtualKeyExW(UINT uCode, UINT uMapType, HKL dwhkl) 1018 { 1019 dprintf(("USER32:MapVirtualKeyExW (%u,%u,%08x) partially implemented", 1020 uCode, uMapType, dwhkl)); 1051 ODINFUNCTION3(UINT, MapVirtualKeyExW, 1052 UINT, uCode, 1053 UINT, uMapType, 1054 HKL, dwhkl) 1055 { 1056 dprintf(("incompletely implemented")); 1021 1057 1022 1058 return MapVirtualKeyW(uCode, uMapType); … … 1036 1072 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1037 1073 *****************************************************************************/ 1038 DWORD WIN32API OemKeyScan(WORD wOemChar) 1039 { 1040 dprintf(("USER32:OemKeyScan (%u) not implemented.\n", 1041 wOemChar));1074 ODINFUNCTION1(DWORD, OemKeyScan, 1075 WORD, wOemChar) 1076 { 1077 dprintf(("not implemented.\n")); 1042 1078 1043 1079 return (wOemChar); … … 1045 1081 //****************************************************************************** 1046 1082 //****************************************************************************** 1047 BOOL WIN32API RegisterHotKey(HWND hwnd, int idHotKey, UINT fuModifiers, UINT uVirtKey) 1048 { 1049 dprintf(("USER32: RegisterHotKey %x %d %x %x not implemented", hwnd, idHotKey, fuModifiers, uVirtKey)); 1083 ODINFUNCTION4(BOOL, RegisterHotKey, 1084 HWND, hwnd, 1085 int, idHotKey, 1086 UINT, fuModifiers, 1087 UINT, uVirtKey) 1088 { 1089 dprintf(("not implemented")); 1090 1050 1091 hwnd = Win32ToOS2Handle(hwnd); 1051 1092 return(TRUE); … … 1053 1094 //****************************************************************************** 1054 1095 //****************************************************************************** 1055 BOOL WIN32API UnregisterHotKey(HWND hwnd, int idHotKey) 1056 { 1057 dprintf(("USER32: UnregisterHotKey %x %d not implemented", hwnd, idHotKey)); 1096 ODINFUNCTION2(BOOL, UnregisterHotKey, 1097 HWND, hwnd, 1098 int, idHotKey) 1099 { 1100 dprintf(("not implemented")); 1101 1058 1102 hwnd = Win32ToOS2Handle(hwnd); 1059 1103 1060 1104 return(TRUE); 1061 1105 } 1106 1062 1107 //****************************************************************************** 1063 1108 //SvL: 24-6-'97 - Added 1064 1109 //****************************************************************************** 1065 WORD WIN32API VkKeyScanA( char ch) 1066 { 1067 dprintf(("USER32: VkKeyScanA %x", ch)); 1068 return O32_VkKeyScan(ch); 1069 } 1070 //****************************************************************************** 1071 //****************************************************************************** 1072 WORD WIN32API VkKeyScanW( WCHAR wch) 1073 { 1074 dprintf(("USER32: VkKeyScanW %x", wch)); 1075 // NOTE: This will not work as is (needs UNICODE support) 1076 return O32_VkKeyScan((char)wch); 1110 ODINFUNCTION1(WORD, VkKeyScanA, 1111 char, ch) 1112 { 1113 return O32_VkKeyScan(ch); 1114 } 1115 //****************************************************************************** 1116 //****************************************************************************** 1117 ODINFUNCTION1(WORD, VkKeyScanW, 1118 WCHAR, wch) 1119 { 1120 dprintf(("incorrectly implemented")); 1121 // NOTE: This will not work as is (needs UNICODE support) 1122 return O32_VkKeyScan((char)wch); 1077 1123 } 1078 1124 /***************************************************************************** … … 1091 1137 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1092 1138 *****************************************************************************/ 1093 WORD WIN32API VkKeyScanExW(WCHAR uChar,1094 HKL hkl)1095 { 1096 dprintf(("USER32:VkKeyScanExW (%u,%08x) partially implemented", 1097 uChar,hkl));1139 ODINFUNCTION2(WORD, VkKeyScanExW, 1140 WCHAR, uChar, 1141 HKL, hkl) 1142 { 1143 dprintf(("partially implemented")); 1098 1144 1099 1145 return VkKeyScanW(uChar); … … 1114 1160 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1115 1161 *****************************************************************************/ 1116 WORD WIN32API VkKeyScanExA(CHAR uChar,1117 HKL hkl)1118 { 1119 dprintf(("USER32:VkKeyScanExA (%u,%08x) partially implemented", 1120 uChar, hkl));1162 ODINFUNCTION2(WORD, VkKeyScanExA, 1163 CHAR, uChar, 1164 HKL, hkl) 1165 { 1166 dprintf(("partially implemented")); 1121 1167 1122 1168 return VkKeyScanA(uChar); … … 1140 1186 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1141 1187 *****************************************************************************/ 1142 VOID WIN32API keybd_event (BYTE bVk, 1143 BYTE bScan, 1144 DWORD dwFlags, 1145 DWORD dwExtraInfo) 1146 { 1147 dprintf(("USER32:keybd_event (%u,%u,%08xh,%08x) not implemented.\n", 1148 bVk, 1149 bScan, 1150 dwFlags, 1151 dwExtraInfo)); 1188 ODINPROCEDURE4(keybd_event, 1189 BYTE, bVk, 1190 BYTE, bScan, 1191 DWORD, dwFlags, 1192 DWORD, dwExtraInfo) 1193 { 1194 dprintf(("not implemented.\n")); 1152 1195 } 1153 1196 /***************************************************************************** … … 1168 1211 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1169 1212 *****************************************************************************/ 1170 HKL WIN32API LoadKeyboardLayoutA(LPCTSTR pwszKLID, 1171 UINT Flags) 1213 ODINFUNCTION2(HKL, LoadKeyboardLayoutA, 1214 LPCSTR, pwszKLID, 1215 UINT, Flags) 1172 1216 { 1173 1217 dprintf(("USER32:LeadKeyboardLayoutA (%s,%u) not implemented.\n", … … 1194 1238 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1195 1239 *****************************************************************************/ 1196 HKL WIN32API LoadKeyboardLayoutW(LPCWSTR pwszKLID, 1197 UINT Flags) 1198 { 1199 dprintf(("USER32:LeadKeyboardLayoutW (%s,%u) not implemented.\n", 1240 ODINFUNCTION2(HKL, LoadKeyboardLayoutW, 1241 LPCWSTR, pwszKLID, 1242 UINT, Flags) 1243 { 1244 dprintf(("USER32:LoadKeyboardLayoutW (%ls,%u) not implemented.\n", 1200 1245 pwszKLID, 1201 1246 Flags)); … … 1205 1250 //****************************************************************************** 1206 1251 //****************************************************************************** 1207 BOOL WIN32API ActivateKeyboardLayout(HKL hkl, UINT fuFlags) 1208 { 1209 dprintf(("USER32: ActivateKeyboardLayout, not implemented\n")); 1252 ODINFUNCTION2(BOOL, ActivateKeyboardLayout, 1253 HKL, hkl, 1254 UINT, fuFlags) 1255 { 1256 dprintf(("not implemented\n")); 1210 1257 return(TRUE); 1211 1258 } … … 1223 1270 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1224 1271 *****************************************************************************/ 1225 BOOL WIN32API UnloadKeyboardLayout (HKL hkl) 1226 { 1227 dprintf(("USER32:UnloadKeyboardLayout (%08x) not implemented.\n", 1228 hkl));1229 1230 return ( 0);1231 } 1232 //****************************************************************************** 1233 //****************************************************************************** 1272 ODINFUNCTION1(BOOL, UnloadKeyboardLayout, 1273 HKL, hkl) 1274 { 1275 dprintf(("not implemented.\n")); 1276 1277 return (TRUE); 1278 } 1279 //****************************************************************************** 1280 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.