- Timestamp:
- Oct 26, 2001, 11:10:57 AM (24 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/HOOK.CPP
r7190 r7211 1 /* $Id: HOOK.CPP,v 1. 29 2001-10-24 12:26:56phaller Exp $ */1 /* $Id: HOOK.CPP,v 1.30 2001-10-26 09:10:12 phaller Exp $ */ 2 2 3 3 /* … … 818 818 } 819 819 } 820 820 821 // this undoc (don't care) bit isn't passed through to this hook 822 DWORD lParam = msg->lParam & ~0x02000000; 823 821 824 return (HOOK_CallHooksA( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE, 822 LOWORD (msg->wParam), msg->lParam )825 LOWORD (msg->wParam), lParam ) 823 826 ? TRUE : FALSE); 824 827 } … … 845 848 846 849 kbhs.vkCode = msg->wParam; 847 kbhs.scanCode = ( (msg->lParam & 0x0 0ff0000) >> 16);850 kbhs.scanCode = ( (msg->lParam & 0x03ff0000) >> 16); 848 851 849 852 BOOL fKeyUp = (msg->message == WM_KEYUP) || -
trunk/src/user32/oslibmsg.cpp
r7205 r7211 1 /* $Id: oslibmsg.cpp,v 1.4 6 2001-10-25 15:35:53phaller Exp $ */1 /* $Id: oslibmsg.cpp,v 1.47 2001-10-26 09:10:12 phaller Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 21 21 #define INCL_DOSPROCESS 22 22 #include <os2wrap.h> 23 #include <odinwrap.h> 23 24 #include <string.h> 24 25 #include <misc.h> … … 37 38 #define DBG_LOCALLOG DBG_oslibmsg 38 39 #include "dbglocal.h" 40 41 42 ODINDEBUGCHANNEL(USER32-OSLIBMSG) 39 43 40 44 … … 116 120 void WinToOS2MsgTranslate(MSG *winMsg, QMSG *os2Msg, BOOL isUnicode) 117 121 { 122 dprintf(("WinToOS2MsgTranslate not implemented")); 118 123 // memcpy(os2Msg, winMsg, sizeof(MSG)); 119 124 // os2Msg->hwnd = Win32ToOS2Handle(winMsg->hwnd); … … 201 206 //****************************************************************************** 202 207 //****************************************************************************** 203 BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,208 BOOL i_OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 204 209 BOOL isUnicode) 205 210 { … … 239 244 teb->o.odin.os2msg.msg = 0; 240 245 teb->o.odin.os2msg.hwnd = 0; 246 247 // @@@PH verify this 248 // if this is a keyup or keydown message, we've got to 249 // call the keyboard hook here 250 if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN) 251 { 252 ProcessKbdHook(pMsg, TRUE); 253 } 254 241 255 return (pMsg->message != WINWM_QUIT); 242 256 } … … 288 302 if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN) 289 303 { 290 // if(ProcessKbdHookLL(pMsg, TRUE))291 // goto continuegetmsg;292 293 // @@@PH294 304 // only supposed to be called upon WM_KEYDOWN 295 305 // and WM_KEYUP according to docs. … … 299 309 return rc; 300 310 } 311 BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 312 BOOL isUnicode) 313 { 314 dprintf(("OSLibWinGetMsg enter")); 315 BOOL fRes = i_OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, isUnicode); 316 dprintf(("OSLibWinGetMsg leave")); 317 return fRes; 318 } 319 320 301 321 //****************************************************************************** 302 322 //PeekMessage retrieves only messages associated with the window identified by the … … 311 331 //TODO: Not working as specified right now! 312 332 //****************************************************************************** 313 BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,333 BOOL i_OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 314 334 DWORD fRemove, BOOL isUnicode) 315 335 { … … 350 370 } 351 371 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 372 373 // @@@PH verify this 374 // if this is a keyup or keydown message, we've got to 375 // call the keyboard hook here 376 if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN) 377 { 378 ProcessKbdHook(pMsg, fRemove); 379 } 352 380 return TRUE; 353 381 } … … 393 421 if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN) 394 422 { 395 // if(ProcessKbdHookLL(pMsg, fRemove))396 // goto continuepeekmsg;397 398 // @@@PH399 423 // only supposed to be called upon WM_KEYDOWN 400 424 // and WM_KEYUP according to docs. … … 405 429 return rc; 406 430 } 431 BOOL OSLibWinPeekMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 432 BOOL fRemove, BOOL isUnicode) 433 { 434 dprintf(("OSLibWinPeekMsg enter")); 435 BOOL fRes = i_OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, fRemove, isUnicode); 436 dprintf(("OSLibWinPeekMsg leave")); 437 return fRes; 438 } 439 407 440 //****************************************************************************** 408 441 //****************************************************************************** -
trunk/src/user32/oslibmsgtranslate.cpp
r7205 r7211 1 /* $Id: oslibmsgtranslate.cpp,v 1.6 8 2001-10-25 15:35:53phaller Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.69 2001-10-26 09:10:12 phaller Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 166 166 167 167 168 // Note: 169 // For a "lonekey"-press of AltGr, we only receive WM_KEYUP 170 // messages. If the key is pressed longer and starts to repeat, 171 // WM_KEYDOWN messages come in properly. 172 static BOOL fKeyAltGrDown = FALSE; 173 168 174 //****************************************************************************** 169 175 //****************************************************************************** … … 684 690 685 691 dprintf(("PM: WM_CHAR: %x %x rep=%d scancode=%x", SHORT1FROMMP(os2Msg->mp2), SHORT2FROMMP(os2Msg->mp2), repeatCount, scanCode)); 686 dprintf(("PM: WM_CHAR: hwnd %x flags %x mp1 %x, mp2 %x ", win32wnd->getWindowHandle(), flags, os2Msg->mp1, os2Msg->mp2));692 dprintf(("PM: WM_CHAR: hwnd %x flags %x mp1 %x, mp2 %x, time=%08xh", win32wnd->getWindowHandle(), flags, os2Msg->mp1, os2Msg->mp2, os2Msg->time)); 687 693 688 694 // vitali add begin … … 805 811 // check if additional messages have to be recorded 806 812 // ------------------------------------------------ 813 #if 0 807 814 { 808 815 MSG extramsg; … … 813 820 switch (scanCode) 814 821 { 815 case PMSCAN_ESC:816 {817 // Note: ESC generates a WM_CHAR for WINWM_KEYDOWN818 // under Windows, not under PM819 // so we've got to post it to ourself here!820 // WM_CHAR(0x0000001bh, 00010001h)821 if (winMsg->message == WINWM_KEYDOWN)822 {823 extramsg.message = WINWM_CHAR;824 extramsg.wParam = VK_ESCAPE_W;825 extramsg.lParam = winMsg->lParam;826 setThreadQueueExtraCharMessage(teb, &extramsg);827 }828 }829 break;830 831 #if 0832 822 case PMSCAN_PRINT: 833 823 // Note: PRINT generates a WM_KEYUP under Windows … … 841 831 setThreadQueueExtraCharMessage(teb, &extramsg); 842 832 break; 843 #endif844 833 834 #define WIN_KEY_EXTENDED 0x01000000 835 #define WIN_KEY_DONTCARE 0x02000000 836 #define WIN_KEY_ALTHELD 0x20000000 837 #define WIN_KEY_PREVSTATE 0x40000000 845 838 case PMSCAN_ALTRIGHT: 846 839 { 847 840 // we need very special treatment here for the 848 841 // poor, crippled AltGr key 849 if (keyWasPressed) 842 // Note: see fKeyAltGrDown above! 843 844 if ( (keyWasPressed) || (fKeyAltGrDown == FALSE) ) 850 845 { 846 fKeyAltGrDown = TRUE; 847 851 848 // 1 - generate a virtual LCONTROL-keypress 852 849 // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-AltGr!) 853 850 // 0xfe000000: mask out extended-key, scancode, repeatcount 851 // Note: Win sends a WINWM_SYSKEYDOWN to the hooks, 852 // the queue gets a WM_KEYDOWN only! (wrong impl. here) 854 853 extramsg.message = WINWM_KEYDOWN; 855 854 extramsg.wParam = VK_RMENU_W; 856 855 extramsg.lParam = (winMsg->lParam & 0xfe000000) 856 | WIN_KEY_EXTENDED 857 | (keyWasPressed ? WIN_KEY_PREVSTATE : 0) 858 | WIN_KEY_ALTHELD 857 859 | repeatCount 858 | (WINSCAN_ALTRIGHT << 24);860 | (WINSCAN_ALTRIGHT << 16); 859 861 winMsg->message = WINWM_KEYDOWN; 860 862 winMsg->wParam = VK_LCONTROL_W; 861 863 winMsg->lParam = (winMsg->lParam & 0xfe000000) 864 | WIN_KEY_DONTCARE 865 | (keyWasPressed ? WIN_KEY_PREVSTATE : 0) 866 | WIN_KEY_ALTHELD 862 867 | repeatCount 863 | (WINSCAN_CTRLLEFT << 24);868 | (WINSCAN_CTRLLEFT << 16); 864 869 } 865 870 else 866 871 { 872 // OK, now we can release it! 873 fKeyAltGrDown = FALSE; 874 867 875 // key up 868 876 // 1 - generate a virtual LCONTROL-keypress 869 877 // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-Alt!) 870 extramsg.message = WINWM_KEY DOWN;878 extramsg.message = WINWM_KEYUP; 871 879 extramsg.wParam = VK_RMENU_W; 872 880 extramsg.lParam = (winMsg->lParam & 0xfe000000) 881 | WIN_KEY_EXTENDED 873 882 | repeatCount 874 | (WINSCAN_ALTRIGHT << 24);883 | (WINSCAN_ALTRIGHT << 16); 875 884 winMsg->message = WINWM_SYSKEYUP; 876 885 winMsg->wParam = VK_LCONTROL_W; 877 886 winMsg->lParam = (winMsg->lParam & 0xfe000000) 887 | WIN_KEY_ALTHELD 878 888 | repeatCount 879 | (WINSCAN_CTRLLEFT << 24);889 | (WINSCAN_CTRLLEFT << 16); 880 890 } 881 891 892 // @@@PH 893 // unknown: this leads to an infinite loop 894 // because the OS/2 WM_CHAR_SPECIAL message is never 895 // removed from the queue?! 882 896 setThreadQueueExtraCharMessage(teb, &extramsg); 883 } 897 898 if ( (keyWasPressed) || (fKeyAltGrDown == FALSE) ) 899 { 900 fKeyAltGrDown = TRUE; 901 902 // 1 - generate a virtual LCONTROL-keypress 903 // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-AltGr!) 904 // 0xfe000000: mask out extended-key, scancode, repeatcount 905 // Note: Win sends a WINWM_SYSKEYDOWN to the hooks, 906 // the queue gets a WM_KEYDOWN only! (wrong impl. here) 907 winMsg->message = WINWM_KEYDOWN; 908 winMsg->wParam = VK_RMENU_W; 909 winMsg->lParam = (winMsg->lParam & 0xfe000000) 910 | WIN_KEY_EXTENDED 911 | (keyWasPressed ? WIN_KEY_PREVSTATE : 0) 912 | WIN_KEY_ALTHELD 913 | repeatCount 914 | (WINSCAN_ALTRIGHT << 16); 915 } 916 else 917 { 918 // OK, now we can release it! 919 fKeyAltGrDown = FALSE; 920 921 // key up 922 // 1 - generate a virtual LCONTROL-keypress 923 // 2 - send LMENU-keypress (NT emulates ALtGr w/ Ctrl-Alt!) 924 winMsg->message = WINWM_KEYUP; 925 winMsg->wParam = VK_RMENU_W; 926 winMsg->lParam = (winMsg->lParam & 0xfe000000) 927 | WIN_KEY_EXTENDED 928 | repeatCount 929 | (WINSCAN_ALTRIGHT << 16); 930 } 931 } 932 break; 884 933 } /* switch */ 885 934 } 886 935 #endif 887 936 888 937 if (ISKDB_CAPTURED()) … … 1046 1095 // the newly generated WM_CHAR message. 1047 1096 if(!teb->o.odin.fTranslated && teb->o.odin.os2msg.msg == WM_CHAR && !((SHORT1FROMMP(teb->o.odin.os2msg.mp1) & KC_KEYUP) == KC_KEYUP)) 1048 {//TranslatedMessage was called before DispatchMessage, so queue WM_CHAR message 1049 ULONG fl = SHORT1FROMMP(teb->o.odin.os2msg.mp1); 1050 MSG extramsg; 1051 1052 memcpy(&extramsg, msg, sizeof(MSG)); 1053 extramsg.wParam = SHORT1FROMMP(teb->o.odin.os2msg.mp2); 1054 extramsg.lParam = 0; 1055 1056 if(!(fl & KC_CHAR) && msg->message < WINWM_SYSKEYDOWN) { 1057 return FALSE; 1058 } 1059 1060 if(fl & KC_VIRTUALKEY) { 1061 if(msg->wParam) { 1062 if ((msg->wParam >= VK_NUMPAD0_W) && (msg->wParam <= VK_NUMPAD9_W)) 1063 extramsg.wParam = msg->wParam - 0x30; 1064 else 1065 extramsg.wParam = msg->wParam; 1066 } 1067 else extramsg.wParam = SHORT2FROMMP(teb->o.odin.os2msg.mp2); 1068 } 1069 1070 1071 if(msg->message >= WINWM_SYSKEYDOWN) { 1072 extramsg.message = WINWM_SYSCHAR; 1073 } 1074 else extramsg.message = WINWM_CHAR; 1075 1076 if(fl & KC_DEADKEY) { 1077 extramsg.message++; //WM_DEADCHAR/WM_SYSDEADCHAR 1078 } 1079 1080 extramsg.lParam = msg->lParam & 0x00FFFFFF; 1081 if(fl & KC_ALT) 1082 extramsg.lParam |= (1<<29); 1083 if(fl & KC_PREVDOWN) 1084 extramsg.lParam |= (1<<30); 1085 if(fl & KC_KEYUP) 1086 extramsg.lParam |= (1<<31); 1087 1088 // insert message into the queue 1089 setThreadQueueExtraCharMessage(teb, &extramsg); 1090 return TRUE; 1097 { 1098 //TranslatedMessage was called before DispatchMessage, so queue WM_CHAR message 1099 ULONG fl = SHORT1FROMMP(teb->o.odin.os2msg.mp1); 1100 MSG extramsg; 1101 1102 memcpy(&extramsg, msg, sizeof(MSG)); 1103 extramsg.wParam = SHORT1FROMMP(teb->o.odin.os2msg.mp2); 1104 extramsg.lParam = 0; 1105 1106 // ESCAPE generates a WM_CHAR under windows, so take 1107 // special care for this here. 1108 UCHAR ucPMScanCode = CHAR4FROMMP(teb->o.odin.os2msg.mp1); 1109 switch (ucPMScanCode) 1110 { 1111 case PMSCAN_ESC: 1112 extramsg.wParam = VK_ESCAPE_W; 1113 fl |= KC_CHAR; 1114 break; 1115 } 1116 1117 if(!(fl & KC_CHAR) && msg->message < WINWM_SYSKEYDOWN) 1118 { 1119 return FALSE; 1120 } 1121 1122 if(fl & KC_VIRTUALKEY) 1123 { 1124 if(msg->wParam) 1125 { 1126 if ((msg->wParam >= VK_NUMPAD0_W) && 1127 (msg->wParam <= VK_NUMPAD9_W)) 1128 extramsg.wParam = msg->wParam - 0x30; 1129 else 1130 extramsg.wParam = msg->wParam; 1131 } 1132 else 1133 extramsg.wParam = SHORT2FROMMP(teb->o.odin.os2msg.mp2); 1134 } 1135 1136 1137 if(msg->message >= WINWM_SYSKEYDOWN) 1138 extramsg.message = WINWM_SYSCHAR; 1139 else 1140 extramsg.message = WINWM_CHAR; 1141 1142 if(fl & KC_DEADKEY) 1143 extramsg.message++; //WM_DEADCHAR/WM_SYSDEADCHAR 1144 1145 1146 extramsg.lParam = msg->lParam & 0x00FFFFFF; 1147 if(fl & KC_ALT) 1148 extramsg.lParam |= (1<<29); 1149 if(fl & KC_PREVDOWN) 1150 extramsg.lParam |= (1<<30); 1151 if(fl & KC_KEYUP) 1152 extramsg.lParam |= (1<<31); 1153 1154 // insert message into the queue 1155 setThreadQueueExtraCharMessage(teb, &extramsg); 1156 return TRUE; 1091 1157 } 1092 1158 return FALSE; -
trunk/src/user32/pmwindow.cpp
r7200 r7211 1 /* $Id: pmwindow.cpp,v 1.15 8 2001-10-25 10:40:45 sandervlExp $ */1 /* $Id: pmwindow.cpp,v 1.159 2001-10-26 09:10:12 phaller Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 45 45 #include "options.h" 46 46 #include "menu.h" 47 #include <pmkbdhk.h> 47 48 48 49 #define DBG_LOCALLOG DBG_pmwindow … … 502 503 win32wnd->DispatchMsgA(pWinMsg); 503 504 break; 504 505 506 case WM_CHAR_SPECIAL: 507 /* NO BREAK! FALLTHRU CASE! */ 508 505 509 case WM_CHAR: 506 510 dprintf(("OS2: WM_CHAR %x %x %x, %x %x", win32wnd->getWindowHandle(), mp1, mp2, pWinMsg->wParam, pWinMsg->lParam));
Note:
See TracChangeset
for help on using the changeset viewer.