Changeset 2200 for trunk/src/user32/pmwindow.cpp
- Timestamp:
- Dec 24, 1999, 7:42:46 PM (26 years ago)
- File:
-
- 1 edited
-
trunk/src/user32/pmwindow.cpp (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/pmwindow.cpp
r2189 r2200 1 /* $Id: pmwindow.cpp,v 1.6 8 1999-12-22 18:09:31 cbratschiExp $ */1 /* $Id: pmwindow.cpp,v 1.69 1999-12-24 18:39:10 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 17 17 #include <os2wrap.h> 18 18 #include <stdlib.h> 19 #include <string.h> 19 20 #include "win32type.h" 20 21 #include <winconst.h> … … 43 44 ULONG ScreenBitsPerPel = 0; 44 45 45 //Used for key translation while processing WM_CHAR message46 USHORT virtualKeyTable [66] = {47 0x00, // OS/2 VK Win32 VK, Entry 0 is not used48 0x01, // VK_BUTTON1 VK_LBUTTON49 0x02, // VK_BUTTON2 VK_RBUTTON50 0x04, // VK_BUTTON3 VK_MBUTTON51 0x03, // VK_BREAK VK_CANCEL52 0x08, // VK_BACKSPACE VK_BACK53 0x09, // VK_TAB VK_TAB54 0x00, // VK_BACKTAB No equivalent!55 0x0A, // VK_NEWLINE 0x0A (no VK_* def)56 0x10, // VK_SHIFT VK_SHIFT57 0x11, // VK_CTRL VK_CONTROL58 0x12, // VK_ALT VK_MENU, best match I guess59 0x12, // VK_ALTGRAF VK_MENU, best match I guess60 0x13, // VK_PAUSE VK_PAUSE61 0x14, // VK_CAPSLOCK VK_CAPITAL62 0x1B, // VK_ESC VK_ESCAPE63 0x20, // VK_SPACE VK_SPACE64 0x21, // VK_PAGEUP VK_PRIOR65 0x22, // VK_PAGEDOWN VK_NEXT66 0x23, // VK_END VK_END67 0x24, // VK_HOME VK_HOME68 0x25, // VK_LEFT VK_LEFT69 0x26, // VK_UP VK_UP70 0x27, // VK_RIGHT VK_RIGHT71 0x28, // VK_DOWN VK_DOWN72 0x2C, // VK_PRINTSCRN VK_SNAPSHOT73 0x2D, // VK_INSERT VK_INSERT74 0x2E, // VK_DELETE VK_DELETE75 0x91, // VK_SCRLLOCK VK_SCROLL76 0x90, // VK_NUMLOCK VK_NUMLOCK77 0x0D, // VK_ENTER VK_RETURN78 0x00, // VK_SYSRQ No equivalent!79 0x70, // VK_F1 VK_F180 0x71, // VK_F2 VK_F281 0x72, // VK_F3 VK_F382 0x73, // VK_F4 VK_F483 0x74, // VK_F5 VK_F584 0x75, // VK_F6 VK_F685 0x76, // VK_F7 VK_F786 0x77, // VK_F8 VK_F887 0x78, // VK_F9 VK_F988 0x79, // VK_F10 VK_F1089 0x7A, // VK_F11 VK_F1190 0x7B, // VK_F12 VK_F1291 0x7C, // VK_F13 VK_F1392 0x7D, // VK_F14 VK_F1493 0x7E, // VK_F15 VK_F1594 0x7F, // VK_F16 VK_F1695 0x80, // VK_F17 VK_F1796 0x81, // VK_F18 VK_F1897 0x82, // VK_F19 VK_F1998 0x83, // VK_F20 VK_F2099 0x84, // VK_F21 VK_F21100 0x85, // VK_F22 VK_F22101 0x86, // VK_F23 VK_F23102 0x87, // VK_F24 VK_F24103 0x00, // VK_ENDDRAG No equivalent!104 0x0C, // VK_CLEAR VK_CLEAR105 0xF9, // VK_EREOF VK_EREOF106 0xFD, // VK_PA1 VK_PA1107 0xF6, // VK_ATTN VK_ATTN108 0xF7, // VK_CRSEL VK_CRSEL109 0xF8, // VK_EXSEL VK_EXSEL110 0x00, // VK_COPY No equivalent!111 0x00, // VK_BLK1 No equivalent!112 0x00}; // VK_BLK2 No equivalent!113 46 114 47 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); … … 202 135 OSLIBPOINT point, ClientPoint; 203 136 Win32BaseWindow *win32wnd; 137 THDB *thdb; 204 138 APIRET rc; 139 MSG winMsg, *pWinMsg; 205 140 206 141 //Restore our FS selector 207 142 SetWin32TIB(); 208 143 144 thdb = GetThreadTHDB(); 209 145 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 210 146 211 if(msg != WM_CREATE && win32wnd == NULL) { 212 dprintf(("Invalid win32wnd pointer for window %x!!", hwnd)); 213 goto RunDefWndProc; 214 } 147 if(!thdb || (msg != WM_CREATE && win32wnd == NULL)) { 148 dprintf(("Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 149 goto RunDefWndProc; 150 } 151 152 if((thdb->msgstate & 1) == 0) 153 {//message that was sent directly to our window proc handler; translate it here 154 QMSG qmsg; 155 156 qmsg.msg = msg; 157 qmsg.hwnd = hwnd; 158 qmsg.mp1 = mp1; 159 qmsg.mp2 = mp2; 160 qmsg.time = WinQueryMsgTime(thdb->hab); 161 WinQueryMsgPos(thdb->hab, &qmsg.ptl); 162 qmsg.reserved = 0; 163 164 if(OS2ToWinMsgTranslate((PVOID)thdb, &qmsg, &winMsg, FALSE, ODINMSG_NOEXTRAMSGS) == FALSE) 165 {//message was not translated 166 memset(&winMsg, 0, sizeof(MSG)); 167 } 168 pWinMsg = &winMsg; 169 } 170 else { 171 pWinMsg = &thdb->msg; 172 thdb->msgstate++; 173 } 174 215 175 if(msg == WIN32APP_POSTMSG && (ULONG)mp1 == WIN32PM_MAGIC) { 216 176 //win32 app user message … … 222 182 case WM_CREATE: 223 183 { 224 THDB *thdb = GetThreadTHDB(); 225 226 if(thdb == NULL || thdb->newWindow == 0) 184 185 if(thdb->newWindow == 0) 227 186 goto createfail; 228 187 … … 230 189 dprintf(("OS2: WM_CREATE %x", hwnd)); 231 190 win32wnd = (Win32BaseWindow *)thdb->newWindow; 191 thdb->newWindow = 0; 232 192 233 193 if(win32wnd->MsgCreate(WinQueryWindow(hwnd, QW_PARENT), hwnd) == FALSE) … … 250 210 case WM_CLOSE: 251 211 dprintf(("OS2: WM_CLOSE %x", hwnd)); 252 // win32wnd->RemoveFakeOpen32();253 212 if(win32wnd->MsgClose()) { 254 213 goto RunDefWndProc; … … 280 239 case WM_ADJUSTWINDOWPOS: 281 240 { 282 PSWP pswp = (PSWP)mp1;283 284 dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));241 // PSWP pswp = (PSWP)mp1; 242 243 // dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 285 244 goto RunDefWndProc; 286 245 } … … 341 300 #endif 342 301 343 #if 1344 302 case WM_WINDOWPOSCHANGED: 345 303 { 346 PSWP pswp = (PSWP)mp1; 347 SWP swpOld = *(pswp + 1); 348 WINDOWPOS wp; 349 HWND hParent = NULLHANDLE; 350 LONG yDelta = pswp->cy - swpOld.cy; 351 LONG xDelta = pswp->cx - swpOld.cx; 352 353 dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 354 355 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) goto RunDefWndProc; 356 357 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 358 if (win32wnd->isChild()) { 359 if(win32wnd->getParent()) { 360 hParent = win32wnd->getParent()->getOS2WindowHandle(); 361 } 362 else goto RunDefWndProc; //parent has just been destroyed 363 } 364 } 365 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, win32wnd->getOS2FrameWindowHandle()); 366 367 if (!win32wnd->CanReceiveSizeMsgs()) goto RunDefWndProc; 368 369 dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy)); 370 win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy); 371 372 wp.hwnd = win32wnd->getWindowHandle(); 373 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 374 { 375 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 376 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 377 } 378 379 PRECT lpRect = win32wnd->getWindowRect(); 380 //SvL: Only send it when the client has changed & the frame hasn't 381 // If the frame size/position has changed, pmframe.cpp will send 382 // this message 383 if(lpRect->right == wp.x+wp.cx && lpRect->bottom == wp.y+wp.cy) { 384 win32wnd->MsgPosChanged((LPARAM)&wp); 385 } 386 else win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy); 387 388 goto RunDefWndProc; 389 } 390 #endif 304 win32wnd->MsgPosChanged((LPARAM)&thdb->wp); 305 goto RunDefWndProc; 306 } 391 307 392 308 case WM_ACTIVATE: … … 412 328 } 413 329 414 case WM_SIZE:415 {416 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2)));417 break;418 }419 case WM_MINMAXFRAME:420 {421 dprintf(("OS2: WM_MINMAXFRAME"));422 break;423 }424 case WM_OWNERPOSCHANGE:425 {426 dprintf(("OS2: WM_OWNERPOSCHANGE"));427 goto RunDefWndProc;428 }429 430 case WM_CALCVALIDRECTS:431 {432 dprintf(("OS2: WM_CALCVALIDRECTS"));433 goto RunDefWndProc;434 }435 436 case WM_FOCUSCHANGE:437 dprintf(("OS2: WM_FOCUSCHANGE %x", win32wnd->getWindowHandle()));438 goto RunDefWndProc;439 440 330 case WM_SETFOCUS: 441 331 { … … 464 354 //************************************************************************** 465 355 case WM_BUTTON1DOWN: 466 dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));467 point.x = (*(POINTS *)&mp1).x;468 point.y = (*(POINTS *)&mp1).y;469 ClientPoint.x = point.x;470 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);471 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);472 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {473 goto RunDefWndProc;474 }475 break;476 477 356 case WM_BUTTON1UP: 478 dprintf(("OS2: WM_BUTTON1UP %x", hwnd));479 point.x = (*(POINTS *)&mp1).x;480 point.y = (*(POINTS *)&mp1).y;481 ClientPoint.x = point.x;482 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);483 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);484 if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {485 goto RunDefWndProc;486 }487 break;488 357 case WM_BUTTON1DBLCLK: 489 point.x = (*(POINTS *)&mp1).x;490 point.y = (*(POINTS *)&mp1).y;491 ClientPoint.x = point.x;492 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);493 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);494 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {495 goto RunDefWndProc;496 }497 break;498 358 case WM_BUTTON2DOWN: 499 point.x = (*(POINTS *)&mp1).x;500 point.y = (*(POINTS *)&mp1).y;501 ClientPoint.x = point.x;502 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);503 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);504 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {505 goto RunDefWndProc;506 }507 break;508 359 case WM_BUTTON2UP: 509 point.x = (*(POINTS *)&mp1).x;510 point.y = (*(POINTS *)&mp1).y;511 ClientPoint.x = point.x;512 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);513 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);514 if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {515 goto RunDefWndProc;516 }517 break;518 360 case WM_BUTTON2DBLCLK: 519 point.x = (*(POINTS *)&mp1).x;520 point.y = (*(POINTS *)&mp1).y;521 ClientPoint.x = point.x;522 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);523 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);524 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {525 goto RunDefWndProc;526 }527 break;528 361 case WM_BUTTON3DOWN: 529 point.x = (*(POINTS *)&mp1).x;530 point.y = (*(POINTS *)&mp1).y;531 ClientPoint.x = point.x;532 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);533 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);534 if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {535 goto RunDefWndProc;536 }537 break;538 362 case WM_BUTTON3UP: 539 point.x = (*(POINTS *)&mp1).x;540 point.y = (*(POINTS *)&mp1).y;541 ClientPoint.x = point.x;542 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);543 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);544 if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {545 goto RunDefWndProc;546 }547 break;548 363 case WM_BUTTON3DBLCLK: 549 point.x = (*(POINTS *)&mp1).x; 550 point.y = (*(POINTS *)&mp1).y; 551 ClientPoint.x = point.x; 552 ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y); 553 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point); 554 if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) { 364 if(win32wnd->MsgButton(pWinMsg)) { 555 365 goto RunDefWndProc; 556 366 } … … 570 380 case WM_MOUSEMOVE: 571 381 { 572 ULONG keystate = 0;573 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)574 keystate |= WMMOVE_LBUTTON;575 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)576 keystate |= WMMOVE_MBUTTON;577 if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)578 keystate |= WMMOVE_RBUTTON;579 if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)580 keystate |= WMMOVE_SHIFT;581 if(WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)582 keystate |= WMMOVE_CTRL;583 584 382 //OS/2 Window coordinates -> Win32 Window coordinates 585 win32wnd->MsgMouseMove( keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)));383 win32wnd->MsgMouseMove(pWinMsg); 586 384 break; 587 385 } 588 386 589 387 case WM_CONTROL: 590 591 388 case WM_COMMAND: 592 if(SHORT1FROMMP(mp2) == CMDSRC_MENU) { 593 win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0); 594 } 595 if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) { 596 win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0); 597 } 389 dprintf(("OS2: WM_COMMAND %x %x %x", hwnd, mp1, mp2)); 390 win32wnd->DispatchMsg(pWinMsg); 598 391 //todo controls + accelerators 599 392 break; … … 601 394 case WM_SYSCOMMAND: 602 395 { 603 ULONG x = 0, y = 0; 604 ULONG win32sc; 605 606 if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action 607 POINTL pointl; 608 WinQueryPointerPos(HWND_DESKTOP, &pointl); 609 x = pointl.x; 610 y = ScreenHeight - y; 611 } 612 switch(SHORT1FROMMP(mp1)) { 613 case SC_MOVE: 614 win32sc = SC_MOVE_W; 615 break; 616 case SC_CLOSE: 617 win32sc = SC_CLOSE_W; 618 break; 619 case SC_MAXIMIZE: 620 win32sc = SC_MAXIMIZE_W; 621 break; 622 case SC_MINIMIZE: 623 win32sc = SC_MINIMIZE_W; 624 break; 625 case SC_NEXTFRAME: 626 case SC_NEXTWINDOW: 627 win32sc = SC_NEXTWINDOW_W; 628 break; 629 case SC_RESTORE: 630 win32sc = SC_RESTORE_W; 631 break; 632 case SC_TASKMANAGER: 633 win32sc = SC_TASKLIST_W; 634 break; 635 default: 396 if(win32wnd->DispatchMsg(pWinMsg)) { 636 397 goto RunDefWndProc; 637 398 } 638 dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));639 if(win32wnd->MsgSysCommand(win32sc, x, y)) {640 goto RunDefWndProc;641 }642 399 break; 643 400 } 644 401 case WM_CHAR: 645 402 { 646 THDB *thdb; 647 ULONG repeatCount=0, virtualKey=0, keyFlags=0, scanCode=0; 648 ULONG flags = SHORT1FROMMP(mp1); 649 BOOL keyWasPressed, fTranslated = FALSE, fRunDefWndProc = FALSE; 650 651 char c; 652 653 repeatCount = CHAR3FROMMP(mp1); 654 scanCode = CHAR4FROMMP(mp1); 655 keyWasPressed = ((SHORT1FROMMP (mp1) & KC_PREVDOWN) == KC_PREVDOWN); 656 657 dprintf(("PM: WM_CHAR: %x %x %d %x", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), repeatCount, scanCode)); 658 dprintf(("PM: WM_CHAR: %x", flags)); 659 660 // vitali add begin 661 if ( ( SHORT1FROMMP(mp2) & 0x0FF ) == 0x0E0 ) 662 { 663 // an extended key ( arrows, ins, del and so on ) 664 // get "virtual" scancode from character code cause 665 // for "regular" keys they are equal 666 scanCode = ( SHORT1FROMMP(mp2) >> 8) & 0x0FF; 667 } 668 // vitali add end 669 670 // both WM_KEYUP & WM_KEYDOWN want a virtual key, find the right Win32 virtual key 671 // given the OS/2 virtual key and OS/2 character 672 673 //if (((SHORT1FROMMP (mp1) & KC_CHAR) == KC_CHAR) || 674 // ((SHORT1FROMMP (mp1) & KC_LONEKEY) == KC_LONEKEY)) 675 c = 0; 676 if ((SHORT1FROMMP (mp1) & 0xFF) != 0) 677 { 678 c = SHORT1FROMMP (mp2); 679 if ((c >= 'A') && (c <= 'Z')) { 680 virtualKey = c; 681 goto VirtualKeyFound; 682 } 683 if ((c >='a') && (c <= 'z')) { 684 virtualKey = c - 32; // make it uppercase 685 goto VirtualKeyFound; 686 } 687 if ((c >= '0') && (c <= '9')) { 688 virtualKey = c; 689 goto VirtualKeyFound; 690 } 691 } 692 693 // convert OS/2 virtual keys to Win32 virtual key 694 if (SHORT2FROMMP (mp2) <= VK_BLK2) 695 virtualKey = virtualKeyTable [SHORT2FROMMP (mp2)]; 696 697 VirtualKeyFound: 698 dprintf (("VIRTUALKEYFOUND:(%x)", virtualKey)); 699 700 if(!(SHORT1FROMMP(mp1) & KC_ALT)) 701 { 702 // 703 // the Alt key is not pressed 704 // 705 if ((flags & KC_KEYUP) == KC_KEYUP) { 706 // send WM_KEYUP message 707 708 if(win32wnd->MsgKeyUp (repeatCount, scanCode, virtualKey)) { 709 fRunDefWndProc = TRUE; 710 } 711 } 712 else { 713 // send WM_KEYDOWN message 714 if (win32wnd->MsgKeyDown (repeatCount, scanCode, 715 virtualKey, keyWasPressed)) 716 fRunDefWndProc = TRUE; 717 } 718 } 719 else { 720 // 721 // the Alt key is pressed 722 // 723 if ((flags & KC_KEYUP) == KC_KEYUP) { 724 // send WM_SYSKEYUP message 725 726 dprintf(("PMWINDOW_WM_SYSKEYUP: vkey:(%x)", virtualKey)); 727 if(win32wnd->MsgSysKeyUp (repeatCount, scanCode, virtualKey)) { 728 fRunDefWndProc = TRUE; 729 } 730 } 731 else { 732 // send WM_SYSKEYDOWN message 733 dprintf(("PMWINDOW_WM_SYSKEYDOWN: vkey:(%x)", virtualKey)); 734 if (win32wnd->MsgSysKeyDown (repeatCount, scanCode, virtualKey, keyWasPressed)) 735 fRunDefWndProc = TRUE; 736 } 737 } 738 739 thdb = GetThreadTHDB(); 740 if(thdb) { 741 fTranslated = thdb->fMsgTranslated; 742 thdb->fMsgTranslated = FALSE; //reset flag 743 } 744 //NOTE: These actually need to be posted so that the next message retrieved by GetMessage contains 745 // the newly generated WM_CHAR message. 746 if(fTranslated && !((flags & KC_KEYUP) == KC_KEYUP)) 747 {//TranslatedMessage was called before DispatchMessage, so send WM_CHAR messages 748 ULONG keyflags = 0, vkey = 0; 749 ULONG fl = SHORT1FROMMP(mp1); 750 ULONG chCode = SHORT1FROMMP(mp2); 751 752 if(!(fl & KC_CHAR)) { 753 //SvL: Test 754 break; 755 // goto RunDefWndProc; 756 } 757 if(fl & KC_VIRTUALKEY) { 758 if(virtualKey) 759 vkey = virtualKey; 760 else vkey = SHORT2FROMMP(mp2); 761 chCode = vkey; 762 } 763 if(fl & KC_KEYUP) { 764 keyflags |= KEY_UP; 765 } 766 if(fl & KC_ALT) { 767 keyflags |= KEY_ALTDOWN; 768 } 769 if(fl & KC_PREVDOWN) { 770 keyflags |= KEY_PREVDOWN; 771 } 772 if(fl & KC_DEADKEY) { 773 keyflags |= KEY_DEADKEY; 774 } 775 if(win32wnd->MsgChar(chCode, CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), virtualKey, keyflags)) { 776 //SvL: Test 777 // goto RunDefWndProc; 778 779 } 780 } 781 //SvL: Test 782 // if(fRunDefWndProc) goto RunDefWndProc; 403 win32wnd->DispatchMsg(pWinMsg); 783 404 break; 784 405 } 785 406 786 407 case WM_INITMENU: 787 win32wnd->MsgInitMenu((HWND)mp2); 788 break; 408 win32wnd->MsgInitMenu(pWinMsg); 409 break; 410 411 case WM_TIMER: 412 win32wnd->DispatchMsg(pWinMsg); 413 goto RunDefWndProc; 789 414 790 415 case WM_MENUSELECT: 791 416 case WM_MENUEND: 792 417 case WM_NEXTMENU: 793 goto RunDefWndProc;794 795 case WM_TIMER:796 if (mp2)797 {798 BOOL sys;799 ULONG id;800 801 dprintf(("OS2: WM_TIMER %x %d", hwnd, mp1));802 if (TIMER_GetTimerInfo(hwnd,(ULONG)mp1,&sys,&id))803 {804 if (sys)805 win32wnd->MsgSysTimer(id);806 else807 win32wnd->MsgTimer(id);808 }809 }810 418 goto RunDefWndProc; 811 419 … … 845 453 } 846 454 847 case WM_ERASEBACKGROUND:848 {849 dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle()));850 #if 1851 break;852 #else853 854 if (WinQueryUpdateRect (hwnd, NULL) && !win32wnd->isSupressErase()) {855 BOOL erased = sendEraseBkgnd (win32wnd);856 win32wnd->setEraseBkgnd (!erased, !erased);857 }858 859 break;860 #endif861 }862 863 455 case WM_PAINT: 864 { 865 dprintf(("OS2: WM_PAINT %x", hwnd)); 866 867 #if 0 868 if (WinQueryUpdateRect (hwnd, NULL)) { 869 if (!win32wnd->isSupressErase() && win32wnd->isEraseBkgnd()) { 870 BOOL erased = sendEraseBkgnd (win32wnd); 871 win32wnd->setEraseBkgnd (!erased, !erased); 872 } 873 } 874 875 win32wnd->setSupressErase (FALSE); 876 #endif 877 878 win32wnd->MsgPaint(0, 0); 879 880 //validate the update region, WM_PAINT has no return value 881 goto RunDefWndProc; 882 } 456 win32wnd->DispatchMsg(pWinMsg); 457 goto RunDefWndProc; 883 458 884 459 case WM_HITTEST: 885 // Only send this message if the window is enabled 886 if (WinIsWindowEnabled(hwnd)) 887 { 888 OSLIBPOINT pt; 889 dprintf(("USER32: WM_HITTEST (%d,%d)",(*(POINTS *)&mp1).x,(*(POINTS *)&mp1).y)); 890 pt.x = (*(POINTS *)&mp1).x; 891 pt.y = (*(POINTS *)&mp1).y; 892 MapOS2ToWin32Point( OSLIB_HWND_DESKTOP, hwnd, &pt); 893 if(win32wnd->MsgHitTest(pt.x, pt.y)) 460 // Only send this message if the window is enabled 461 if (WinIsWindowEnabled(hwnd)) 894 462 { 895 goto RunDefWndProc; 896 } 897 } else goto RunDefWndProc; 898 break; 463 if(win32wnd->MsgHitTest(pWinMsg)) { 464 goto RunDefWndProc; 465 } 466 } 467 else goto RunDefWndProc; 899 468 900 469 case WM_CONTEXTMENU: 901 { 902 POINTL pt; 903 904 dprintf(("OS2: WM_CONTEXTMENU %x", hwnd)); 905 pt.x = (*(POINTS *)&mp1).x; 906 pt.y = (*(POINTS *)&mp1).y; 907 WinMapWindowPoints(hwnd,HWND_DESKTOP,&pt,1); 908 pt.y = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN)-pt.y-1; 909 win32wnd->MsgContextMenu(pt.x,pt.y); 470 { 471 win32wnd->DispatchMsg(pWinMsg); 910 472 911 473 RestoreOS2TIB(); 912 474 return (MRESULT)TRUE; 913 } 475 } 476 477 case WM_ERASEBACKGROUND: 478 { 479 dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle())); 480 break; 481 } 482 483 case WM_SIZE: 484 { 485 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2))); 486 break; 487 } 488 case WM_MINMAXFRAME: 489 { 490 dprintf(("OS2: WM_MINMAXFRAME")); 491 break; 492 } 493 case WM_OWNERPOSCHANGE: 494 { 495 dprintf(("OS2: WM_OWNERPOSCHANGE")); 496 goto RunDefWndProc; 497 } 498 499 case WM_CALCVALIDRECTS: 500 { 501 dprintf(("OS2: WM_CALCVALIDRECTS")); 502 goto RunDefWndProc; 503 } 504 505 case WM_FOCUSCHANGE: 506 dprintf(("OS2: WM_FOCUSCHANGE %x", win32wnd->getWindowHandle())); 507 goto RunDefWndProc; 914 508 915 509 case WM_SYSCOLORCHANGE: … … 934 528 case WM_SEMANTICEVENT: 935 529 default: 936 //dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));530 //dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 937 531 RestoreOS2TIB(); 938 532 return WinDefWindowProc( hwnd, msg, mp1, mp2 );
Note:
See TracChangeset
for help on using the changeset viewer.
