- Timestamp:
- Jun 15, 2002, 7:17:17 PM (23 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibmsg.cpp
r8130 r8689 1 /* $Id: oslibmsg.cpp,v 1.5 5 2002-03-28 11:35:38sandervl Exp $ */1 /* $Id: oslibmsg.cpp,v 1.56 2002-06-15 17:17:17 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 131 131 //If both the minimum & maximum message are unknown, the result can be wrong (max > min)! 132 132 //****************************************************************************** 133 ULONG TranslateWinMsg(ULONG msg, BOOL fMinFilter )133 ULONG TranslateWinMsg(ULONG msg, BOOL fMinFilter, BOOL fExactMatch = FALSE) 134 134 { 135 135 if(msg == 0) … … 141 141 for(int i=0;i<MAX_MSGTRANSTAB;i++) 142 142 { 143 if(fMinFilter && MsgTransTab[i].msgWin32 >= msg) { 144 return MsgTransTab[i].msgOS2; 145 } 146 else 147 if(!fMinFilter && MsgTransTab[i].msgWin32 >= msg) { 143 if(fExactMatch) { 148 144 if(MsgTransTab[i].msgWin32 == msg) 149 return MsgTransTab[i].msgOS2; 150 else return MsgTransTab[i-1].msgOS2; 145 return MsgTransTab[i].msgWin32; 146 } 147 else { 148 if(fMinFilter && MsgTransTab[i].msgWin32 >= msg) { 149 return MsgTransTab[i].msgOS2; 150 } 151 else 152 if(!fMinFilter && MsgTransTab[i].msgWin32 >= msg) { 153 if(MsgTransTab[i].msgWin32 == msg) 154 return MsgTransTab[i].msgOS2; 155 else return MsgTransTab[i-1].msgOS2; 156 } 151 157 } 152 158 } 153 159 154 160 //not found, get everything 155 dprintf (("WARNING: TranslateWinMsg: message %x not found", msg));161 dprintf2(("WARNING: TranslateWinMsg: message %x not found", msg)); 156 162 return 0; 157 163 } … … 210 216 //****************************************************************************** 211 217 //****************************************************************************** 212 213 #ifdef ALTGR_HACK214 static void i_MostUglyAltGrHack(LPMSG pMsg)215 {216 switch (pMsg->message)217 {218 case WINWM_KEYUP:219 case WINWM_SYSKEYUP:220 USHORT wWinScan = (pMsg->lParam & 0x00ff0000) >> 16;221 if (wWinScan == WINSCAN_ALTRIGHT)222 {223 KeySetOverlayKeyState(VK_RMENU_W, KEYOVERLAYSTATE_DONTCARE);224 KeySetOverlayKeyState(VK_MENU_W, KEYOVERLAYSTATE_DONTCARE);225 }226 break;227 }228 }229 #else230 #define i_MostUglyAltGrHack(a)231 #endif232 233 218 BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 234 219 BOOL isUnicode) 235 220 { 236 BOOL rc, eaten;237 TEB *teb;238 QMSG os2msg;239 HWND hwndOS2 = 0;240 ULONG filtermin, filtermax;241 242 if(hwnd) {243 hwndOS2 = Win32ToOS2Handle(hwnd);244 if(hwndOS2 == NULL) {245 memset(pMsg, 0, sizeof(MSG));246 dprintf(("GetMsg: window %x NOT FOUND!", hwnd));247 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W);248 return TRUE;249 }250 }251 252 teb = GetThreadTEB();253 if(teb == NULL) {221 BOOL rc, eaten; 222 TEB *teb; 223 QMSG os2msg; 224 HWND hwndOS2 = 0; 225 ULONG filtermin, filtermax; 226 227 if(hwnd) { 228 hwndOS2 = Win32ToOS2Handle(hwnd); 229 if(hwndOS2 == NULL) { 230 memset(pMsg, 0, sizeof(MSG)); 231 dprintf(("GetMsg: window %x NOT FOUND!", hwnd)); 232 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 233 return TRUE; 234 } 235 } 236 237 teb = GetThreadTEB(); 238 if(teb == NULL) { 254 239 DebugInt3(); 255 return TRUE;256 }257 258 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd))259 {240 return TRUE; 241 } 242 243 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) 244 { 260 245 dprintf(("Return queued WM_CHAR message hwnd=%x msg=%d wParam=%x lParam=%x", teb->o.odin.msgWCHAR.hwnd, teb->o.odin.msgWCHAR.message, teb->o.odin.msgWCHAR.wParam, teb->o.odin.msgWCHAR.lParam)); 261 246 if(uMsgFilterMin) { … … 285 270 // and WM_KEYUP according to docs. 286 271 if(ProcessKbdHook(pMsg, TRUE)) 287 goto continuegetmsg;272 goto continuegetmsg; 288 273 break; 289 274 } 290 275 291 i_MostUglyAltGrHack(pMsg);292 293 276 return (pMsg->message != WINWM_QUIT); 294 }277 } 295 278 296 279 continuegetmsg: 297 if(hwnd) {280 if(hwnd) { 298 281 filtermin = TranslateWinMsg(uMsgFilterMin, TRUE); 299 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE);300 if(filtermin > filtermax) {301 ULONG tmp = filtermin;302 filtermin = filtermax;303 filtermax = filtermin;304 }282 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE); 283 if(filtermin > filtermax) { 284 ULONG tmp = filtermin; 285 filtermin = filtermax; 286 filtermax = filtermin; 287 } 305 288 do { 306 289 WinWaitMsg(teb->o.odin.hab, filtermin, filtermax); … … 310 293 311 294 return (pMsg->message != WINWM_QUIT); 312 }313 else314 {295 } 296 else 297 { 315 298 filtermin = TranslateWinMsg(uMsgFilterMin, TRUE); 316 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE);317 if(filtermin > filtermax) {318 ULONG tmp = filtermin;319 filtermin = filtermax;320 filtermax = filtermin;321 }299 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE); 300 if(filtermin > filtermax) { 301 ULONG tmp = filtermin; 302 filtermin = filtermax; 303 filtermax = filtermin; 304 } 322 305 do { 323 306 eaten = FALSE; … … 334 317 rc = 1; 335 318 } 336 } while (eaten); 337 } 338 if(OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, MSG_REMOVE) == FALSE) { 339 //dispatch untranslated message immediately 340 WinDispatchMsg(teb->o.odin.hab, &os2msg); 341 //and get the next one 342 return OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, isUnicode); 343 } 344 345 memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG)); 346 memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG)); 319 } 320 while (eaten); 321 } 322 if(OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, MSG_REMOVE) == FALSE) { 323 //dispatch untranslated message immediately 324 WinDispatchMsg(teb->o.odin.hab, &os2msg); 325 //and get the next one 326 return OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, isUnicode); 327 } 328 329 memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG)); 330 memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG)); 347 331 348 // send keyboard messages to the registered hooks349 switch (pMsg->message)350 {332 // send keyboard messages to the registered hooks 333 switch (pMsg->message) 334 { 351 335 case WINWM_KEYDOWN: 352 336 case WINWM_KEYUP: 353 337 case WINWM_SYSKEYDOWN: 354 338 case WINWM_SYSKEYUP: 355 // only supposed to be called upon WM_KEYDOWN 356 // and WM_KEYUP according to docs. 357 if(ProcessKbdHook(pMsg, TRUE)) 358 goto continuegetmsg; 359 break; 360 } 361 362 i_MostUglyAltGrHack(pMsg); 363 364 return rc; 339 // only supposed to be called upon WM_KEYDOWN 340 // and WM_KEYUP according to docs. 341 if(ProcessKbdHook(pMsg, TRUE)) 342 goto continuegetmsg; 343 break; 344 } 345 return rc; 365 346 } 366 347 … … 381 362 DWORD fRemove, BOOL isUnicode) 382 363 { 383 BOOL rc, eaten; 384 TEB *teb; 385 QMSG os2msg; 386 HWND hwndOS2 = 0; 387 388 if(hwnd && hwnd != -1) { 389 hwndOS2 = Win32ToOS2Handle(hwnd); 390 if(hwndOS2 == NULL) { 391 dprintf(("PeekMsg: window %x NOT FOUND!", hwnd)); 392 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 393 return FALSE; 394 } 395 } 396 397 teb = GetThreadTEB(); 398 if(teb == NULL) { 364 BOOL rc, eaten; 365 TEB *teb; 366 QMSG os2msg; 367 HWND hwndOS2 = 0; 368 369 if(uMsgFilterMin > uMsgFilterMax) { 370 //TODO: is this correct behaviour? 371 dprintf(("!ERROR!: invalid message filter range!!!")); 372 SetLastError(ERROR_INVALID_PARAMETER_W); 373 return FALSE; 374 } 375 if(hwnd && hwnd != -1) { 376 hwndOS2 = Win32ToOS2Handle(hwnd); 377 if(hwndOS2 == NULL) { 378 dprintf(("PeekMsg: window %x NOT FOUND!", hwnd)); 379 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 380 return FALSE; 381 } 382 } 383 384 teb = GetThreadTEB(); 385 if(teb == NULL) { 399 386 DebugInt3(); 400 387 return FALSE; 401 }402 403 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd))404 {388 } 389 390 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) 391 { 405 392 dprintf(("Return queued WM_CHAR message hwnd=%x msg=%d wParam=%x lParam=%x", teb->o.odin.msgWCHAR.hwnd, teb->o.odin.msgWCHAR.message, teb->o.odin.msgWCHAR.wParam, teb->o.odin.msgWCHAR.lParam)); 406 393 if(uMsgFilterMin) { … … 433 420 // and WM_KEYUP according to docs. 434 421 if(ProcessKbdHook(pMsg, fRemove)) 435 goto continuepeekmsg;422 goto continuepeekmsg; 436 423 break; 437 424 } 438 425 439 426 return TRUE; 440 }427 } 441 428 442 429 continuepeekmsg: 443 do { 444 eaten = FALSE; 445 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE), 446 TranslateWinMsg(uMsgFilterMax, FALSE), (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); 447 448 if (rc && (fRemove & PM_REMOVE_W) && os2msg.msg == WM_TIMER) { 449 eaten = TIMER_HandleTimer(&os2msg); 450 } 451 } 452 while (eaten && rc); 453 454 if(rc == FALSE) { 455 return FALSE; 456 } 430 if(uMsgFilterMin && uMsgFilterMax) 431 { //we can't use the PM message filter (since the message nrs aren't similar), so we must 432 //filter each message seperately 433 //to do so, we will translate each win32 message in the filter range and call WinPeekMsg 434 ULONG ulPMFilter; 435 436 for(int i=0;i<uMsgFilterMax-uMsgFilterMin;i++) { 437 ulPMFilter = TranslateWinMsg(uMsgFilterMin+i, TRUE, TRUE); 438 if(ulPMFilter) { 439 do { 440 eaten = FALSE; 441 442 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, ulPMFilter, ulPMFilter, 443 (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); 444 445 if (rc && (fRemove & PM_REMOVE_W) && os2msg.msg == WM_TIMER) { 446 eaten = TIMER_HandleTimer(&os2msg); 447 } 448 } 449 while (eaten && rc); 450 } 451 if(rc) { 452 break; 453 } 454 } 455 } 456 else { 457 do { 458 eaten = FALSE; 459 460 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, 0, 0, (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); 461 462 if (rc && (fRemove & PM_REMOVE_W) && os2msg.msg == WM_TIMER) { 463 eaten = TIMER_HandleTimer(&os2msg); 464 } 465 } 466 while (eaten && rc); 467 } 468 469 if(rc == FALSE) { 470 return FALSE; 471 } 457 472 458 // @@@PH 459 // warning - OS2ToWinMsgTranslate might insert additional messages 460 // into the queue 461 if(OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, (fRemove & PM_REMOVE_W) ? MSG_REMOVE : MSG_NOREMOVE) == FALSE) 462 { 463 //unused PM message; dispatch immediately and grab next one 464 dprintf2(("OSLibWinPeekMsg: Untranslated message; dispatched immediately")); 465 if(!(fRemove & PM_REMOVE_W)) { 466 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE), 467 TranslateWinMsg(uMsgFilterMax, FALSE), PM_REMOVE); 468 } 469 WinDispatchMsg(teb->o.odin.hab, &os2msg); 470 return OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, 471 fRemove, isUnicode); 472 } 473 //TODO: This is not safe! There's no guarantee this message will be dispatched and it might overwrite a previous message 474 if(fRemove & PM_REMOVE_W) { 475 memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG)); 476 memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG)); 477 } 478 479 // send keyboard messages to the registered hooks 480 switch (pMsg->message) 481 { 473 // @@@PH 474 // warning - OS2ToWinMsgTranslate might insert additional messages 475 // into the queue 476 if(OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, (fRemove & PM_REMOVE_W) ? MSG_REMOVE : MSG_NOREMOVE) == FALSE) 477 { 478 //unused PM message; dispatch immediately and grab next one 479 dprintf2(("OSLibWinPeekMsg: Untranslated message; dispatched immediately")); 480 if(!(fRemove & PM_REMOVE_W)) { 481 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE), 482 TranslateWinMsg(uMsgFilterMax, FALSE), PM_REMOVE); 483 } 484 WinDispatchMsg(teb->o.odin.hab, &os2msg); 485 return OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, fRemove, isUnicode); 486 } 487 //TODO: This is not safe! There's no guarantee this message will be dispatched and it might overwrite a previous message 488 if(fRemove & PM_REMOVE_W) { 489 memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG)); 490 memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG)); 491 } 492 493 // send keyboard messages to the registered hooks 494 switch (pMsg->message) 495 { 482 496 case WINWM_KEYDOWN: 483 497 case WINWM_KEYUP: 484 498 case WINWM_SYSKEYDOWN: 485 499 case WINWM_SYSKEYUP: 486 // only supposed to be called upon WM_KEYDOWN487 // and WM_KEYUP according to docs.488 if(ProcessKbdHook(pMsg, fRemove))489 goto continuepeekmsg;490 break;491 }492 493 return rc;500 // only supposed to be called upon WM_KEYDOWN 501 // and WM_KEYUP according to docs. 502 if(ProcessKbdHook(pMsg, fRemove)) 503 goto continuepeekmsg; 504 break; 505 } 506 507 return rc; 494 508 } 495 509 //****************************************************************************** … … 497 511 ULONG OSLibWinQueryMsgTime() 498 512 { 499 return WinQueryMsgTime(GetThreadHAB());513 return WinQueryMsgTime(GetThreadHAB()); 500 514 } 501 515 //****************************************************************************** … … 503 517 BOOL OSLibWinWaitMessage() 504 518 { 505 return WinWaitMsg(GetThreadHAB(), 0, 0);519 return WinWaitMsg(GetThreadHAB(), 0, 0); 506 520 } 507 521 //****************************************************************************** … … 510 524 ULONG OSLibWinQueryQueueStatus() 511 525 { 512 ULONG statusOS2, statusWin32 = 0;513 514 statusOS2 = WinQueryQueueStatus(HWND_DESKTOP);515 516 if(statusOS2 & QS_KEY)517 statusWin32 |= QS_KEY_W;518 if(statusOS2 & QS_MOUSEBUTTON)519 statusWin32 |= QS_MOUSEBUTTON_W;520 if(statusOS2 & QS_MOUSEMOVE)521 statusWin32 |= QS_MOUSEMOVE_W;522 if(statusOS2 & QS_TIMER)523 statusWin32 |= QS_TIMER_W;524 if(statusOS2 & QS_PAINT)525 statusWin32 |= QS_PAINT_W;526 if(statusOS2 & QS_POSTMSG)527 statusWin32 |= QS_POSTMESSAGE_W;528 if(statusOS2 & QS_SENDMSG)529 statusWin32 |= QS_SENDMESSAGE_W;530 531 return statusWin32;526 ULONG statusOS2, statusWin32 = 0; 527 528 statusOS2 = WinQueryQueueStatus(HWND_DESKTOP); 529 530 if(statusOS2 & QS_KEY) 531 statusWin32 |= QS_KEY_W; 532 if(statusOS2 & QS_MOUSEBUTTON) 533 statusWin32 |= QS_MOUSEBUTTON_W; 534 if(statusOS2 & QS_MOUSEMOVE) 535 statusWin32 |= QS_MOUSEMOVE_W; 536 if(statusOS2 & QS_TIMER) 537 statusWin32 |= QS_TIMER_W; 538 if(statusOS2 & QS_PAINT) 539 statusWin32 |= QS_PAINT_W; 540 if(statusOS2 & QS_POSTMSG) 541 statusWin32 |= QS_POSTMESSAGE_W; 542 if(statusOS2 & QS_SENDMSG) 543 statusWin32 |= QS_SENDMESSAGE_W; 544 545 return statusWin32; 532 546 } 533 547 //****************************************************************************** … … 535 549 BOOL OSLibWinInSendMessage() 536 550 { 537 return WinInSendMsg(GetThreadHAB());551 return WinInSendMsg(GetThreadHAB()); 538 552 } 539 553 //****************************************************************************** … … 541 555 DWORD OSLibWinGetMessagePos() 542 556 { 543 APIRET rc;544 POINTL ptl;545 546 rc = WinQueryMsgPos(GetThreadHAB(), &ptl);547 if(!rc) {548 return 0;549 }550 //convert to windows coordinates551 return MAKEULONG(ptl.x,mapScreenY(ptl.y));557 APIRET rc; 558 POINTL ptl; 559 560 rc = WinQueryMsgPos(GetThreadHAB(), &ptl); 561 if(!rc) { 562 return 0; 563 } 564 //convert to windows coordinates 565 return MAKEULONG(ptl.x,mapScreenY(ptl.y)); 552 566 } 553 567 //****************************************************************************** … … 555 569 LONG OSLibWinGetMessageTime() 556 570 { 557 return (LONG)WinQueryMsgTime(GetThreadHAB());571 return (LONG)WinQueryMsgTime(GetThreadHAB()); 558 572 } 559 573 //****************************************************************************** … … 561 575 BOOL OSLibWinReplyMessage(ULONG result) 562 576 { 563 return (BOOL)WinReplyMsg( NULLHANDLE, NULLHANDLE, HMQ_CURRENT, (MRESULT)result);577 return (BOOL)WinReplyMsg( NULLHANDLE, NULLHANDLE, HMQ_CURRENT, (MRESULT)result); 564 578 } 565 579 //****************************************************************************** … … 567 581 ULONG OSLibSendMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam, BOOL fUnicode) 568 582 { 569 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));583 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET)); 570 584 571 585 if(NULL == packet) … … 595 609 BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam, BOOL fUnicode) 596 610 { 597 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));611 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET)); 598 612 599 613 if (NULL == packet) … … 621 635 BOOL OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode) 622 636 { 623 TEB *teb = GetTEBFromThreadId(threadid);624 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));625 BOOL ret;637 TEB *teb = GetTEBFromThreadId(threadid); 638 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET)); 639 BOOL ret; 626 640 627 641 if(NULL == packet) … … 659 673 DWORD GetThreadMessageExtraInfo() 660 674 { 661 TEB *teb;662 663 teb = GetThreadTEB();664 if(teb)665 {666 return teb->o.odin.dwMsgExtraInfo;667 }668 dprintf(("GetThreadMessageExtraInfo: teb == NULL!!"));669 return 0;675 TEB *teb; 676 677 teb = GetThreadTEB(); 678 if(teb) 679 { 680 return teb->o.odin.dwMsgExtraInfo; 681 } 682 dprintf(("GetThreadMessageExtraInfo: teb == NULL!!")); 683 return 0; 670 684 } 671 685 //****************************************************************************** … … 673 687 DWORD SetThreadMessageExtraInfo(DWORD lParam) 674 688 { 675 TEB *teb;676 677 teb = GetThreadTEB();678 if(teb)679 {680 teb->o.odin.dwMsgExtraInfo = lParam;681 }682 elsedprintf(("SetThreadMessageExtraInfo: teb == NULL!!"));683 return 0;684 } 685 //****************************************************************************** 686 //****************************************************************************** 689 TEB *teb; 690 691 teb = GetThreadTEB(); 692 if(teb) 693 { 694 teb->o.odin.dwMsgExtraInfo = lParam; 695 } 696 else dprintf(("SetThreadMessageExtraInfo: teb == NULL!!")); 697 return 0; 698 } 699 //****************************************************************************** 700 //****************************************************************************** -
trunk/src/user32/windowmsg.cpp
r7801 r8689 1 /* $Id: windowmsg.cpp,v 1.3 3 2002-02-05 17:59:02sandervl Exp $ */1 /* $Id: windowmsg.cpp,v 1.34 2002-06-15 17:17:17 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 41 41 LONG WIN32API DispatchMessageA(const MSG * msg) 42 42 { 43 dprintf2(("DispatchMessageA %x %x %x %x %x", msg->hwnd, msg->message, msg->wParam, msg->lParam, msg->time));44 return OSLibWinDispatchMsg((MSG *)msg);43 dprintf2(("DispatchMessageA %x %x %x %x %x", msg->hwnd, msg->message, msg->wParam, msg->lParam, msg->time)); 44 return OSLibWinDispatchMsg((MSG *)msg); 45 45 } 46 46 //****************************************************************************** … … 48 48 LONG WIN32API DispatchMessageW( const MSG * msg) 49 49 { 50 dprintf2(("DispatchMessageW %x %x %x %x %x", msg->hwnd, msg->message, msg->wParam, msg->lParam, msg->time));51 return OSLibWinDispatchMsg((MSG *)msg, TRUE);50 dprintf2(("DispatchMessageW %x %x %x %x %x", msg->hwnd, msg->message, msg->wParam, msg->lParam, msg->time)); 51 return OSLibWinDispatchMsg((MSG *)msg, TRUE); 52 52 } 53 53 //****************************************************************************** … … 55 55 BOOL WIN32API TranslateMessage(const MSG *msg) 56 56 { 57 // check the message code58 if ( (msg->message < WM_KEYDOWN) ||59 (msg->message > WM_SYSKEYUP)||60 (msg->message == WM_CHAR) ||61 (msg->message == WM_DEADCHAR) )62 {63 SetLastError(ERROR_INVALID_PARAMETER);64 return FALSE;65 }57 // check the message code 58 if ( (msg->message < WM_KEYDOWN) || 59 (msg->message > WM_SYSKEYUP)|| 60 (msg->message == WM_CHAR) || 61 (msg->message == WM_DEADCHAR) ) 62 { 63 SetLastError(ERROR_INVALID_PARAMETER); 64 return FALSE; 65 } 66 66 67 // only WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, WM_SYSKEYUP68 // can go into TranslateMessage67 // only WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, WM_SYSKEYUP 68 // can go into TranslateMessage 69 69 70 return OSLibWinTranslateMessage((MSG *)msg);70 return OSLibWinTranslateMessage((MSG *)msg); 71 71 } 72 72 //****************************************************************************** … … 74 74 BOOL WIN32API GetMessageA( LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax) 75 75 { 76 BOOL ret;76 BOOL ret; 77 77 78 78 dprintf2(("GetMessageA %x %x-%x", hwnd, uMsgFilterMin, uMsgFilterMax)); … … 86 86 BOOL WIN32API GetMessageW( LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax) 87 87 { 88 BOOL ret;88 BOOL ret; 89 89 90 90 dprintf2(("GetMessageW %x %x-%x", hwnd, uMsgFilterMin, uMsgFilterMax)); … … 98 98 UINT uMsgFilterMax, UINT fuRemoveMsg) 99 99 { 100 BOOL fFoundMsg;100 BOOL fFoundMsg; 101 101 102 102 dprintf2(("PeekMessageA %x %d-%d %d", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg)); … … 117 117 UINT uMsgFilterMax, UINT fuRemoveMsg) 118 118 { 119 BOOL fFoundMsg;119 BOOL fFoundMsg; 120 120 121 121 dprintf2(("PeekMessageW %x %d-%d %d", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg)); … … 143 143 LPARAM WIN32API SetMessageExtraInfo(LPARAM lParam) 144 144 { 145 dprintf(("USER32: SetMessageExtraInfo %x", lParam));146 return SetThreadMessageExtraInfo(lParam);145 dprintf(("USER32: SetMessageExtraInfo %x", lParam)); 146 return SetThreadMessageExtraInfo(lParam); 147 147 } 148 148 //****************************************************************************** … … 150 150 DWORD WIN32API GetMessagePos(void) 151 151 { 152 DWORD pos;152 DWORD pos; 153 153 154 154 pos = OSLibWinGetMessagePos(); … … 195 195 UINT WIN32API RegisterWindowMessageA(LPCSTR lpString) 196 196 { 197 UINT rc;197 UINT rc; 198 198 199 199 rc = GlobalAddAtomA(lpString); … … 213 213 BOOL WIN32API SetMessageQueue(int cMessagesMax) 214 214 { 215 dprintf(("USER32: SetMessageQueue\n"));216 return(TRUE);215 dprintf(("USER32: SetMessageQueue\n")); 216 return(TRUE); 217 217 } 218 218 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.