- Timestamp:
- May 11, 2001, 10:39:46 AM (24 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/Makefile
r5496 r5685 1 # $Id: Makefile,v 1.8 2 2001-04-12 14:04:32sandervl Exp $1 # $Id: Makefile,v 1.83 2001-05-11 08:39:41 sandervl Exp $ 2 2 3 3 # … … 18 18 # 19 19 !ifndef WAT 20 CDEFINES = $(CDEFINES) -DINVERT -D ODIN_HITTEST20 CDEFINES = $(CDEFINES) -DINVERT -DCLIENTFRAME 21 21 !else 22 CDEFINES += -DINVERT -D ODIN_HITTEST22 CDEFINES += -DINVERT -DCLIENTFRAME 23 23 !endif 24 24 -
trunk/src/user32/caret.cpp
r4976 r5685 1 /* $Id: caret.cpp,v 1.1 6 2001-01-19 23:03:45sandervl Exp $ */1 /* $Id: caret.cpp,v 1.17 2001-05-11 08:39:41 sandervl Exp $ */ 2 2 3 3 /* … … 157 157 else 158 158 { 159 long height = wnd->get WindowHeight();160 caretPos.y = height - (caretPos.y + wnd->getClientRectPtr()->top) - 1;161 xNew = caretPos.x + wnd->getClientRectPtr()->left;159 long height = wnd->getClientHeight(); 160 caretPos.y = height - caretPos.y; 161 xNew = caretPos.x; 162 162 yNew = caretPos.y - cursorInfo.cy; 163 163 } … … 208 208 } 209 209 else { 210 long height = wnd->get WindowHeight();210 long height = wnd->getClientHeight(); 211 211 caretPos.y += cursorInfo.cy; 212 cursorInfo.y = height - caretPos.y - wnd->getClientRectPtr()->top - 1; 213 cursorInfo.x -= wnd->getClientRectPtr()->left; 212 cursorInfo.y = height - caretPos.y; 214 213 } 215 214 } -
trunk/src/user32/dc.cpp
r5655 r5685 1 /* $Id: dc.cpp,v 1.9 8 2001-05-04 17:02:50sandervl Exp $ */1 /* $Id: dc.cpp,v 1.99 2001-05-11 08:39:41 sandervl Exp $ */ 2 2 3 3 /* … … 387 387 VOID removeClientArea(Win32BaseWindow *window, pDCData pHps) 388 388 { 389 POINTL point;390 391 // This function checks to see if a client area is currently selected, if392 // it is the origin plus the visible region of the frame are restored.393 394 389 pHps->isClient = FALSE; 395 396 //// dprintfOrigin(pHps->hps); 397 398 if(pHps->isClientArea) 399 { 400 dprintf2(("removeClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y)); 401 pHps->isClientArea = FALSE; 402 GreSetupDC(pHps->hps, 403 pHps->hrgnVis, 404 pHps->ptlOrigin.x, 405 pHps->ptlOrigin.y, 406 0, 407 SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP); 408 } 409 //// else dprintf2(("removeClientArea: %x (%d,%d) (%d,%d)", window->getWindowHandle(), point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y)); 410 390 pHps->isClientArea = FALSE; 411 391 } 412 392 //****************************************************************************** … … 414 394 void selectClientArea(Win32BaseWindow *window, pDCData pHps) 415 395 { 416 // This function checks to see if the DC needs to be adjusted to a client417 // area and makes the adjustment.418 RECTL rcl, rcltemp;419 HRGN hrgnRect, hrgnClip, hrgnOldClip = 0;420 HWND hwnd;421 LONG rc;422 PRECT pClient = window->getClientRectPtr();423 PRECT pWindow = window->getWindowRect();424 RECT rectWindow;425 RECTL rectWindowOS2;426 427 if(!window->isOwnDCDirty() && (pClient->left == 0 && pClient->top == 0 &&428 window->getClientHeight() == window->getWindowHeight() &&429 window->getClientWidth() == window->getWindowWidth()))430 {431 //client rectangle = frame rectangle -> no change necessary432 return;433 }434 396 pHps->isClient = TRUE; 435 436 hwnd = window->getOS2WindowHandle();437 438 mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&rcl);439 440 GetWindowRect(window->getWindowHandle(), &rectWindow);441 mapWin32ToOS2Rect(GetScreenHeight(), &rectWindow, (PRECTLOS2)&rectWindowOS2);442 dprintf2(("frame (%d,%d)(%d,%d) hps height %d", rectWindowOS2.xLeft, rectWindowOS2.yBottom, rectWindowOS2.xRight, rectWindowOS2.yTop, pHps->height));443 444 //convert to screen coordinates445 GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp);446 447 if(pHps->isClientArea)448 {449 //TODO: counter450 dprintf2(("WARNING: selectClientArea %x; already selected! origin (%d,%d) original origin (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, pHps->ptlOrigin.x, pHps->ptlOrigin.y));451 GetWindowRect(window->getWindowHandle(), &rectWindow);452 mapWin32ToOS2Rect(GetScreenHeight(), &rectWindow, (PRECTLOS2)&rectWindowOS2);453 if(rectWindowOS2.xLeft + rcl.xLeft != rcltemp.xLeft ||454 rectWindowOS2.yBottom + rcl.yBottom != rcltemp.yBottom)455 {456 dprintf2(("WARNING: origin changed (%d,%d) instead of (%d,%d)!", rcltemp.xLeft, rcltemp.yBottom, rectWindowOS2.xLeft + rcl.xLeft, rectWindowOS2.yBottom + rcl.yBottom));457 rcl.xLeft += rectWindowOS2.xLeft;458 rcl.xRight += rectWindowOS2.xLeft;459 rcl.yTop += rectWindowOS2.yBottom;460 rcl.yBottom += rectWindowOS2.yBottom;461 }462 else return;463 }464 else {465 rcl.xLeft += rcltemp.xLeft;466 rcl.xRight += rcltemp.xLeft;467 rcl.yTop += rcltemp.yBottom;468 rcl.yBottom += rcltemp.yBottom;469 470 pHps->ptlOrigin.x = rcltemp.xLeft;471 pHps->ptlOrigin.y = rcltemp.yBottom;472 }473 dprintf2(("selectClientArea %x: (%d,%d) -> (%d,%d)", window->getWindowHandle(), rcltemp.xLeft, rcltemp.yBottom, rcl.xLeft, rcl.yBottom));474 475 if(pHps->hrgnVis == 0)476 pHps->hrgnVis = GreCreateRectRegion(pHps->hps, &rcl, 1);477 478 hrgnRect = GreCreateRectRegion(pHps->hps, &rcl, 1);479 #if 0480 if(window->getParent())481 {482 HRGN hrgnParentClip;483 484 pClient = window->getParent()->getClientRectPtr();485 GetWindowRect(window->getParent()->getWindowHandle(), &rectWindow);486 rectWindow.right = rectWindow.left + pClient->right;487 rectWindow.left += pClient->left;488 rectWindow.bottom = rectWindow.top + pClient->bottom;489 rectWindow.top += pClient->top;490 mapWin32ToOS2Rect(GetScreenHeight(), &rectWindow, (PRECTLOS2)&rectWindowOS2);491 492 hrgnParentClip = GreCreateRectRegion(pHps->hps, &rectWindowOS2, 1);493 #ifdef DEBUG494 dprintf(("Combining client & parent client regions"));495 dprintfRegion1(pHps->hps, window->getWindowHandle(), hrgnParentClip);496 dprintfRegion1(pHps->hps, window->getWindowHandle(), hrgnRect);497 #endif498 499 GreCombineRegion(pHps->hps, hrgnRect, hrgnParentClip, hrgnRect, CRGN_AND);500 GreDestroyRegion(pHps->hps, hrgnParentClip);501 }502 #endif503 504 // Query the visible region505 GreCopyClipRegion(pHps->hps, pHps->hrgnVis, 0, COPYCRGN_VISRGN);506 GpiQueryRegionBox(pHps->hps, pHps->hrgnVis, &rcltemp);507 // And the visible region of the frame with the client rectangle508 // to get the new visible region509 GreCombineRegion(pHps->hps, hrgnRect, pHps->hrgnVis, hrgnRect, CRGN_AND);510 #ifdef DEBUG511 dprintfRegion1(pHps->hps, window->getWindowHandle(), hrgnRect);512 #endif513 514 // Set the new origin plus visible region in the DC515 GreSetupDC(pHps->hps,516 hrgnRect,517 rcl.xLeft,518 rcl.yBottom,519 NULL,520 SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP);521 522 // Destroy the region now we have finished with it.523 GreDestroyRegion(pHps->hps, hrgnRect);524 525 397 pHps->isClientArea = TRUE; 526 527 if(pClient->left == 0 && pClient->top == 0 &&528 window->getClientHeight() == window->getWindowHeight() &&529 window->getClientWidth() == window->getWindowWidth())530 {531 //client = frame, so no changes are necessary when switching between the two532 pHps->isClient = FALSE;533 pHps->isClientArea = FALSE;534 }535 if(window->isOwnDCDirty()) {536 window->validateOwnDC();537 setPageXForm(window, pHps);538 }539 540 //testestest541 #if 0542 GpiQueryViewingLimits(pHps->hps, &rectWindowOS2);543 dprintf2(("view limits (%d,%d)(%d,%d)", rectWindowOS2.xLeft, rectWindowOS2.yBottom, rectWindowOS2.xRight, rectWindowOS2.yTop));544 GpiQueryDefViewingLimits(pHps->hps, &rectWindowOS2);545 dprintf2(("def view limits (%d,%d)(%d,%d)", rectWindowOS2.xLeft, rectWindowOS2.yBottom, rectWindowOS2.xRight, rectWindowOS2.yTop));546 GpiQueryPageViewport(pHps->hps, &rectWindowOS2);547 dprintf2(("page viewport (%d,%d)(%d,%d)", rectWindowOS2.xLeft, rectWindowOS2.yBottom, rectWindowOS2.xRight, rectWindowOS2.yTop));548 549 GpiQueryBoundaryData(pHps->hps, &rectWindowOS2);550 dprintf2(("boundary data (%d,%d)(%d,%d)", rectWindowOS2.xLeft, rectWindowOS2.yBottom, rectWindowOS2.xRight, rectWindowOS2.yTop));551 552 GpiQueryGraphicsField(pHps->hps, &rectWindowOS2);553 dprintf2(("graphics field (%d,%d)(%d,%d)", rectWindowOS2.xLeft, rectWindowOS2.yBottom, rectWindowOS2.xRight, rectWindowOS2.yTop));554 555 SIZEL size;556 GpiQueryPickApertureSize(pHps->hps, &size);557 dprintf2(("page viewport (%d,%d)", size.cx, size.cy));558 559 GpiQueryPS(pHps->hps, &size);560 dprintf2(("page space (%d,%d)", size.cx, size.cy));561 #endif562 //testestest563 564 398 } 565 399 //****************************************************************************** … … 576 410 LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps) 577 411 { 578 if ((hwnd == 0) && (pHps != 0))579 hwnd = pHps->hwnd;580 581 if ((hwnd != 0) || (pHps == 0))582 {412 if ((hwnd == 0) && (pHps != 0)) 413 hwnd = pHps->hwnd; 414 415 if ((hwnd != 0) || (pHps == 0)) 416 { 583 417 if(wnd) { 584 585 586 587 elsereturn (wnd->getClientHeight());588 } 589 else 590 }591 else if (pHps->bitmapHandle)592 {593 return pHps->bitmapHeight;594 }595 else if (pHps->isMetaPS)596 {597 return 0;598 }599 else if (pHps->isPrinter)600 {601 return pHps->printPageHeight;602 }603 else604 {605 return MEM_HPS_MAX;606 }607 } 608 //****************************************************************************** 609 //****************************************************************************** 610 BOOL 418 if(pHps && !pHps->isClientArea) { 419 return (wnd->getWindowHeight()); 420 } 421 else return (wnd->getClientHeight()); 422 } 423 else return OSLibQueryScreenHeight(); 424 } 425 else if (pHps->bitmapHandle) 426 { 427 return pHps->bitmapHeight; 428 } 429 else if (pHps->isMetaPS) 430 { 431 return 0; 432 } 433 else if (pHps->isPrinter) 434 { 435 return pHps->printPageHeight; 436 } 437 else 438 { 439 return MEM_HPS_MAX; 440 } 441 } 442 //****************************************************************************** 443 //****************************************************************************** 444 BOOL WIN32API changePageXForm(pDCData pHps, PPOINTL pValue, int x, int y, PPOINTL pPrev) 611 445 { 612 446 Win32BaseWindow *wnd; 613 447 614 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 448 if(pHps->isClient) { 449 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 450 } 451 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 615 452 return changePageXForm(wnd, pHps, pValue, x, y, pPrev); 616 453 } 617 454 //****************************************************************************** 618 455 //****************************************************************************** 619 BOOL 456 BOOL WIN32API setPageXForm(pDCData pHps) 620 457 { 621 458 Win32BaseWindow *wnd; 622 459 623 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 460 if(pHps->isClient) { 461 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 462 } 463 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 624 464 return setPageXForm(wnd, pHps); 625 465 } 626 466 //****************************************************************************** 627 467 //****************************************************************************** 628 VOID 468 VOID WIN32API removeClientArea(pDCData pHps) 629 469 { 630 470 Win32BaseWindow *wnd; 631 471 632 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 472 if(pHps->isClient) { 473 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 474 } 475 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 633 476 if(wnd) { 634 477 removeClientArea(wnd, pHps); … … 641 484 Win32BaseWindow *wnd; 642 485 643 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 486 if(pHps->isClient) { 487 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 488 } 489 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 644 490 if(wnd) { 645 491 selectClientArea(wnd, pHps); … … 652 498 Win32BaseWindow *wnd; 653 499 654 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 500 if(pHps->isClient) { 501 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 502 } 503 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 655 504 if(wnd) { 656 dprintfOrigin(pHps->hps);657 505 if(pHps->isClient) 658 506 selectClientArea(wnd, pHps); … … 661 509 //****************************************************************************** 662 510 //****************************************************************************** 663 LONG 511 LONG WIN32API clientHeight(HWND hwnd, pDCData pHps) 664 512 { 665 513 Win32BaseWindow *wnd; 666 514 667 wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 515 if(pHps->isClient) { 516 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 517 } 518 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 668 519 return clientHeight(wnd, hwnd, pHps); 669 520 } 670 521 //****************************************************************************** 671 522 //****************************************************************************** 672 int 523 int WIN32API setMapMode(pDCData pHps, int mode) 673 524 { 674 525 Win32BaseWindow *wnd; 675 526 676 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 527 if(pHps->isClient) { 528 wnd = Win32BaseWindow::GetWindowFromOS2Handle(pHps->hwnd); 529 } 530 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 677 531 return setMapMode(wnd, pHps, mode); 678 532 } … … 790 644 RECTL rectlClip; 791 645 792 if(lpps == NULL) {646 if(lpps == NULL) { 793 647 //BeginPaint does NOT change last error in this case 794 648 //(verified in NT4, SP6) 795 649 dprintf (("USER32: BeginPaint %x NULL PAINTSTRUCT pointer", hWnd)); 796 650 return 0; 797 }798 memset(lpps, 0, sizeof(*lpps));799 800 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);801 if(!wnd) {651 } 652 memset(lpps, 0, sizeof(*lpps)); 653 654 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 655 if(!wnd) { 802 656 dprintf (("USER32: BeginPaint %x %x: invalid window handle!!", hWnd, lpps)); 803 657 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); //(verified in NT4, SP6) 804 658 return (HDC)0; 805 }806 HWND hwndClient = wnd->getOS2WindowHandle();807 808 if(hwnd != HWND_DESKTOP && wnd->isOwnDC())809 {659 } 660 HWND hwndClient = wnd->getOS2WindowHandle(); 661 662 if(hwnd != HWND_DESKTOP && wnd->isOwnDC()) 663 { 810 664 hPS_ownDC = wnd->getOwnDC(); 811 665 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise) 812 666 if(hPS_ownDC) { 813 814 815 816 817 818 819 820 821 } 822 }823 if(!hpsPaint) {824 hpsPaint = GetDCEx(hwnd, 0, (DCX_CACHE_W|DCX_ WINDOW_W|DCX_USESTYLE_W));667 pHps = (pDCData)GpiQueryDCData(hPS_ownDC); 668 if (!pHps) 669 { 670 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 671 SetLastError(ERROR_INVALID_PARAMETER_W); 672 return (HDC)NULLHANDLE; 673 } 674 hpsPaint = hPS_ownDC; 675 } 676 } 677 if(!hpsPaint) { 678 hpsPaint = GetDCEx(hwnd, 0, (DCX_CACHE_W|DCX_USESTYLE_W)); 825 679 pHps = (pDCData)GpiQueryDCData(hpsPaint); 826 680 if (!pHps) 827 681 { 828 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 829 SetLastError(ERROR_INVALID_PARAMETER_W); 830 return (HDC)NULLHANDLE; 831 } 832 } 833 834 if(WinQueryUpdateRect(hwndClient, &rectl) == FALSE) { 682 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 683 SetLastError(ERROR_INVALID_PARAMETER_W); 684 return (HDC)NULLHANDLE; 685 } 686 } 687 688 if(WinQueryUpdateRect(hwndClient, &rectl) == FALSE) 689 { 835 690 memset(&rectl, 0, sizeof(rectl)); 836 691 dprintf (("USER32: WARNING: WinQueryUpdateRect failed (error or no update rectangle)!!")); … … 844 699 wnd->SetClipRegion(hrgnOldClip); 845 700 lComplexity = RGN_NULL; 846 }847 else {701 } 702 else { 848 703 rectlClip.yBottom = rectlClip.xLeft = 0; 849 704 rectlClip.yTop = rectlClip.xRight = 1; … … 854 709 WinValidateRegion(hwndClient, hrgnClip, FALSE); 855 710 856 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient); 857 WinIntersectRect(NULL, &rectlClip, &rectl, &rectlClient); 858 WinOffsetRect(NULL, &rectlClip, -rectlClient.xLeft, -rectlClient.yBottom); 859 860 //clip update region with client window rectangle 861 HRGN hrgnClient = GpiCreateRegion(pHps->hps, 1, &rectlClient); 862 GpiCombineRegion(pHps->hps, hrgnClip, hrgnClip, hrgnClient, CRGN_AND); 863 GpiDestroyRegion(pHps->hps, hrgnClient); 864 865 //change origin of clip region (window -> client) 866 POINTL point = {-rectlClient.xLeft, -rectlClient.yBottom}; 867 GpiOffsetRegion(pHps->hps, hrgnClip, &point); 711 dprintfRegion(pHps->hps, wnd->getWindowHandle(), hrgnClip); 712 868 713 #ifdef DEBUG 869 dprintfRegion1(pHps->hps, hWnd, hrgnClip); 714 lComplexity = GpiQueryClipBox(pHps->hps, &rectlClip); 715 dprintf(("ClipBox (%d): (%d,%d)(%d,%d)", lComplexity, rectlClip.xLeft, rectlClip.yBottom, rectlClip.xRight, rectlClip.yTop)); 870 716 #endif 717 871 718 //set clip region 872 719 lComplexity = GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip); 873 720 874 //change presentation space for client window 875 //NOTE: MUST do this after GpiSetClipRegion call! 876 // When a window with CS_OWNDC looses focus, for some reason 877 // GpiSetClipRegion resets the window dc origin back to (0,0) 721 if(lComplexity == RGN_NULL) { 722 dprintf (("BeginPaint %x: EMPTY update rectangle (show=%d/%d vis=%d/%d", hWnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()), WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle()))); 723 } 878 724 selectClientArea(wnd, pHps); 879 725 880 GpiQueryClipBox(pHps->hps, &rectl); 881 dprintf(("ClipBox (%d): (%d,%d)(%d,%d)", lComplexity, rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop)); 882 726 #ifdef DEBUG 727 GpiQueryClipBox(pHps->hps, &rectlClip); 728 dprintf(("ClipBox (%d): (%d,%d)(%d,%d)", lComplexity, rectlClip.xLeft, rectlClip.yBottom, rectlClip.xRight, rectlClip.yTop)); 729 #endif 883 730 //save old clip region (restored for CS_OWNDC windows in EndPaint) 884 731 wnd->SetClipRegion(hrgnOldClip); 885 memcpy(&rectl, &rectlClip, sizeof(RECTL)); 886 lComplexity = RGN_RECT; 887 } 888 889 if(hPS_ownDC == 0) 890 setMapMode (wnd, pHps, MM_TEXT_W); 891 else 892 setPageXForm(wnd, pHps); 893 894 pHps->hdcType = TYPE_3; 895 896 HideCaret(hwnd); 897 WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE); 898 899 if(wnd->needsEraseBkgnd() && lComplexity != RGN_NULL) { 732 } 733 734 if(hPS_ownDC == 0) 735 setMapMode (wnd, pHps, MM_TEXT_W); 736 else 737 setPageXForm(wnd, pHps); 738 739 pHps->hdcType = TYPE_3; 740 741 HideCaret(hwnd); 742 WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE); 743 744 if((wnd->needsEraseBkgnd() || wnd->IsVisibleRegionChanged()) && lComplexity != RGN_NULL) { 900 745 wnd->setEraseBkgnd(FALSE); 746 wnd->SetVisibleRegionChanged(FALSE); 901 747 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) == 0); 902 } 903 else lpps->fErase = TRUE; 904 905 dprintfOrigin(pHps->hps); 906 907 lpps->hdc = (HDC)pHps->hps; 908 909 if(lComplexity != RGN_NULL) { 748 } 749 else lpps->fErase = TRUE; 750 751 lpps->hdc = (HDC)pHps->hps; 752 753 if(lComplexity != RGN_NULL) { 910 754 long height = wnd->getClientHeight(); 911 755 lpps->rcPaint.top = height - rectl.yTop; … … 913 757 lpps->rcPaint.bottom = height - rectl.yBottom; 914 758 lpps->rcPaint.right = rectl.xRight; 915 }916 else {759 } 760 else { 917 761 lpps->rcPaint.bottom = lpps->rcPaint.top = 0; 918 762 lpps->rcPaint.right = lpps->rcPaint.left = 0; 919 }920 921 SetLastError(0);922 dprintf(("USER32: BeginPaint %x -> hdc %x (%d,%d)(%d,%d)", hWnd, pHps->hps, lpps->rcPaint.left, lpps->rcPaint.top, lpps->rcPaint.right, lpps->rcPaint.bottom));923 return (HDC)pHps->hps;763 } 764 765 SetLastError(0); 766 dprintf(("USER32: BeginPaint %x -> hdc %x (%d,%d)(%d,%d)", hWnd, pHps->hps, lpps->rcPaint.left, lpps->rcPaint.top, lpps->rcPaint.right, lpps->rcPaint.bottom)); 767 return (HDC)pHps->hps; 924 768 } 925 769 //****************************************************************************** … … 931 775 pDCData pHps; 932 776 933 dprintf (("USER32: EndPaint(%x)", hwnd)); 934 935 if (!pPaint || !pPaint->hdc ) 936 return TRUE; 937 938 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 939 940 if (!wnd) goto exit; 941 942 pHps = (pDCData)GpiQueryDCData((HPS)pPaint->hdc); 943 if (pHps && (pHps->hdcType == TYPE_3)) 944 { 945 dprintfOrigin(pHps->hps); 946 777 dprintf (("USER32: EndPaint(%x)", hwnd)); 778 779 if (!pPaint || !pPaint->hdc ) 780 return TRUE; 781 782 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 783 784 if (!wnd) goto exit; 785 786 pHps = (pDCData)GpiQueryDCData((HPS)pPaint->hdc); 787 if (pHps && (pHps->hdcType == TYPE_3)) 788 { 947 789 GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld); 948 790 wnd->SetClipRegion(0); 949 791 if(hrgnOld) { 950 792 GpiDestroyRegion(pHps->hps, hrgnOld); 951 793 } 952 794 pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails 953 795 ReleaseDC(hwnd, pPaint->hdc); 954 }955 else {796 } 797 else { 956 798 dprintf(("EndPaint: wrong hdc %x!!", pPaint->hdc)); 957 }958 wnd->setEraseBkgnd(TRUE);959 ShowCaret(hwnd);960 WinShowTrackRect(wnd->getOS2WindowHandle(), TRUE);799 } 800 wnd->setEraseBkgnd(TRUE); 801 ShowCaret(hwnd); 802 WinShowTrackRect(wnd->getOS2WindowHandle(), TRUE); 961 803 962 804 exit: 963 SetLastError(0);964 return TRUE;805 SetLastError(0); 806 return TRUE; 965 807 } 966 808 //****************************************************************************** … … 971 813 int rc; 972 814 973 if (hwnd)974 {815 if (hwnd) 816 { 975 817 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 976 818 if(wnd == NULL) { 977 978 819 dprintf(("ERROR: ReleaseDC %x %x failed", hwnd, hdc)); 820 return 0; 979 821 } 980 822 isOwnDC = wnd->isOwnDC() && (wnd->getOwnDC() == hdc); 981 823 if(!isOwnDC) 982 824 { 983 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc); 984 if(pHps && pHps->psType == MICRO_CACHED) { 985 removeClientArea(wnd, pHps); 986 if(pHps->hrgnVis) { 987 GreDestroyRegion(pHps->hps, pHps->hrgnVis); 988 pHps->hrgnVis = 0; 989 } 825 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc); 826 if(pHps && pHps->psType == MICRO_CACHED) { 827 removeClientArea(wnd, pHps); 828 if(pHps->hrgnVis) { 829 GreDestroyRegion(pHps->hps, pHps->hrgnVis); 830 pHps->hrgnVis = 0; 990 831 } 991 else { 992 dprintf(("ERROR: ReleaseDC: pHps == NULL!!")); 993 DebugInt3(); 994 } 832 } 833 else { 834 dprintf(("ERROR: ReleaseDC: pHps == NULL!!")); 835 DebugInt3(); 836 } 995 837 } 996 838 else { 997 998 } 999 }1000 1001 if(isOwnDC) {839 dprintf2(("ReleaseDC: CS_OWNDC, not released")); 840 } 841 } 842 843 if(isOwnDC) { 1002 844 rc = TRUE; 1003 }1004 else {845 } 846 else { 1005 847 UnselectGDIObjects(hdc); 1006 848 rc = O32_ReleaseDC (0, hdc); 1007 }1008 1009 dprintf(("ReleaseDC %x %x", hwnd, hdc));1010 return (rc);849 } 850 851 dprintf(("ReleaseDC %x %x", hwnd, hdc)); 852 return (rc); 1011 853 } 1012 854 //****************************************************************************** … … 1035 877 PS_Type psType; 1036 878 1037 if(hwnd == 0) {879 if(hwnd == 0) { 1038 880 dprintf(("error: GetDCEx window %x not found", hwnd)); 1039 881 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 1040 882 return 0; 1041 }1042 1043 if(hwnd)1044 {883 } 884 885 if(hwnd) 886 { 1045 887 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 1046 888 if(wnd == NULL) { … … 1049 891 return 0; 1050 892 } 1051 hWindow = wnd->getOS2WindowHandle(); 1052 } 1053 1054 isWindowOwnDC = (((hWindow == HWND_DESKTOP) ? FALSE : (wnd->isOwnDC())) 1055 && !(flags & (DCX_CACHE_W|DCX_WINDOW_W))); 1056 1057 if(isWindowOwnDC) //own dc always for client area 1058 { 1059 hps = wnd->getOwnDC(); 1060 if (hps) 1061 { 1062 pDCData pHps = (pDCData)GpiQueryDCData (hps); 1063 if (!pHps) 1064 goto error; 1065 1066 selectClientArea(wnd, pHps); 1067 1068 //TODO: Is this always necessary?? 1069 setPageXForm (wnd, pHps); 1070 pHps->hdcType = TYPE_1; 1071 1072 //TODO: intersect/exclude clip region? 1073 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps)); 1074 return (HDC)hps; 1075 } 1076 else 1077 creatingOwnDC = TRUE; 1078 } 1079 1080 if(isWindowOwnDC) 1081 { 1082 SIZEL sizel = {0,0}; 1083 hps = GpiCreatePS (WinQueryAnchorBlock (hWindow), 1084 WinOpenWindowDC (hWindow), 1085 &sizel, PU_PELS | GPIT_MICRO | GPIA_ASSOC ); 1086 psType = MICRO; 1087 // default cp is OS/2 one: set to windows default (ODIN.INI) 1088 GpiSetCp(hps, GetDisplayCodepage()); 1089 } 1090 else 1091 { 1092 if (hWindow == HWND_DESKTOP) { 1093 hps = WinGetScreenPS (hWindow); 1094 } 1095 else { 1096 int clipstyle = 0; 1097 int clipwnd = HWND_TOP; 1098 if(flags & (DCX_USESTYLE_W)) { 893 if(flags & DCX_WINDOW_W) { 894 hWindow = wnd->getOS2FrameWindowHandle(); 895 } 896 else hWindow = wnd->getOS2WindowHandle(); 897 } 898 899 isWindowOwnDC = (((hWindow == HWND_DESKTOP) ? FALSE : (wnd->isOwnDC())) 900 && !(flags & (DCX_CACHE_W|DCX_WINDOW_W))); 901 902 if(isWindowOwnDC) //own dc always for client area 903 { 904 hps = wnd->getOwnDC(); 905 if (hps) 906 { 907 pDCData pHps = (pDCData)GpiQueryDCData (hps); 908 if (!pHps) 909 goto error; 910 911 selectClientArea(wnd, pHps); 912 913 //TODO: Is this always necessary?? 914 setPageXForm (wnd, pHps); 915 pHps->hdcType = TYPE_1; 916 917 //TODO: intersect/exclude clip region? 918 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps)); 919 return (HDC)hps; 920 } 921 else creatingOwnDC = TRUE; 922 } 923 924 if(isWindowOwnDC) 925 { 926 SIZEL sizel = {0,0}; 927 hps = GpiCreatePS (WinQueryAnchorBlock (hWindow), 928 WinOpenWindowDC (hWindow), 929 &sizel, PU_PELS | GPIT_MICRO | GPIA_ASSOC ); 930 psType = MICRO; 931 // default cp is OS/2 one: set to windows default (ODIN.INI) 932 GpiSetCp(hps, GetDisplayCodepage()); 933 } 934 else 935 { 936 if (hWindow == HWND_DESKTOP) { 937 hps = WinGetScreenPS (hWindow); 938 } 939 else { 940 int clipstyle = 0; 941 int clipwnd = HWND_TOP; 942 if(flags & (DCX_USESTYLE_W)) { 1099 943 int style = wnd->getStyle(); 1100 944 if(style & WS_CLIPCHILDREN_W) { 1101 945 clipstyle |= PSF_CLIPCHILDREN; 1102 946 } 1103 947 if(style & WS_CLIPSIBLINGS_W) { 1104 948 clipstyle |= PSF_CLIPSIBLINGS; 1105 949 } 1106 950 if(wnd->fHasParentDC()) { 1107 951 clipstyle |= PSF_PARENTCLIP; 1108 952 } 1109 }1110 if(flags & DCX_CLIPSIBLINGS_W) {953 } 954 if(flags & DCX_CLIPSIBLINGS_W) { 1111 955 clipstyle |= PSF_CLIPSIBLINGS; 1112 }1113 if(flags & DCX_CLIPCHILDREN_W) {956 } 957 if(flags & DCX_CLIPCHILDREN_W) { 1114 958 clipstyle |= PSF_CLIPCHILDREN; 1115 }1116 if(flags & DCX_PARENTCLIP_W) {959 } 960 if(flags & DCX_PARENTCLIP_W) { 1117 961 clipstyle |= PSF_PARENTCLIP; 1118 } 1119 if(clipstyle) { 1120 dprintf2(("WinGetClipPS style %x", clipstyle)); 1121 hps = WinGetClipPS(hWindow, clipwnd, clipstyle); 1122 } 1123 else hps = WinGetPS (hWindow); 1124 1125 // default cp is OS/2 one: set to windows default (ODIN.INI) 1126 GpiSetCp(hps, GetDisplayCodepage()); 1127 } 1128 psType = MICRO_CACHED; 1129 } 1130 1131 if (!hps) 1132 goto error; 1133 1134 HPSToHDC (hWindow, hps, NULL, NULL); 1135 pHps = (pDCData)GpiQueryDCData (hps); 1136 1137 if(!(flags & DCX_WINDOW_W)) 1138 { 1139 selectClientArea(wnd, pHps); 1140 } 1141 else removeClientArea(wnd, pHps); 1142 1143 setMapMode(wnd, pHps, MM_TEXT_W); 1144 1145 if ((flags & DCX_EXCLUDERGN_W) || (flags & DCX_INTERSECTRGN_W)) 1146 { 1147 ULONG BytesNeeded; 1148 PRGNDATA RgnData; 1149 PRECT pr; 1150 int i; 1151 RECTL rectl; 1152 1153 if (!hrgn) 1154 goto error; 1155 1156 success = TRUE; 1157 if (flags & DCX_EXCLUDERGN_W) 1158 { 962 } 963 if(clipstyle) { 964 dprintf2(("WinGetClipPS style %x", clipstyle)); 965 hps = WinGetClipPS(hWindow, clipwnd, clipstyle); 966 } 967 else hps = WinGetPS (hWindow); 968 969 // default cp is OS/2 one: set to windows default (ODIN.INI) 970 GpiSetCp(hps, GetDisplayCodepage()); 971 } 972 psType = MICRO_CACHED; 973 } 974 975 if (!hps) 976 goto error; 977 978 HPSToHDC (hWindow, hps, NULL, NULL); 979 pHps = (pDCData)GpiQueryDCData (hps); 980 981 if(flags & DCX_WINDOW_W) { 982 removeClientArea(wnd, pHps); 983 } 984 else selectClientArea(wnd, pHps); 985 986 setMapMode(wnd, pHps, MM_TEXT_W); 987 988 if ((flags & DCX_EXCLUDERGN_W) || (flags & DCX_INTERSECTRGN_W)) 989 { 990 ULONG BytesNeeded; 991 PRGNDATA RgnData; 992 PRECT pr; 993 int i; 994 RECTL rectl; 995 996 if (!hrgn) 997 goto error; 998 999 success = TRUE; 1000 if (flags & DCX_EXCLUDERGN_W) 1001 { 1159 1002 #if 0 //CB: todo 1160 1003 long height; … … 1181 1024 } 1182 1025 #endif 1183 }1184 else //DCX_INTERSECTRGN_W1185 {1186 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx1187 // with a region that covers the entire window (RealPlayer 7 Update 1)1188 // Using SelectClipRgn here doesn't make any difference.1189 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) {1026 } 1027 else //DCX_INTERSECTRGN_W 1028 { 1029 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx 1030 // with a region that covers the entire window (RealPlayer 7 Update 1) 1031 // Using SelectClipRgn here doesn't make any difference. 1032 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) { 1190 1033 dprintf(("ExtSelectClipRgn failed!!")); 1191 }1192 }1193 if (!success)1194 goto error;1195 }1196 1197 if (creatingOwnDC)1198 wnd->setOwnDC ((HDC)hps);1199 1200 pHps->psType = psType;1201 pHps->hdcType = TYPE_1;1202 //TODO: WM_SETREDRAW affects drawingAllowed flag!!1203 GpiSetDrawControl (hps, DCTL_DISPLAY, drawingAllowed ? DCTL_ON : DCTL_OFF);1204 1205 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> hdc %x", hwnd, hrgn, flags, pHps->hps));1206 return (HDC)pHps->hps;1034 } 1035 } 1036 if (!success) 1037 goto error; 1038 } 1039 1040 if (creatingOwnDC) 1041 wnd->setOwnDC ((HDC)hps); 1042 1043 pHps->psType = psType; 1044 pHps->hdcType = TYPE_1; 1045 //TODO: WM_SETREDRAW affects drawingAllowed flag!! 1046 GpiSetDrawControl (hps, DCTL_DISPLAY, drawingAllowed ? DCTL_ON : DCTL_OFF); 1047 1048 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> hdc %x", hwnd, hrgn, flags, pHps->hps)); 1049 return (HDC)pHps->hps; 1207 1050 1208 1051 error: 1209 /* Something went wrong; clean up1210 */1211 dprintf(("ERROR: GetDCEx hwnd %x (%x %x) FAILED!", hwnd, hrgn, flags));1212 DebugInt3();1213 if (pHps)1214 {1215 if (pHps->hps)1216 {1217 if(pHps->psType == MICRO_CACHED)1218 WinReleasePS(pHps->hps);1219 else1220 GpiDestroyPS(pHps->hps);1221 }1222 1223 if (pHps->hdc) DevCloseDC(pHps->hdc);1224 if (pHps->hrgnHDC) GpiDestroyRegion(pHps->hps, pHps->hrgnHDC);1225 1226 O32_DeleteObject (pHps->nullBitmapHandle);1227 }1228 SetLastError(ERROR_INVALID_PARAMETER_W);1229 return NULL;1052 /* Something went wrong; clean up 1053 */ 1054 dprintf(("ERROR: GetDCEx hwnd %x (%x %x) FAILED!", hwnd, hrgn, flags)); 1055 DebugInt3(); 1056 if (pHps) 1057 { 1058 if (pHps->hps) 1059 { 1060 if(pHps->psType == MICRO_CACHED) 1061 WinReleasePS(pHps->hps); 1062 else 1063 GpiDestroyPS(pHps->hps); 1064 } 1065 1066 if (pHps->hdc) DevCloseDC(pHps->hdc); 1067 if (pHps->hrgnHDC) GpiDestroyRegion(pHps->hps, pHps->hrgnHDC); 1068 1069 O32_DeleteObject (pHps->nullBitmapHandle); 1070 } 1071 SetLastError(ERROR_INVALID_PARAMETER_W); 1072 return NULL; 1230 1073 } 1231 1074 //****************************************************************************** … … 1233 1076 HDC WIN32API GetDC (HWND hwnd) 1234 1077 { 1235 if(!hwnd) 1236 return GetDCEx( GetDesktopWindow(), 0, DCX_CACHE_W | DCX_WINDOW_W ); 1237 return GetDCEx (hwnd, NULL, 0); 1078 if(!hwnd) 1079 return GetDCEx( GetDesktopWindow(), 0, DCX_CACHE_W | DCX_WINDOW_W ); 1080 1081 return GetDCEx (hwnd, NULL, 0); 1238 1082 } 1239 1083 //****************************************************************************** … … 1241 1085 HDC WIN32API GetWindowDC (HWND hwnd) 1242 1086 { 1243 if (!hwnd) hwnd = GetDesktopWindow();1244 return GetDCEx (hwnd, NULL, DCX_WINDOW_W);1087 if (!hwnd) hwnd = GetDesktopWindow(); 1088 return GetDCEx (hwnd, NULL, DCX_WINDOW_W); 1245 1089 } 1246 1090 //****************************************************************************** … … 1249 1093 LRESULT WIN32API RedrawChildEnumProc(HWND hwnd, LPARAM lParam) 1250 1094 { 1251 RedrawWindow(hwnd, NULL, 0, lParam);1252 return TRUE;1095 RedrawWindow(hwnd, NULL, 0, lParam); 1096 return TRUE; 1253 1097 } 1254 1098 //****************************************************************************** … … 1265 1109 // 1266 1110 //TODO: Works ok for RDW_FRAME?? 1111 // SDK docs say RDW_FRAME is only valid for RDW_INVALIDATE... 1267 1112 //****************************************************************************** 1268 1113 BOOL WIN32API RedrawWindow(HWND hwnd, const RECT* pRect, HRGN hrgn, DWORD redraw) 1269 1114 { 1270 Win32BaseWindow *wnd;1271 1272 if(pRect) {1273 1274 }1275 elsedprintf(("RedrawWindow %x %x %x %x", hwnd, pRect, hrgn, redraw));1276 1277 if (hwnd == NULLHANDLE)1278 {1115 Win32BaseWindow *wnd; 1116 1117 if(pRect) { 1118 dprintf(("RedrawWindow %x (%d,%d)(%d,%d) %x %x", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, hrgn, redraw)); 1119 } 1120 else dprintf(("RedrawWindow %x %x %x %x", hwnd, pRect, hrgn, redraw)); 1121 1122 if (hwnd == NULLHANDLE) 1123 { 1279 1124 #if 1 1280 1125 // Don't do this for now (causes lots of desktop repaints in WordPad) 1281 1282 1126 SetLastError(ERROR_INVALID_PARAMETER_W); 1127 return FALSE; 1283 1128 #else 1284 1129 hwnd = HWND_DESKTOP; … … 1293 1138 } 1294 1139 #endif 1295 }1296 else1297 {1140 } 1141 else 1142 { 1298 1143 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1299 1144 … … 1305 1150 return FALSE; 1306 1151 } 1307 hwnd = wnd->getOS2WindowHandle(); 1308 } 1309 1310 BOOL IncludeChildren = (redraw & RDW_ALLCHILDREN_W) ? TRUE : FALSE; 1311 BOOL success = TRUE; 1312 HPS hpsTemp = NULLHANDLE; 1313 HRGN hrgnTemp = NULLHANDLE; 1314 RECTL rectl; 1315 1316 if (hrgn) 1317 { 1318 ULONG BytesNeeded; 1319 PRGNDATA RgnData; 1320 PRECTL pr; 1321 int i; 1322 LONG height; 1323 1324 if(wnd) { 1325 height = (redraw & RDW_FRAME_W) ? wnd->getWindowHeight() : wnd->getClientHeight(); 1326 } 1327 else height = OSLibQueryScreenHeight(); 1328 1329 if (!hrgn) 1330 goto error; 1331 1332 BytesNeeded = GetRegionData (hrgn, 0, NULL); 1333 RgnData = (PRGNDATA)_alloca (BytesNeeded); 1334 if (RgnData == NULL) 1152 if(redraw & RDW_FRAME_W) { 1153 hwnd = wnd->getOS2FrameWindowHandle(); 1154 } 1155 else hwnd = wnd->getOS2WindowHandle(); 1156 } 1157 1158 BOOL IncludeChildren = (redraw & RDW_ALLCHILDREN_W) ? TRUE : FALSE; 1159 BOOL success = TRUE; 1160 HPS hpsTemp = NULLHANDLE; 1161 HRGN hrgnTemp = NULLHANDLE; 1162 RECTL rectl; 1163 1164 if (hrgn) 1165 { 1166 ULONG BytesNeeded; 1167 PRGNDATA RgnData; 1168 PRECTL pr; 1169 int i; 1170 LONG height; 1171 1172 if(wnd) { 1173 height = (redraw & RDW_FRAME_W) ? wnd->getWindowHeight() : wnd->getClientHeight(); 1174 } 1175 else height = OSLibQueryScreenHeight(); 1176 1177 if (!hrgn) 1178 goto error; 1179 1180 BytesNeeded = GetRegionData (hrgn, 0, NULL); 1181 RgnData = (PRGNDATA)_alloca (BytesNeeded); 1182 if (RgnData == NULL) 1335 1183 goto error; 1336 GetRegionData (hrgn, BytesNeeded, RgnData);1337 1338 pr = (PRECTL)(RgnData->Buffer);1339 for (i = RgnData->rdh.nCount; i > 0; i--, pr++) {1340 LONG temp = pr->yTop;1341 pr->yTop = height - pr->yBottom;1342 pr->yBottom = height - temp;1343 dprintf2(("RedrawWindow: region (%d,%d) (%d,%d)", pr->xLeft, pr->yBottom, pr->xRight, pr->yTop));1344 }1345 1346 hpsTemp = WinGetScreenPS (HWND_DESKTOP);1347 hrgnTemp = GpiCreateRegion (hpsTemp, RgnData->rdh.nCount, (PRECTL)(RgnData->Buffer));1348 if (!hrgnTemp) goto error;1349 }1350 else if (pRect)1351 {1352 if(wnd) {1353 1354 1355 1356 else mapWin32ToOS2RectClientToFrame(wnd, (PRECT)pRect, (PRECTLOS2)&rectl);1357 }1358 elsemapWin32ToOS2Rect(OSLibQueryScreenHeight(), (PRECT)pRect, (PRECTLOS2)&rectl);1359 }1360 1361 if (redraw & RDW_INVALIDATE_W)1362 {1184 GetRegionData (hrgn, BytesNeeded, RgnData); 1185 1186 pr = (PRECTL)(RgnData->Buffer); 1187 for (i = RgnData->rdh.nCount; i > 0; i--, pr++) { 1188 LONG temp = pr->yTop; 1189 pr->yTop = height - pr->yBottom; 1190 pr->yBottom = height - temp; 1191 dprintf2(("RedrawWindow: region (%d,%d) (%d,%d)", pr->xLeft, pr->yBottom, pr->xRight, pr->yTop)); 1192 } 1193 1194 hpsTemp = WinGetScreenPS (HWND_DESKTOP); 1195 hrgnTemp = GpiCreateRegion (hpsTemp, RgnData->rdh.nCount, (PRECTL)(RgnData->Buffer)); 1196 if (!hrgnTemp) goto error; 1197 } 1198 else if (pRect) 1199 { 1200 if(wnd) { 1201 if(redraw & RDW_FRAME_W) { 1202 mapWin32ToOS2Rect(wnd->getWindowHeight(), (PRECT)pRect, (PRECTLOS2)&rectl); 1203 } 1204 else mapWin32ToOS2Rect(wnd->getClientHeight(), (PRECT)pRect, (PRECTLOS2)&rectl); 1205 } 1206 else mapWin32ToOS2Rect(OSLibQueryScreenHeight(), (PRECT)pRect, (PRECTLOS2)&rectl); 1207 } 1208 1209 if (redraw & RDW_INVALIDATE_W) 1210 { 1363 1211 //TODO: SvL: pingpong.exe doesn't have RDW_NOERASE, but doesn't want WM_ERASEBKGND msgs 1364 1212 if (redraw & RDW_ERASE_W) { 1365 1213 wnd->setEraseBkgnd(TRUE); 1366 1214 } 1367 else 1368 if (redraw & RDW_NOERASE_W) 1369 wnd->setEraseBkgnd(FALSE); 1215 else wnd->setEraseBkgnd(FALSE); 1370 1216 1371 1217 if (!pRect && !hrgn) … … 1403 1249 1404 1250 if (!success) goto error; 1405 }1406 else if (redraw & RDW_VALIDATE_W)1407 {1251 } 1252 else if (redraw & RDW_VALIDATE_W) 1253 { 1408 1254 if (redraw & RDW_NOERASE_W) 1409 1255 wnd->setEraseBkgnd(FALSE); … … 1423 1269 if(!success) goto error; 1424 1270 } 1425 }1426 1427 if(WinQueryUpdateRect(hwnd, NULL))1428 {1271 } 1272 1273 if(WinQueryUpdateRect(hwnd, &rectl)) 1274 { 1429 1275 //TODO: Does this work if RDW_ALLCHILDREN is set?? 1430 1276 if(redraw & RDW_UPDATENOW_W) { 1431 wnd->MsgNCPaint(); 1432 wnd->MsgPaint(0, FALSE); 1277 RECT rectUpdate; 1278 1279 if(redraw & RDW_FRAME_W) { 1280 mapOS2ToWin32Rect(wnd->getWindowHeight(), (PRECTLOS2)&rectl, &rectUpdate); 1281 wnd->MsgNCPaint(&rectUpdate); 1282 } 1283 1284 wnd->MsgPaint(0, FALSE); 1433 1285 } 1434 1286 else 1435 1287 // if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W)) 1436 1288 if(redraw & RDW_ERASENOW_W && wnd->needsEraseBkgnd()) 1437 1289 wnd->setEraseBkgnd(sendEraseBkgnd(wnd) == 0); 1438 1290 // if(redraw & RDW_ALLCHILDREN_W) { 1439 1291 // EnumChildWindows(wnd->getWindowHandle(), RedrawChildEnumProc, redraw); 1440 1292 // } 1441 }1442 else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W))1443 {1293 } 1294 else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W)) 1295 { 1444 1296 if(redraw & RDW_UPDATENOW_W) { 1445 wnd->MsgNCPaint(); 1446 wnd->MsgPaint (0, FALSE); 1447 } 1448 else PostMessageA(hwnd, WINWM_PAINT, 0, 0); 1449 } 1297 wnd->MsgPaint(0, FALSE); 1298 } 1299 else PostMessageA(hwnd, WINWM_PAINT, 0, 0); 1300 } 1450 1301 1451 1302 error: 1452 /* clean up */1453 if (hrgnTemp)1454 GpiDestroyRegion (hpsTemp, hrgnTemp);1455 1456 if (hpsTemp)1457 WinReleasePS (hpsTemp);1458 1459 if (!success) {1303 /* clean up */ 1304 if (hrgnTemp) 1305 GpiDestroyRegion (hpsTemp, hrgnTemp); 1306 1307 if (hpsTemp) 1308 WinReleasePS (hpsTemp); 1309 1310 if (!success) { 1460 1311 dprintf(("RedrawWindow failure!")); 1461 1312 SetLastError(ERROR_INVALID_PARAMETER_W); 1462 }1463 return (success);1313 } 1314 return (success); 1464 1315 } 1465 1316 //****************************************************************************** … … 1468 1319 { 1469 1320 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1470 1471 if(!wnd) { 1321 RECTL rectl; 1322 BOOL rc; 1323 1324 if(!wnd) { 1325 dprintf (("ERROR: User32: UpdateWindow INVALID hwnd %x", hwnd)); 1472 1326 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 1473 1327 return FALSE; 1474 } 1475 1476 dprintf (("User32: UpdateWindow hwnd %x", hwnd)); 1477 //SvL: This doesn't work right (Wine uses RDW_NOCHILDREN_W -> doesn't work here) 1478 // Breaks vpbuddy 1479 // return RedrawWindow(hwnd, NULL, 0, RDW_UPDATENOW_W | RDW_ALLCHILDREN_W); 1480 // -> RDW_UPDATENOW causes WM_PAINT messages to be directy posted to window 1481 // handler; possibly bypassing queued WM_PAINT messages for parent window(s) 1482 // -> out of sync painting (i.e. parent paints over child) 1483 WinUpdateWindow(wnd->getOS2WindowHandle()); 1484 return TRUE; 1328 } 1329 1330 #ifdef DEBUG 1331 if(WinQueryUpdateRect(wnd->getOS2WindowHandle(), &rectl)) 1332 { 1333 RECT rectUpdate; 1334 mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectl, &rectUpdate); 1335 1336 dprintf (("User32: UpdateWindow hwnd %x: update rectangle (%d,%d)(%d,%d)", hwnd, rectUpdate.left, rectUpdate.top, rectUpdate.right, rectUpdate.bottom)); 1337 } 1338 else dprintf (("User32: UpdateWindow hwnd %x; EMPTY update rectangle (vis=%d/%d)", hwnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()))); 1339 #endif 1340 //SvL: This doesn't work right (Wine uses RDW_NOCHILDREN_W -> doesn't work here) 1341 // Breaks vpbuddy 1342 //rc = RedrawWindow(hwnd, NULL, 0, RDW_UPDATENOW_W | RDW_ALLCHILDREN_W); 1343 // -> RDW_UPDATENOW causes WM_PAINT messages to be directy posted to window 1344 // handler; possibly bypassing queued WM_PAINT messages for parent window(s) 1345 // -> out of sync painting (i.e. parent paints over child) 1346 1347 // if(!WinIsWindowShowing(wnd->getOS2FrameWindowHandle()) || !WinIsWindowShowing(wnd->getOS2WindowHandle())) { 1348 // dprintf(("UpdateWindow: window not showing %d/%d", WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle()) )); 1349 // return FALSE; 1350 // } 1351 //Must use frame window here. If the frame window has a valid update region and we call 1352 //WinUpdateWindow for the client window, then no WM_PAINT messages will be sent. 1353 rc = WinUpdateWindow(wnd->getOS2FrameWindowHandle()); 1354 #ifdef DEBUG 1355 if(WinQueryUpdateRect(wnd->getOS2WindowHandle(), NULL)) 1356 { 1357 //if parent has valid update region then WinUpdateWindow will still fail.. 1358 //might be harmless and happen even in windows 1359 dprintf (("ERROR: User32: UpdateWindow didn't send WM_PAINT messages!!")); 1360 } 1361 #endif 1362 return rc; 1485 1363 } 1486 1364 //****************************************************************************** … … 1508 1386 BOOL result; 1509 1387 1510 if(pRect) {1388 if(pRect) { 1511 1389 dprintf(("InvalidateRect %x (%d,%d)(%d,%d) erase=%d", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, erase)); 1512 }1513 else dprintf(("InvalidateRect %x NULL erase=%d", hwnd, erase));1390 } 1391 else dprintf(("InvalidateRect %x NULL erase=%d", hwnd, erase)); 1514 1392 #if 1 1515 result = RedrawWindow (hwnd, pRect, NULLHANDLE, 1516 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W | 1393 result = RedrawWindow (hwnd, pRect, NULLHANDLE, 1394 RDW_INVALIDATE_W | 1395 (erase ? RDW_ERASE_W : 0) | 1396 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0)); 1397 #else 1398 result = RedrawWindow (hwnd, pRect, NULLHANDLE, 1399 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W | 1400 (erase ? RDW_ERASE_W : RDW_NOERASE_W) | 1401 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0)); 1402 #endif 1403 return (result); 1404 } 1405 //****************************************************************************** 1406 //****************************************************************************** 1407 BOOL WIN32API InvalidateRgn (HWND hwnd, HRGN hrgn, BOOL erase) 1408 { 1409 BOOL result; 1410 1411 dprintf(("InvalidateRgn %x %x erase=%d", hwnd, hrgn, erase)); 1412 #if 1 1413 result = RedrawWindow (hwnd, NULL, hrgn, 1414 RDW_INVALIDATE_W | 1517 1415 (erase ? RDW_ERASE_W : 0) | 1518 1416 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0)); 1519 1417 #else 1520 result = RedrawWindow (hwnd, pRect, NULLHANDLE,1418 result = RedrawWindow (hwnd, NULL, hrgn, 1521 1419 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W | 1522 1420 (erase ? RDW_ERASE_W : RDW_NOERASE_W) | 1523 1421 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0)); 1524 1422 #endif 1525 return (result); 1526 } 1527 //****************************************************************************** 1528 //****************************************************************************** 1529 BOOL WIN32API InvalidateRgn (HWND hwnd, HRGN hrgn, BOOL erase) 1530 { 1531 BOOL result; 1532 1533 dprintf(("InvalidateRgn %x %x erase=%d", hwnd, hrgn, erase)); 1534 #if 1 1535 result = RedrawWindow (hwnd, NULL, hrgn, 1536 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W | 1537 (erase ? RDW_ERASE_W : 0) | 1538 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0)); 1539 #else 1540 result = RedrawWindow (hwnd, NULL, hrgn, 1541 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W | 1542 (erase ? RDW_ERASE_W : RDW_NOERASE_W) | 1543 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0)); 1544 #endif 1545 return (result); 1423 return (result); 1546 1424 } 1547 1425 //****************************************************************************** … … 1625 1503 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1626 1504 1627 if 1505 if((hwnd == NULLHANDLE) || !wnd) 1628 1506 { 1629 1507 return (FALSE); … … 1702 1580 RECTL rectlUpdate; 1703 1581 HRGN hrgn; 1704 RECTL clientRect;1705 1582 RECTL clipOS2; 1706 1583 RECTL scrollOS2; … … 1708 1585 PRECTL pClipOS2 = NULL; 1709 1586 1710 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&clientRect);1711 1712 1587 if(pScroll) { 1713 mapWin32ToOS2Rect ClientToFrame(wnd, &scrollRect, (PRECTLOS2)&scrollOS2);1588 mapWin32ToOS2Rect(wnd->getClientHeight(), &scrollRect, (PRECTLOS2)&scrollOS2); 1714 1589 pScrollOS2 = &scrollOS2; 1715 1716 //Scroll rectangle relative to client area1717 WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);1718 }1719 else {1720 pScrollOS2 = &clientRect;1721 1590 } 1722 1591 1723 1592 if(pClip) { 1724 mapWin32ToOS2RectClientToFrame(wnd, &clipRect, (PRECTLOS2)&clipOS2); 1725 pClipOS2 = &clipOS2; 1726 1727 //Clip rectangle relative to client area 1728 WinIntersectRect((HAB) 0, pClipOS2, pClipOS2, &clientRect); 1729 } 1730 else { 1731 pClipOS2 = &clientRect; 1593 mapWin32ToOS2Rect(wnd->getClientHeight(), &clipRect, (PRECTLOS2)&clipOS2); 1594 pClipOS2 = &clipOS2; 1732 1595 } 1733 1596 … … 1741 1604 RECT winRectUpdate; 1742 1605 1743 mapOS2ToWin32Rect(wnd->get WindowHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);1606 mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate); 1744 1607 1745 1608 if (pRectUpdate) … … 1747 1610 1748 1611 if (hrgnUpdate) 1749 rc = setPMRgnIntoWinRgn(hrgn, hrgnUpdate, wnd->get WindowHeight());1612 rc = setPMRgnIntoWinRgn(hrgn, hrgnUpdate, wnd->getClientHeight()); 1750 1613 1751 1614 return (rc); 1752 1615 } 1753 1616 //****************************************************************************** 1754 // SvL:Using WinScrollWindow to scroll child windows is better (smoother).1617 //Using WinScrollWindow to scroll child windows is better (smoother). 1755 1618 //****************************************************************************** 1756 1619 INT WIN32API ScrollWindowEx(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip, … … 1759 1622 Win32BaseWindow *window; 1760 1623 APIRET rc; 1761 RECTL clientRect;1762 1624 RECTL scrollRect; 1763 1625 RECTL clipRect; … … 1781 1643 if (scrollFlag & SW_SCROLLCHILDREN_W) scrollFlagsOS2 |= SW_SCROLLCHILDREN; 1782 1644 1783 mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect);1784 1785 1645 if(pScroll) { 1786 mapWin32ToOS2Rect ClientToFrame(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);1646 mapWin32ToOS2Rect(window->getClientHeight(), (RECT *)pScroll, (PRECTLOS2)&scrollRect); 1787 1647 pScrollOS2 = &scrollRect; 1788 1789 //Scroll rectangle relative to client area1790 WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect);1791 }1792 else {1793 pScrollOS2 = &clientRect;1794 1648 } 1795 1649 1796 1650 if(pClip) { 1797 mapWin32ToOS2RectClientToFrame(window,(RECT *)pClip, (PRECTLOS2)&clipRect); 1798 pClipOS2 = &clipRect; 1799 1800 //Clip rectangle relative to client area 1801 WinIntersectRect ((HAB) 0, pClipOS2, pClipOS2, &clientRect); 1802 } 1803 else { 1804 pClipOS2 = &clientRect; 1651 mapWin32ToOS2Rect(window->getClientHeight(), (RECT *)pClip, (PRECTLOS2)&clipRect); 1652 pClipOS2 = &clipRect; 1805 1653 } 1806 1654 … … 1816 1664 } 1817 1665 1818 LONG lComplexity = WinScrollWindow (window->getOS2WindowHandle(), dx, dy, 1819 pScrollOS2, 1820 pClipOS2, 1821 hrgn, &rectlUpdate, scrollFlagsOS2); 1666 LONG lComplexity = WinScrollWindow(window->getOS2WindowHandle(), dx, dy, 1667 pScrollOS2, pClipOS2, 1668 hrgn, &rectlUpdate, scrollFlagsOS2); 1822 1669 if (lComplexity == RGN_ERROR) 1823 1670 { … … 1850 1697 } 1851 1698 rectChild = *child->getWindowRect(); 1852 if(!p RectUpdate|| IntersectRect(&rectChild, &rectChild, &rc))1699 if(!pScroll || IntersectRect(&rectChild, &rectChild, &rc)) 1853 1700 { 1854 1701 dprintf(("ScrollWindowEx: Scroll child window %x", hwndChild)); … … 1862 1709 RECT winRectUpdate; 1863 1710 1864 mapOS2ToWin32Rect(window->get WindowHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate);1711 mapOS2ToWin32Rect(window->getClientHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate); 1865 1712 1866 1713 if (pRectUpdate) … … 1868 1715 1869 1716 if (hrgnUpdate) 1870 rc = setPMRgnIntoWinRgn (hrgn, hrgnUpdate, window->getWindowHeight());1717 rc = setPMRgnIntoWinRgn(hrgn, hrgnUpdate, window->getClientHeight()); 1871 1718 1872 1719 #if 0 … … 1891 1738 switch (lComplexity) 1892 1739 { 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1740 case RGN_NULL: 1741 regionType = NULLREGION_W; 1742 break; 1743 case RGN_RECT: 1744 regionType = SIMPLEREGION_W; 1745 break; 1746 case RGN_COMPLEX: 1747 regionType = COMPLEXREGION_W; 1748 break; 1749 default: 1750 regionType = ERROR_W; 1751 break; 1905 1752 } 1906 1753 … … 1937 1784 //****************************************************************************** 1938 1785 //****************************************************************************** 1939 #ifdef DEBUG 1940 void dprintfOrigin(HDC hdc) 1941 { 1942 POINTL point; 1943 1944 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc); 1945 if(!pHps) 1946 { 1947 return; 1948 } 1949 1950 GreGetDCOrigin(pHps->hps, &point); 1951 dprintf(("HDC %x origin (%d,%d) org (%d,%d)", hdc, point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y)); 1952 } 1953 #endif 1954 //****************************************************************************** 1955 //****************************************************************************** 1786 -
trunk/src/user32/dc.h
r5164 r5685 1 /* $Id: dc.h,v 1.1 6 2001-02-18 14:18:38sandervl Exp $ */1 /* $Id: dc.h,v 1.17 2001-05-11 08:39:42 sandervl Exp $ */ 2 2 /* 3 3 * public dc functions … … 16 16 extern HDC sendEraseBkgnd (Win32BaseWindow *wnd); 17 17 extern void releaseOwnDC (HDC hps); 18 BOOL setPageXForm(Win32BaseWindow *wnd, struct _DCData * pHps); 18 19 19 20 void selectClientArea(Win32BaseWindow *wnd, HDC hdc); -
trunk/src/user32/dcrgn.cpp
r3725 r5685 1 /* $Id: dcrgn.cpp,v 1. 3 2000-06-17 11:56:14sandervl Exp $ */1 /* $Id: dcrgn.cpp,v 1.4 2001-05-11 08:39:42 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 BOOL WIN32API GetUpdateRect(HWND hwnd, LPRECT pRect, BOOL erase) 47 47 { 48 if (!hwnd)49 {50 51 52 53 }54 55 RECTL rectl, rectlClient;56 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);57 58 if (!wnd)59 {60 61 62 63 }64 65 dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase));66 67 BOOL updateRegionExists = WinQueryUpdateRect(wnd->getOS2WindowHandle(), pRect ? &rectl : NULL);68 if (!pRect) {69 return (updateRegionExists);70 }71 72 if(updateRegionExists)73 {48 if (!hwnd) 49 { 50 dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase)); 51 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 52 return FALSE; 53 } 54 55 RECTL rectl, rectlClient; 56 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 57 58 if (!wnd) 59 { 60 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 61 dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase)); 62 return FALSE; 63 } 64 65 dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase)); 66 67 BOOL updateRegionExists = WinQueryUpdateRect(wnd->getOS2WindowHandle(), pRect ? &rectl : NULL); 68 if (!pRect) { 69 return (updateRegionExists); 70 } 71 72 if(updateRegionExists) 73 { 74 74 //CB: for PM empty rect is valid 75 75 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) { 76 if(pRect) { 77 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 78 } 79 return FALSE; 80 } 81 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient); 82 WinIntersectRect(NULL, &rectl, &rectl, &rectlClient); 83 mapOS2ToWin32RectFrameToClient(wnd, (PRECTLOS2)&rectl, pRect); 76 if(pRect) { 77 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 78 } 79 return FALSE; 80 } 81 mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectl, pRect); 84 82 85 83 if(wnd->isOwnDC() && GetMapMode(wnd->getOwnDC()) != MM_TEXT_W) 86 84 { 87 85 DPtoLP(wnd->getOwnDC(), (LPPOINT)pRect, 2); 88 86 } 89 87 if (erase) 90 88 sendEraseBkgnd (wnd); 91 89 } 92 90 else 93 91 { 94 92 if(pRect) { 95 93 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 96 94 } 97 95 } … … 100 98 } 101 99 //****************************************************************************** 102 //******************************************************************************103 BOOL GetOS2UpdateRect(Win32BaseWindow *window, LPRECT pRect)104 {105 RECTL rectl;106 BOOL updateRegionExists = WinQueryUpdateRect(window->getOS2WindowHandle(),pRect ? &rectl:NULL);107 108 if (!pRect)109 return (updateRegionExists);110 111 if (updateRegionExists)112 {113 //CB: for PM empty rect is valid114 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE;115 mapOS2ToWin32Rect(window->getWindowHeight(), (PRECTLOS2)&rectl,pRect);116 }117 else118 pRect->left = pRect->top = pRect->right = pRect->bottom = 0;119 120 return updateRegionExists;121 }122 //******************************************************************************123 100 //TODO: Seems to return region in window coordinates instead of client coordinates 124 101 //****************************************************************************** 125 102 int WIN32API GetUpdateRgn(HWND hwnd, HRGN hrgn, BOOL erase) 126 103 { 127 LONG lComplexity; 128 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 129 130 hrgn = ObjWinToOS2Region(hrgn); 131 if(!wnd || !hrgn) 132 { 133 dprintf(("WARNING: GetUpdateRgn %x %x %d; invalid handle", hwnd, hrgn, erase)); 134 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 135 return ERROR_W; 136 } 137 lComplexity = WinQueryUpdateRegion(wnd->getOS2WindowHandle(), hrgn); 138 if(lComplexity == RGN_ERROR) { 139 dprintf(("WARNING: GetUpdateRgn %x %x %d; RGN_ERROR", hwnd, hrgn, erase)); 140 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 141 return ERROR_W; 142 } 143 144 if(lComplexity != RGN_NULL) 145 { 146 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle())) 147 { 148 dprintf(("WARNING: GetUpdateRgn %x %x %d; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn, erase)); 149 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 150 return ERROR_W; 151 } 152 104 LONG lComplexity; 105 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 106 107 hrgn = ObjWinToOS2Region(hrgn); 108 if(!wnd || !hrgn) 109 { 110 dprintf(("WARNING: GetUpdateRgn %x %x %d; invalid handle", hwnd, hrgn, erase)); 111 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 112 return ERROR_W; 113 } 114 lComplexity = WinQueryUpdateRegion(wnd->getOS2WindowHandle(), hrgn); 115 if(lComplexity == RGN_ERROR) { 116 dprintf(("WARNING: GetUpdateRgn %x %x %d; RGN_ERROR", hwnd, hrgn, erase)); 117 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 118 return ERROR_W; 119 } 120 121 if(lComplexity != RGN_NULL) 122 { 123 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle())) 124 { 125 dprintf(("WARNING: GetUpdateRgn %x %x %d; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn, erase)); 126 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 127 return ERROR_W; 128 } 153 129 if(erase) sendEraseBkgnd(wnd); 154 } 155 156 return lComplexity; 130 } 131 return lComplexity; 157 132 } 158 133 //****************************************************************************** … … 161 136 INT WIN32API ExcludeUpdateRgn(HDC hdc, HWND hwnd) 162 137 { 163 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);164 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);165 LONG lComplexity;166 167 if(!wnd || !pHps)168 {169 170 171 172 }173 dprintf(("USER32: ExcludeUpdateRgn %x %x", hdc, hwnd));174 175 lComplexity = WinExcludeUpdateRegion(pHps->hps, wnd->getOS2WindowHandle());176 if(lComplexity == RGN_ERROR) {177 178 }179 else SetLastError(ERROR_SUCCESS_W);180 return lComplexity; // windows and PM values are identical138 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 139 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc); 140 LONG lComplexity; 141 142 if(!wnd || !pHps) 143 { 144 dprintf(("WARNING: ExcludeUpdateRgn %x %x; invalid handle", hdc, hwnd)); 145 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 146 return ERROR_W; 147 } 148 dprintf(("USER32: ExcludeUpdateRgn %x %x", hdc, hwnd)); 149 150 lComplexity = WinExcludeUpdateRegion(pHps->hps, wnd->getOS2WindowHandle()); 151 if(lComplexity == RGN_ERROR) { 152 SetLastError(ERROR_INVALID_HANDLE_W); //todo: correct error 153 } 154 else SetLastError(ERROR_SUCCESS_W); 155 return lComplexity; // windows and PM values are identical 181 156 } 182 157 /***************************************************************************** … … 195 170 int WIN32API GetWindowRgn(HWND hwnd, HRGN hRgn) 196 171 { 197 Win32BaseWindow *window;198 HRGN hWindowRegion;172 Win32BaseWindow *window; 173 HRGN hWindowRegion; 199 174 200 175 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 234 209 BOOL bRedraw) 235 210 { 236 Win32BaseWindow *window;237 HRGN hWindowRegion;211 Win32BaseWindow *window; 212 HRGN hWindowRegion; 238 213 239 214 window = Win32BaseWindow::GetWindowFromHandle(hwnd); -
trunk/src/user32/oslibgdi.cpp
r3679 r5685 1 /* $Id: oslibgdi.cpp,v 1.1 3 2000-06-08 18:10:10sandervl Exp $ */1 /* $Id: oslibgdi.cpp,v 1.14 2001-05-11 08:39:42 sandervl Exp $ */ 2 2 /* 3 3 * Window GDI wrapper functions for OS/2 … … 120 120 return TRUE; 121 121 } 122 #ifndef CLIENTFRAME 122 123 //****************************************************************************** 123 124 //Win32 rectangle in client coordinates (relative to upper left corner of client window) … … 172 173 return TRUE; 173 174 } 175 #endif //CLIENTFRAME 174 176 //****************************************************************************** 175 177 //****************************************************************************** -
trunk/src/user32/oslibgdi.h
r4628 r5685 1 /* $Id: oslibgdi.h,v 1. 8 2000-11-19 11:52:39sandervl Exp $ */1 /* $Id: oslibgdi.h,v 1.9 2001-05-11 08:39:43 sandervl Exp $ */ 2 2 /* 3 3 * Window GDI wrapper functions for OS/2 … … 80 80 BOOL mapWin32ToOS2Rect(int height, PRECT rectWin32,PRECTLOS2 rectOS2); 81 81 82 #ifndef CLIENTFRAME 82 83 BOOL mapWin32ToOS2RectClientToFrame(Win32BaseWindow *window, PRECT rectWin32,PRECTLOS2 rectOS2); 83 84 BOOL mapOS2ToWin32RectFrameToClient(Win32BaseWindow *window, PRECTLOS2 rectOS2, PRECT rectWin32); 85 #endif 84 86 85 87 #define mapWin32ToOS2RectFrame(window, rectWin32, rectOS2) \ -
trunk/src/user32/oslibmsgtranslate.cpp
r5620 r5685 1 /* $Id: oslibmsgtranslate.cpp,v 1. 49 2001-04-28 13:35:52sandervl Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.50 2001-05-11 08:39:43 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 194 194 int i; 195 195 196 memset(winMsg, 0, sizeof(MSG)); 197 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(os2Msg->hwnd); 198 199 //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle 200 //Realplayer starts a timer with hwnd 0 & proc 0; check this here 201 if(win32wnd == 0 && (os2Msg->msg != WM_CREATE && os2Msg->msg != WM_QUIT && os2Msg->msg != WM_TIMER && os2Msg->msg != WIN32APP_POSTMSG)) 202 { 196 memset(winMsg, 0, sizeof(MSG)); 197 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(os2Msg->hwnd); 198 if(!win32wnd) { 199 win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(os2Msg->hwnd); 200 } 201 202 //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle 203 //Realplayer starts a timer with hwnd 0 & proc 0; check this here 204 if(win32wnd == 0 && (os2Msg->msg != WM_CREATE && os2Msg->msg != WM_QUIT && os2Msg->msg != WM_TIMER && os2Msg->msg != WIN32APP_POSTMSG)) 205 { 203 206 goto dummymessage; //not a win32 client window 204 }205 winMsg->time = os2Msg->time;206 //CB: PM bug or undocumented feature? ptl.x highword is set!207 winMsg->pt.x = os2Msg->ptl.x & 0xFFFF;208 winMsg->pt.y = mapScreenY(os2Msg->ptl.y);209 210 if(win32wnd) //==0 for WM_CREATE/WM_QUIT211 winMsg->hwnd = win32wnd->getWindowHandle();212 213 switch(os2Msg->msg)214 {207 } 208 winMsg->time = os2Msg->time; 209 //CB: PM bug or undocumented feature? ptl.x highword is set! 210 winMsg->pt.x = os2Msg->ptl.x & 0xFFFF; 211 winMsg->pt.y = mapScreenY(os2Msg->ptl.y); 212 213 if(win32wnd) //==0 for WM_CREATE/WM_QUIT 214 winMsg->hwnd = win32wnd->getWindowHandle(); 215 216 switch(os2Msg->msg) 217 { 215 218 case WIN32APP_POSTMSG: 216 219 { … … 273 276 LONG xDelta = pswp->cx - swpOld.cx; 274 277 275 dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));276 277 278 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) goto dummymessage; 278 279 … … 286 287 } 287 288 if(win32wnd->getParent()) { 288 OSLibMapSWPtoWINDOWPOS(pswp, &teb->o.odin.wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 289 win32wnd->getParent()->getClientRectPtr()->left, 290 win32wnd->getParent()->getClientRectPtr()->top, 289 OSLibMapSWPtoWINDOWPOS(pswp, &teb->o.odin.wp, &swpOld, win32wnd->getParent()->getClientHeight(), 291 290 win32wnd->getOS2WindowHandle()); 292 291 } 293 else OSLibMapSWPtoWINDOWPOS(pswp, &teb->o.odin.wp, &swpOld, OSLibQueryScreenHeight(), 0, 0,win32wnd->getOS2WindowHandle());292 else OSLibMapSWPtoWINDOWPOS(pswp, &teb->o.odin.wp, &swpOld, OSLibQueryScreenHeight(), win32wnd->getOS2WindowHandle()); 294 293 295 294 if (!win32wnd->CanReceiveSizeMsgs()) goto dummymessage; … … 320 319 hwndActivate = OS2ToWin32Handle(hwndActivate); 321 320 if(hwndActivate == 0) { 322 323 324 321 //another (non-win32) application's window 322 //set to desktop window handle 323 hwndActivate = windowDesktop->getWindowHandle(); 325 324 } 326 325 … … 361 360 //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen 362 361 //************************************************************************** 363 #ifndef ODIN_HITTEST364 case WM_HITTEST:365 winMsg->message = WINWM_NCHITTEST;366 winMsg->wParam = 0;367 winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);368 if(!IsWindowEnabled(win32wnd->getWindowHandle())) {369 if(win32wnd->getParent()) {370 winMsg->hwnd = win32wnd->getParent()->getWindowHandle();371 }372 else goto dummymessage; //don't send mouse messages to disabled windows373 }374 break;375 #endif376 377 362 case WM_BUTTON1DOWN: 378 363 case WM_BUTTON1UP: … … 387 372 //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window 388 373 389 #ifdef ODIN_HITTEST390 374 HWND hwnd; 391 375 392 376 DisableLogging(); 393 if(GetCapture() != winMsg->hwnd) 377 if(GetCapture() != winMsg->hwnd) 394 378 { 395 379 hwnd = WindowFromPoint(winMsg->pt); … … 404 388 } 405 389 } 406 #endif407 390 408 391 //if a window is disabled, it's parent receives the mouse messages … … 420 403 } 421 404 else { 422 #ifdef ODIN_HITTEST423 405 ClientPoint.x = winMsg->pt.x; 424 406 ClientPoint.y = winMsg->pt.y; 425 407 MapWindowPoints(0, win32wnd->getWindowHandle(), (LPPOINT)&ClientPoint, 1); 426 #else427 point.x = (*(POINTS *)&os2Msg->mp1).x;428 point.y = (*(POINTS *)&os2Msg->mp1).y;429 ClientPoint.x = mapOS2ToWin32X(win32wnd, point.x);430 ClientPoint.y = mapOS2ToWin32Y(win32wnd, point.y);431 #endif432 408 winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN); 433 409 winMsg->wParam = GetMouseKeyState(); 434 410 winMsg->lParam = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates 435 411 } 436 #ifdef ODIN_HITTEST437 412 EnableLogging(); 438 #endif439 413 if((fMsgRemoved == MSG_REMOVE) && ISMOUSE_CAPTURED()) 440 414 { … … 472 446 //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window 473 447 474 #ifdef ODIN_HITTEST475 448 HWND hwnd; 476 449 477 450 dprintf2(("WM_NCMOUSEMOVE (%d,%d)", winMsg->pt.x, winMsg->pt.y)); 478 451 DisableLogging(); 479 if(GetCapture() != winMsg->hwnd) 452 if(GetCapture() != winMsg->hwnd) 480 453 { 481 454 hwnd = WindowFromPoint(winMsg->pt); … … 490 463 } 491 464 } 492 #endif493 465 494 466 //if a window is disabled, it's parent receives the mouse messages … … 507 479 else 508 480 { 509 #ifdef ODIN_HITTEST510 481 ClientPoint.x = winMsg->pt.x; 511 482 ClientPoint.y = winMsg->pt.y; 512 483 MapWindowPoints(0, win32wnd->getWindowHandle(), (LPPOINT)&ClientPoint, 1); 513 #else514 point.x = (*(POINTS *)&os2Msg->mp1).x;515 point.y = (*(POINTS *)&os2Msg->mp1).y;516 ClientPoint.x = mapOS2ToWin32X(win32wnd, point.x);517 ClientPoint.y = mapOS2ToWin32Y(win32wnd, point.y);518 #endif519 484 520 485 winMsg->message = WINWM_MOUSEMOVE; … … 522 487 winMsg->lParam = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates 523 488 } 524 #ifdef ODIN_HITTEST525 489 EnableLogging(); 526 #endif527 490 if((fMsgRemoved == MSG_REMOVE) && ISMOUSE_CAPTURED()) 528 491 { … … 822 785 winMsg->lParam = 0; 823 786 return FALSE; 824 }825 return TRUE;787 } 788 return TRUE; 826 789 } 827 790 //****************************************************************************** -
trunk/src/user32/oslibwin.cpp
r5512 r5685 1 /* $Id: oslibwin.cpp,v 1.9 1 2001-04-15 17:05:29sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.92 2001-05-11 08:39:43 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 53 53 //****************************************************************************** 54 54 HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, 55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, 55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, 56 56 ULONG id, BOOL fTaskList,BOOL fShellPosition, 57 int classStyle )57 int classStyle, HWND *hwndFrame) 58 58 { 59 59 HWND hwndClient; 60 60 ULONG dwFrameStyle = 0; 61 61 62 if(pszName && *pszName == 0) {62 if(pszName && *pszName == 0) { 63 63 pszName = NULL; 64 }65 if(hwndParent == OSLIB_HWND_DESKTOP) {64 } 65 if(hwndParent == OSLIB_HWND_DESKTOP) { 66 66 hwndParent = HWND_DESKTOP; 67 }68 if(Owner == OSLIB_HWND_DESKTOP) {67 } 68 if(Owner == OSLIB_HWND_DESKTOP) { 69 69 Owner = HWND_DESKTOP; 70 } 71 72 if(classStyle & CS_SAVEBITS_W) dwWinStyle |= WS_SAVEBITS; 73 if(classStyle & CS_PARENTDC_W) dwWinStyle |= WS_PARENTCLIP; 74 75 dwWinStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP); 76 77 if(fTaskList) 78 { 79 dwFrameStyle |= FCF_NOMOVEWITHOWNER; 80 } 81 if (fShellPosition) dwFrameStyle |= FCF_SHELLPOSITION; 82 83 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0}; 84 FCData.flCreateFlags = dwFrameStyle; 85 86 dprintf(("WinCreateWindow %x %s %x task %d shell %d classstyle %x winstyle %x bottom %d", hwndParent, pszName, id, fTaskList, fShellPosition, classStyle, dwWinStyle, fHWND_BOTTOM)); 87 88 return WinCreateWindow (hwndParent, 89 (hwndParent == HWND_DESKTOP) ? WIN32_STDFRAMECLASS : WIN32_STDCLASS, 90 pszName, dwWinStyle, 0, 0, 0, 0, 91 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP, 92 id, NULL, NULL); 70 } 71 72 if(classStyle & CS_SAVEBITS_W) dwWinStyle |= WS_SAVEBITS; 73 if(classStyle & CS_PARENTDC_W) dwWinStyle |= WS_PARENTCLIP; 74 75 dwWinStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP); 76 77 if(fTaskList) 78 { 79 dwFrameStyle |= FCF_NOMOVEWITHOWNER; 80 } 81 if (fShellPosition) dwFrameStyle |= FCF_SHELLPOSITION; 82 83 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0}; 84 FCData.flCreateFlags = dwFrameStyle; 85 86 dprintf(("WinCreateWindow %x %s %x task %d shell %d classstyle %x winstyle %x bottom %d", hwndParent, pszName, id, fTaskList, fShellPosition, classStyle, dwWinStyle, fHWND_BOTTOM)); 87 88 //Must not use WS_CLIPCHILDREN style with frame window. Transparency won't work otherwise. 89 //Eg: dialog parent, groupbox; invalidate part of groupbox -> painting algorithm stops when it finds 90 // a window with WS_CLIPCHILDREN -> result: dialog window won't update groupbox background as groupbox only draws the border 91 *hwndFrame = WinCreateWindow(hwndParent, 92 WIN32_STDFRAMECLASS, 93 pszName, (dwWinStyle & ~WS_CLIPCHILDREN), 0, 0, 0, 0, 94 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP, 95 id, NULL, NULL); 96 hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS, 97 NULL, dwWinStyle | WS_VISIBLE, 0, 0, 0, 0, 98 *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL); 99 return hwndClient; 93 100 } 94 101 //****************************************************************************** … … 294 301 rc = WinSetActiveWindow(HWND_DESKTOP, hwnd); 295 302 if(rc == FALSE) { 296 303 dprintf(("WinSetActiveWindow %x failure: %x", hwnd, OSLibWinGetLastError())); 297 304 } 298 305 return rc; … … 394 401 //****************************************************************************** 395 402 //****************************************************************************** 396 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, 397 int parentHeight, int clientOrgX, int clientOrgY, 398 HWND hwnd) 403 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, 404 int parentHeight, HWND hwnd) 399 405 { 400 406 HWND hWindow = pswp->hwnd; 401 407 HWND hWndInsertAfter = pswp->hwndInsertBehind; 402 long x = pswp->x - clientOrgX;403 long y = pswp->y + clientOrgY;408 long x = pswp->x; 409 long y = pswp->y; 404 410 long cx = pswp->cx; 405 411 long cy = pswp->cy; … … 467 473 //****************************************************************************** 468 474 //****************************************************************************** 469 void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, 470 int parentHeight, int clientOrgX, int clientOrgY,HWND hFrame)475 void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, 476 int parentHeight, HWND hFrame) 471 477 { 472 478 BOOL fCvt = FALSE; … … 474 480 HWND hWnd = pwpos->hwnd; 475 481 HWND hWndInsertAfter = pwpos->hwndInsertAfter; 476 long x = pwpos->x + clientOrgX;477 long y = pwpos->y + clientOrgY;482 long x = pwpos->x; 483 long y = pwpos->y; 478 484 long cx = pwpos->cx; 479 485 long cy = pwpos->cy; … … 546 552 } 547 553 //****************************************************************************** 548 //Position in screen coordinates 554 //****************************************************************************** 555 void OSLibWinSetClientPos(HWND hwnd, int x, int y, int cx, int cy, int parentHeight) 556 { 557 SWP swp; 558 BOOL rc; 559 560 swp.hwnd = hwnd; 561 swp.hwndInsertBehind = 0; 562 swp.x = x; 563 swp.y = parentHeight - y - cy; 564 swp.cx = cx; 565 swp.cy = cy; 566 swp.fl = SWP_MOVE | SWP_SIZE; 567 568 dprintf(("OSLibWinSetClientPos (%d,%d) (%d,%d) -> (%d,%d) (%d,%d)", x, y, x+cx, y+cy, swp.x, swp.y, swp.x+swp.cx, swp.y+swp.cy)); 569 570 rc = WinSetMultWindowPos(GetThreadHAB(), &swp, 1); 571 if(rc == FALSE) { 572 dprintf(("OSLibWinSetClientPos: WinSetMultWindowPos %x failed %x", hwnd, WinGetLastError(GetThreadHAB()))); 573 } 574 } 575 //****************************************************************************** 549 576 //****************************************************************************** 550 577 BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient) … … 716 743 //****************************************************************************** 717 744 //****************************************************************************** 718 void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle, ULONG dwExStyle) 719 { 720 ULONG dwWinStyle = WinQueryWindowULong(hwnd, QWL_STYLE); 721 ULONG dwOldWinStyle = dwWinStyle; 722 723 if(dwStyle & WS_DISABLED_W) { 724 dwWinStyle |= WS_DISABLED; 725 } 726 else dwWinStyle &= ~WS_DISABLED; 727 728 if(dwStyle & WS_CLIPSIBLINGS_W) { 729 dwWinStyle |= WS_CLIPSIBLINGS; 730 } 731 else dwWinStyle &= ~WS_CLIPSIBLINGS; 732 733 if(dwStyle & WS_CLIPCHILDREN_W) { 734 dwWinStyle |= WS_CLIPCHILDREN; 735 } 736 else dwWinStyle &= ~WS_CLIPCHILDREN; 737 738 if(dwWinStyle != dwOldWinStyle) { 739 WinSetWindowULong(hwnd, QWL_STYLE, dwWinStyle); 740 } 745 void OSLibSetWindowStyle(HWND hwndFrame, HWND hwndClient, ULONG dwStyle, ULONG dwExStyle) 746 { 747 ULONG dwWinStyle; 748 ULONG dwOldWinStyle; 749 750 //client window: 751 dwWinStyle = WinQueryWindowULong(hwndClient, QWL_STYLE); 752 dwOldWinStyle = dwWinStyle; 753 754 if(dwStyle & WS_CLIPCHILDREN_W) { 755 dwWinStyle |= WS_CLIPCHILDREN; 756 } 757 else dwWinStyle &= ~WS_CLIPCHILDREN; 758 759 if(dwWinStyle != dwOldWinStyle) { 760 WinSetWindowULong(hwndClient, QWL_STYLE, dwWinStyle); 761 } 762 763 //Frame window 764 dwWinStyle = WinQueryWindowULong(hwndFrame, QWL_STYLE); 765 dwOldWinStyle = dwWinStyle; 766 if(dwStyle & WS_DISABLED_W) { 767 dwWinStyle |= WS_DISABLED; 768 } 769 else dwWinStyle &= ~WS_DISABLED; 770 771 if(dwStyle & WS_CLIPSIBLINGS_W) { 772 dwWinStyle |= WS_CLIPSIBLINGS; 773 } 774 else dwWinStyle &= ~WS_CLIPSIBLINGS; 775 776 if(dwWinStyle != dwOldWinStyle) { 777 WinSetWindowULong(hwndFrame, QWL_STYLE, dwWinStyle); 778 } 741 779 } 742 780 //****************************************************************************** … … 744 782 DWORD OSLibQueryWindowStyle(HWND hwnd) 745 783 { 746 return WinQueryWindowULong(hwnd, QWL_STYLE);784 return WinQueryWindowULong(hwnd, QWL_STYLE); 747 785 } 748 786 //****************************************************************************** … … 750 788 void OSLibWinSetVisibleRegionNotify(HWND hwnd, BOOL fNotify) 751 789 { 752 WinSetVisibleRegionNotify(hwnd, fNotify);790 WinSetVisibleRegionNotify(hwnd, fNotify); 753 791 } 754 792 //****************************************************************************** … … 756 794 HWND OSLibWinQueryCapture() 757 795 { 758 return WinQueryCapture(HWND_DESKTOP);796 return WinQueryCapture(HWND_DESKTOP); 759 797 } 760 798 //****************************************************************************** … … 762 800 BOOL OSLibWinSetCapture(HWND hwnd) 763 801 { 764 return WinSetCapture(HWND_DESKTOP, hwnd);802 return WinSetCapture(HWND_DESKTOP, hwnd); 765 803 } 766 804 //****************************************************************************** … … 768 806 BOOL OSLibWinRemoveFromTasklist(HANDLE hTaskList) 769 807 { 770 return (WinRemoveSwitchEntry(hTaskList)) ? FALSE : TRUE;808 return (WinRemoveSwitchEntry(hTaskList)) ? FALSE : TRUE; 771 809 } 772 810 //****************************************************************************** … … 774 812 HANDLE OSLibWinAddToTaskList(HWND hwndFrame, char *title, BOOL fVisible) 775 813 { 776 SWCNTRL swctrl;777 ULONG tid;778 779 swctrl.hwnd = hwndFrame;780 swctrl.hwndIcon = 0;781 swctrl.hprog = 0;782 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid);783 swctrl.idSession = 0;784 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE;785 swctrl.fbJump = SWL_JUMPABLE;786 swctrl.bProgType = PROG_PM;787 if(title) {788 789 790 }791 else {792 793 794 }795 return WinAddSwitchEntry(&swctrl);814 SWCNTRL swctrl; 815 ULONG tid; 816 817 swctrl.hwnd = hwndFrame; 818 swctrl.hwndIcon = 0; 819 swctrl.hprog = 0; 820 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid); 821 swctrl.idSession = 0; 822 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE; 823 swctrl.fbJump = SWL_JUMPABLE; 824 swctrl.bProgType = PROG_PM; 825 if(title) { 826 strncpy(swctrl.szSwtitle, title, MAXNAMEL+4); 827 swctrl.szSwtitle[MAXNAMEL+4-1] = 0; 828 } 829 else { 830 swctrl.szSwtitle[0] = 0; 831 swctrl.uchVisibility = SWL_INVISIBLE; 832 } 833 return WinAddSwitchEntry(&swctrl); 796 834 } 797 835 //****************************************************************************** … … 799 837 BOOL OSLibWinChangeTaskList(HANDLE hTaskList, HWND hwndFrame, char *title, BOOL fVisible) 800 838 { 801 SWCNTRL swctrl;802 ULONG tid;803 804 swctrl.hwnd = hwndFrame;805 swctrl.hwndIcon = 0;806 swctrl.hprog = 0;807 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid);808 swctrl.idSession = 0;809 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE;810 swctrl.fbJump = SWL_JUMPABLE;811 swctrl.bProgType = PROG_PM;812 if(title) {813 814 815 }816 else {817 818 819 }820 return (WinChangeSwitchEntry(hTaskList, &swctrl)) ? FALSE : TRUE;839 SWCNTRL swctrl; 840 ULONG tid; 841 842 swctrl.hwnd = hwndFrame; 843 swctrl.hwndIcon = 0; 844 swctrl.hprog = 0; 845 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid); 846 swctrl.idSession = 0; 847 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE; 848 swctrl.fbJump = SWL_JUMPABLE; 849 swctrl.bProgType = PROG_PM; 850 if(title) { 851 strncpy(swctrl.szSwtitle, title, MAXNAMEL+4); 852 swctrl.szSwtitle[MAXNAMEL+4-1] = 0; 853 } 854 else { 855 swctrl.szSwtitle[0] = 0; 856 swctrl.uchVisibility = SWL_INVISIBLE; 857 } 858 return (WinChangeSwitchEntry(hTaskList, &swctrl)) ? FALSE : TRUE; 821 859 } 822 860 //****************************************************************************** … … 824 862 BOOL OSLibWinLockWindowUpdate(HWND hwnd) 825 863 { 826 return WinLockWindowUpdate(HWND_DESKTOP, (HWND)hwnd);864 return WinLockWindowUpdate(HWND_DESKTOP, (HWND)hwnd); 827 865 } 828 866 //****************************************************************************** … … 830 868 ULONG OSLibGetScreenHeight() 831 869 { 832 return ScreenHeight;870 return ScreenHeight; 833 871 } 834 872 //****************************************************************************** … … 836 874 ULONG OSLibGetScreenWidth() 837 875 { 838 return ScreenWidth;876 return ScreenWidth; 839 877 } 840 878 //****************************************************************************** … … 845 883 { 846 884 SWP swp; 847 848 if(!WinGetMaxPosition(hwndOS2, &swp)) {849 850 851 }852 rect->left = swp.x;853 rect->right = swp.x + swp.cx;854 rect->top = ScreenHeight - (swp.y + swp.cy);855 rect->bottom = ScreenHeight - swp.y;856 return TRUE;885 886 if(!WinGetMaxPosition(hwndOS2, &swp)) { 887 dprintf(("WARNING: WinGetMaxPosition %x returned FALSE", hwndOS2)); 888 return FALSE; 889 } 890 rect->left = swp.x; 891 rect->right = swp.x + swp.cx; 892 rect->top = ScreenHeight - (swp.y + swp.cy); 893 rect->bottom = ScreenHeight - swp.y; 894 return TRUE; 857 895 } 858 896 //****************************************************************************** … … 860 898 BOOL OSLibWinShowPointer(BOOL fShow) 861 899 { 862 return WinShowPointer(HWND_DESKTOP, fShow);863 } 864 //****************************************************************************** 865 //****************************************************************************** 900 return WinShowPointer(HWND_DESKTOP, fShow); 901 } 902 //****************************************************************************** 903 //****************************************************************************** -
trunk/src/user32/oslibwin.h
r5512 r5685 1 /* $Id: oslibwin.h,v 1.5 3 2001-04-15 17:05:29sandervl Exp $ */1 /* $Id: oslibwin.h,v 1.54 2001-05-11 08:39:43 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 40 40 HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, 41 41 char *pszName, HWND Owner, ULONG fBottom, 42 ULONG id, BOOL fTaskList,BOOL fShellPosition, int classStyle); 42 ULONG id, BOOL fTaskList,BOOL fShellPosition, 43 int classStyle, HWND *hwndFrame); 43 44 44 45 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle); 45 void OSLibSetWindowStyle(HWND hwnd , ULONG dwStyle, ULONG dwExStyle);46 void OSLibSetWindowStyle(HWND hwndFrame, HWND hwndClient, ULONG dwStyle, ULONG dwExStyle); 46 47 DWORD OSLibQueryWindowStyle(HWND hwnd); 47 48 … … 250 251 BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp); 251 252 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, 252 int parentHeight, int clientOrgX, int clientOrgY, 253 HWND hwnd); 253 int parentHeight, HWND hwnd); 254 254 void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, 255 int parentHeight, int clientOrgX, int clientOrgY, HWND hFrame); 255 int parentHeight, HWND hFrame); 256 257 void OSLibWinSetClientPos(HWND hwnd, int x, int y, int cx, int cy, int parentHeight); 256 258 257 259 HWND OSLibWinBeginEnumWindows(HWND hwnd); -
trunk/src/user32/pmwindow.cpp
r5655 r5685 1 /* $Id: pmwindow.cpp,v 1.12 4 2001-05-04 17:02:51sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.125 2001-05-11 08:39:44 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 34 34 #include "oslibgdi.h" 35 35 #include "oslibmsg.h" 36 #define INCLUDED_BY_DC 36 37 #include "dc.h" 37 38 #include <thread.h> … … 59 60 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 60 61 MRESULT EXPENTRY Win32FrameWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 61 MRESULT ProcessPMMessage(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, Win32BaseWindow *win32wnd,62 MSG *pWinMsg, TEB *teb, BOOL isFrame);63 62 64 63 //****************************************************************************** … … 105 104 (PSZ)WIN32_STDCLASS, /* Window class name */ 106 105 (PFNWP)Win32WindowProc, /* Address of window procedure */ 107 #ifdef ODIN_HITTEST108 106 0, 109 #else110 CS_HITTEST,111 #endif112 107 NROF_WIN32WNDBYTES)) 113 108 { … … 129 124 (PSZ)WIN32_STDFRAMECLASS, /* Window class name */ 130 125 (PFNWP)Win32FrameWindowProc, /* Address of window procedure */ 131 #ifdef ODIN_HITTEST132 126 CS_FRAME, 133 #else134 CS_HITTEST | CS_FRAME,135 #endif136 127 FrameClassInfo.cbWindowData+NROF_WIN32WNDBYTES)) 137 128 { … … 166 157 MSG winMsg, *pWinMsg; 167 158 MRESULT rc = 0; 159 POSTMSG_PACKET *postmsg; 160 OSLIBPOINT point, ClientPoint; 168 161 169 162 //Restore our FS selector … … 175 168 176 169 if(!teb || (msg != WM_CREATE && win32wnd == NULL)) { 177 dprintf((" Invalid win32wnd pointer for window %x msg %x", hwnd, msg));170 dprintf(("OS2: Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 178 171 goto RunDefWndProc; 179 172 } … … 205 198 } 206 199 //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END 207 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, FALSE); 208 RestoreOS2TIB(); 209 return rc; 210 211 RunDefWndProc: 212 RestoreOS2TIB(); 213 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 214 } 215 //****************************************************************************** 216 //****************************************************************************** 217 MRESULT ProcessPMMessage(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, Win32BaseWindow *win32wnd, MSG *pWinMsg, TEB *teb, BOOL isFrame) 218 { 219 POSTMSG_PACKET *postmsg; 220 OSLIBPOINT point, ClientPoint; 221 MRESULT rc = 0; 222 223 if(msg == WIN32APP_POSTMSG) { 200 201 if(msg == WIN32APP_POSTMSG) { 224 202 //probably win32 app user message 225 203 if((ULONG)mp1 == WIN32MSG_MAGICA) { … … 230 208 return (MRESULT)win32wnd->DispatchMsgW(pWinMsg); 231 209 } 232 }233 else234 if(msg == WIN32APP_SETFOCUSMSG) {210 } 211 else 212 if(msg == WIN32APP_SETFOCUSMSG) { 235 213 //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing; 236 214 //must delay this function call … … 240 218 teb->o.odin.hwndFocus = 0; 241 219 WinFocusChange(HWND_DESKTOP, hwnd, mp2 ? FC_NOLOSEACTIVE : 0); 242 }243 244 switch( msg )245 {220 } 221 222 switch( msg ) 223 { 246 224 //OS/2 msgs 247 225 case WM_CREATE: … … 280 258 case WM_ENABLE: 281 259 dprintf(("OS2: WM_ENABLE %x", hwnd)); 282 win32wnd->MsgEnable(SHORT1FROMMP(mp1));283 260 break; 284 261 285 262 case WM_SHOW: 286 263 dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1)); 287 win32wnd->MsgShow((ULONG)mp1); 288 break; 289 290 case WM_ADJUSTWINDOWPOS: 291 { 292 PSWP pswp = (PSWP)mp1; 293 SWP swpOld; 294 WINDOWPOS wp,wpOld; 295 HWND hParent = NULLHANDLE, hwndAfter; 296 297 dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 298 299 if(pswp->fl & SWP_NOADJUST) { 300 //ignore weird messages (TODO: why are they sent?) 301 break; 302 } 303 //CB: show dialog in front of owner 304 if (win32wnd->IsModalDialogOwner()) 305 { 306 dprintf(("win32wnd->IsModalDialogOwner %x", win32wnd->getWindowHandle())); 307 pswp->fl |= SWP_ZORDER; 308 pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog(); 309 if (pswp->fl & SWP_ACTIVATE) 310 { 311 pswp->fl &= ~SWP_ACTIVATE; 312 WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE); 313 } 314 } 315 316 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 317 goto RunDefWndProc; 318 319 if(!win32wnd->CanReceiveSizeMsgs()) 320 break; 321 322 WinQueryWindowPos(hwnd, &swpOld); 323 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 324 if (win32wnd->isChild()) { 325 if(win32wnd->getParent()) { 326 hParent = win32wnd->getParent()->getOS2WindowHandle(); 327 } 328 else goto RunDefWndProc; 329 } 330 } 331 hwndAfter = pswp->hwndInsertBehind; 332 if(win32wnd->getParent()) { 333 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 334 win32wnd->getParent()->getClientRectPtr()->left, 335 win32wnd->getParent()->getClientRectPtr()->top, 336 hwnd); 337 } 338 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 339 340 wp.hwnd = win32wnd->getWindowHandle(); 341 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 342 { 343 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 344 if(wndAfter) { 345 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 346 } 347 else wp.hwndInsertAfter = HWND_TOP_W; 348 } 349 350 wpOld = wp; 351 win32wnd->MsgPosChanging((LPARAM)&wp); 352 353 if ((wp.hwndInsertAfter != wpOld.hwndInsertAfter) || 354 (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags)) 355 { 356 ULONG flags = pswp->fl; //make a backup copy; OSLibMapWINDOWPOStoSWP will modify it 357 358 dprintf(("OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct")); 359 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 360 361 if(win32wnd->getParent()) { 362 OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, win32wnd->getParent()->getWindowHeight(), 363 win32wnd->getParent()->getClientRectPtr()->left, 364 win32wnd->getParent()->getClientRectPtr()->top, 365 hwnd); 366 } 367 else OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 368 369 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 370 371 //OSLibMapWINDOWPOStoSWP can add flags, but we must not let it remove flags! 372 if(pswp->fl & SWP_SIZE) 373 flags |= SWP_SIZE; 374 375 if(pswp->fl & SWP_MOVE) 376 flags |= SWP_MOVE; 377 378 pswp->fl = flags; //restore flags 379 380 pswp->fl |= SWP_NOADJUST; 381 pswp->hwndInsertBehind = hwndAfter; 382 pswp->hwnd = hwnd; 383 384 return (MRESULT)0xf; 385 } 386 return (MRESULT)0; 387 } 388 389 case WM_WINDOWPOSCHANGED: 390 { 391 PSWP pswp = (PSWP)mp1,pswpOld = pswp+1; 392 SWP swpOld = *(pswp + 1); 393 WINDOWPOS wp; 394 HWND hParent = NULLHANDLE; 395 RECTL rect; 396 397 dprintf(("OS2: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 398 399 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 400 { 401 if(pswp->fl & SWP_ACTIVATE) 402 { 403 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 404 if(!(WinQueryWindowULong(hwnd, OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE)) 405 { 406 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 407 } 408 } 409 else 410 if(pswp->fl & SWP_DEACTIVATE) 411 { 412 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 413 if(WinQueryWindowULong(hwnd, OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE) 414 { 415 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd); 416 } 417 } 418 goto RunDefWndProc; 419 } 420 421 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) 422 { 423 if(win32wnd->isChild()) 424 { 425 if(win32wnd->getParent()) { 426 hParent = win32wnd->getParent()->getOS2WindowHandle(); 427 } 428 else goto PosChangedEnd; //parent has just been destroyed 429 } 430 } 431 432 433 if(win32wnd->getParent()) { 434 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 435 win32wnd->getParent()->getClientRectPtr()->left, 436 win32wnd->getParent()->getClientRectPtr()->top, 437 hwnd); 438 } 439 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 440 441 wp.hwnd = win32wnd->getWindowHandle(); 442 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 443 { 444 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 445 if(wndAfter) { 446 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 447 } 448 else wp.hwndInsertAfter = HWND_TOP_W; 449 } 450 451 #ifndef USE_CALCVALIDRECT 452 if((pswp->fl & (SWP_MOVE | SWP_SIZE))) 453 { 454 //CB: todo: use result for WM_CALCVALIDRECTS 455 //Get old client rectangle (for invalidation of frame window parts later on) 456 //Use new window height to calculate the client area 457 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&rect); 458 459 //Note: Also updates the new window rectangle 460 win32wnd->MsgFormatFrame(&wp); 461 462 if(win32wnd->isOwnDC()) { 463 dprintf(("Mark owndc of %x as dirty", win32wnd->getWindowHandle())); 464 win32wnd->invalidateOwnDC(); //mark DC as dirty. origin & visible region must be reinitialized 465 } 466 if(win32wnd->CanReceiveSizeMsgs()) 467 win32wnd->MsgPosChanged((LPARAM)&wp); 468 469 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy))) 470 { 471 //redraw the frame (to prevent unnecessary client updates) 472 BOOL redrawAll = FALSE; 473 474 if (win32wnd->getWindowClass()) 475 { 476 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 477 478 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx)) 479 redrawAll = TRUE; 480 else 481 if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy)) 482 redrawAll = TRUE; 483 } 484 else redrawAll = TRUE; 485 486 if(win32wnd->IsMixMaxStateChanging()) { 487 dprintf(("WM_CALCVALIDRECT: window changed min/max/restore state, invalidate entire window")); 488 redrawAll = TRUE; 489 } 490 491 if (redrawAll) 492 { 493 //CB: redraw all children for now 494 // -> problems with update region if we don't do it 495 // todo: rewrite whole handling 496 WinInvalidateRect(hwnd,NULL,TRUE); 497 } 498 else 499 { 500 HPS hps = WinGetPS(hwnd); 501 RECTL frame,client,arcl[4]; 502 503 WinQueryWindowRect(hwnd,&frame); 504 505 //top 506 arcl[0].xLeft = 0; 507 arcl[0].xRight = frame.xRight; 508 arcl[0].yBottom = rect.yTop; 509 arcl[0].yTop = frame.yTop; 510 //right 511 arcl[1].xLeft = rect.xRight; 512 arcl[1].xRight = frame.xRight; 513 arcl[1].yBottom = 0; 514 arcl[1].yTop = frame.yTop; 515 //left 516 arcl[2].xLeft = 0; 517 arcl[2].xRight = rect.xLeft; 518 arcl[2].yBottom = 0; 519 arcl[2].yTop = frame.yTop; 520 //bottom 521 arcl[3].xLeft = 0; 522 arcl[3].xRight = frame.xRight; 523 arcl[3].yBottom = 0; 524 arcl[3].yTop = rect.yBottom; 525 526 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl); 527 528 WinInvalidateRegion(hwnd,hrgn,FALSE); 529 GpiDestroyRegion(hps,hrgn); 530 WinReleasePS(hps); 531 } 532 } 533 } 534 else 535 { 536 #endif //USE_CALCVALIDRECT 537 if(win32wnd->CanReceiveSizeMsgs()) 538 win32wnd->MsgPosChanged((LPARAM)&wp); 539 #ifndef USE_CALCVALIDRECT 540 } 541 #endif 542 543 if(pswp->fl & SWP_ACTIVATE) 544 { 545 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 546 if(!(WinQueryWindowULong(hwnd, OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE)) 547 { 548 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 549 } 550 } 551 else 552 if(pswp->fl & SWP_DEACTIVATE) 553 { 554 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 555 if(WinQueryWindowULong(hwnd, OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE) 556 { 557 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd); 558 } 559 } 560 561 PosChangedEnd: 562 return (MRESULT)FALSE; 563 } 264 break; 564 265 565 266 case WM_ACTIVATE: … … 568 269 569 270 dprintf(("OS2: WM_ACTIVATE %x %x %x", hwnd, mp1, mp2)); 570 571 271 WinSetWindowULong(hwnd, OFFSET_WIN32FLAGS, SHORT1FROMMP(mp1) ? (flags | WINDOWFLAG_ACTIVE):(flags & ~WINDOWFLAG_ACTIVE)); 572 272 if(win32wnd->IsWindowCreated()) 573 273 { 574 274 win32wnd->MsgActivate((LOWORD(pWinMsg->wParam) == WA_ACTIVE_W) ? 1 : 0, HIWORD(pWinMsg->wParam), pWinMsg->lParam, (HWND)mp2); 575 576 //CB: show owner behind the dialog 577 if(win32wnd->IsModalDialog()) 578 { 579 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 580 581 if(topOwner) WinSetWindowPos(topOwner->getOS2WindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 582 } 583 } 584 return 0; 275 } 276 break; 585 277 } 586 278 587 279 case WM_SIZE: 588 280 { 589 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2))); 281 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp1))); 282 win32wnd->SetVisibleRegionChanged(TRUE); 590 283 goto RunDefWndProc; 591 284 } 592 285 593 case WM_CALCVALIDRECTS:594 #ifdef USE_CALCVALIDRECT595 {596 PRECTL oldRect = (PRECTL)mp1, newRect = oldRect+1;597 PSWP pswp = (PSWP)mp2;598 SWP swpOld;599 WINDOWPOS wp;600 RECTL newClientRect, oldClientRect;601 ULONG nccalcret;602 // UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP;603 UINT res = 0;604 605 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle()));606 607 //Get old position info608 WinQueryWindowPos(hwnd, &swpOld);609 610 if(win32wnd->getParent()) {611 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(),612 win32wnd->getParent()->getClientRectPtr()->left,613 win32wnd->getParent()->getClientRectPtr()->top,614 hwnd);615 }616 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd);617 618 wp.hwnd = win32wnd->getWindowHandle();619 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))620 {621 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);622 if(wndAfter) {623 wp.hwndInsertAfter = wndAfter->getWindowHandle();624 }625 else wp.hwndInsertAfter = HWND_TOP_W;626 }627 628 //Get old client rectangle629 mapWin32ToOS2Rect(oldRect->yTop - oldRect->yBottom, win32wnd->getClientRectPtr(), (PRECTLOS2)&oldClientRect);630 631 //Note: Also updates the new window rectangle632 nccalcret = win32wnd->MsgFormatFrame(&wp);633 634 //Get new client rectangle635 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&newClientRect);636 637 if(nccalcret == 0) {638 res = CVR_ALIGNTOP | CVR_ALIGNLEFT;639 }640 else {641 if(nccalcret & WVR_ALIGNTOP_W) {642 res |= CVR_ALIGNTOP;643 }644 else645 if(nccalcret & WVR_ALIGNBOTTOM_W) {646 res |= CVR_ALIGNBOTTOM;647 }648 649 if(nccalcret & WVR_ALIGNLEFT_W) {650 res |= CVR_ALIGNLEFT;651 }652 else653 if(nccalcret & WVR_ALIGNRIGHT_W) {654 res |= CVR_ALIGNRIGHT;655 }656 657 if(nccalcret & WVR_REDRAW_W) {//WVR_REDRAW_W = (WVR_HREDRAW | WVR_VREDRAW)658 res |= CVR_REDRAW;659 }660 else661 if(nccalcret & WVR_VALIDRECTS_W) {662 //TODO:663 //res = 0;664 }665 }666 if(win32wnd->IsMixMaxStateChanging()) {667 dprintf(("WM_CALCVALIDRECT: window changed min/max/restore state, invalidate entire window"));668 res |= CVR_REDRAW;669 }670 if(res == (CVR_ALIGNTOP|CVR_ALIGNLEFT)) {671 oldRect->xRight -= oldClientRect.xLeft;672 oldRect->yBottom += oldClientRect.yBottom;673 newRect->xRight -= newClientRect.xLeft;674 newRect->yBottom += newClientRect.yBottom;675 }676 677 #if 0678 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy)))679 {680 //redraw the frame (to prevent unnecessary client updates)681 BOOL redrawAll = FALSE;682 683 if (win32wnd->getWindowClass())684 {685 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W);686 687 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx))688 redrawAll = TRUE;689 else690 if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy))691 redrawAll = TRUE;692 }693 else redrawAll = TRUE;694 695 if (redrawAll)696 {697 //CB: redraw all children for now698 // -> problems with update region if we don't do it699 // todo: rewrite whole handling700 WinInvalidateRect(hwnd,NULL,TRUE);701 }702 else703 {704 HPS hps = WinGetPS(hwnd);705 RECTL frame,client,arcl[4];706 707 WinQueryWindowRect(hwnd,&frame);708 709 //top710 arcl[0].xLeft = 0;711 arcl[0].xRight = frame.xRight;712 arcl[0].yBottom = rect.yTop;713 arcl[0].yTop = frame.yTop;714 //right715 arcl[1].xLeft = rect.xRight;716 arcl[1].xRight = frame.xRight;717 arcl[1].yBottom = 0;718 arcl[1].yTop = frame.yTop;719 //left720 arcl[2].xLeft = 0;721 arcl[2].xRight = rect.xLeft;722 arcl[2].yBottom = 0;723 arcl[2].yTop = frame.yTop;724 //bottom725 arcl[3].xLeft = 0;726 arcl[3].xRight = frame.xRight;727 arcl[3].yBottom = 0;728 arcl[3].yTop = rect.yBottom;729 730 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl);731 732 WinInvalidateRegion(hwnd,hrgn,FALSE);733 GpiDestroyRegion(hps,hrgn);734 WinReleasePS(hps);735 }736 }737 738 }739 #endif740 741 return (MRESULT)res;742 }743 #else744 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle()));745 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP);746 #endif747 286 748 287 case WM_VRNENABLED: … … 750 289 if(!win32wnd->isComingToTop() && ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == WS_EX_TOPMOST_W)) 751 290 { 752 HWND hwndrelated; 753 Win32BaseWindow *topwindow; 754 755 win32wnd->setComingToTop(TRUE); 756 757 hwndrelated = WinQueryWindow(hwnd, QW_PREV); 758 dprintf(("WM_VRNENABLED hwndrelated = %x (hwnd=%x)", hwndrelated, hwnd)); 759 topwindow = Win32BaseWindow::GetWindowFromOS2Handle(hwndrelated); 760 if(topwindow == NULL || ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == 0)) { 761 //put window at the top of z order 762 WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 763 } 764 765 win32wnd->setComingToTop(FALSE); 766 break; 767 } 768 //Restore window origin of window with CS_OWNDC style 769 //(fixes paint offset problems in Opera windows) 770 if(win32wnd->isOwnDC()) { 771 dprintfOrigin(win32wnd->getOwnDC()); 772 selectClientArea(win32wnd, win32wnd->getOwnDC()); 291 HWND hwndrelated; 292 Win32BaseWindow *topwindow; 293 294 win32wnd->setComingToTop(TRUE); 295 296 hwndrelated = WinQueryWindow(hwnd, QW_PREV); 297 dprintf(("WM_VRNENABLED hwndrelated = %x (hwnd=%x)", hwndrelated, hwnd)); 298 topwindow = Win32BaseWindow::GetWindowFromOS2Handle(hwndrelated); 299 if(topwindow == NULL || ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == 0)) { 300 //put window at the top of z order 301 WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 302 } 303 304 win32wnd->setComingToTop(FALSE); 305 break; 773 306 } 774 307 goto RunDefWndProc; … … 776 309 case WM_VRNDISABLED: 777 310 dprintf(("OS2: WM_VRNDISABLED %x %x %x", win32wnd->getWindowHandle(), mp1, mp2)); 778 if(win32wnd->isOwnDC()) {779 dprintfOrigin(win32wnd->getOwnDC());780 }781 311 goto RunDefWndProc; 782 312 … … 808 338 } 809 339 810 #if 0811 //is sent to both windows gaining and loosing the focus812 case WM_FOCUSCHANGE:813 {814 HWND hwndFocus = (HWND)mp1;815 HWND hwndLoseFocus, hwndGainFocus;816 USHORT usSetFocus = SHORT1FROMMP(mp2);817 USHORT fsFocusChange = SHORT2FROMMP(mp2);818 819 rc = 0;820 dprintf(("OS2: WM_FOCUSCHANGE (start) %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange));821 if(usSetFocus) {822 hwndGainFocus = hwnd;823 hwndLoseFocus = hwndFocus;824 }825 else {826 hwndGainFocus = hwndFocus;827 hwndLoseFocus = hwnd;828 }829 830 if(usSetFocus)831 {832 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndLoseFocus);833 if(!(fsFocusChange & FC_NOSETACTIVE))834 {835 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent()))836 {837 if(winfocus)838 WinSendMsg(winfocus->GetTopParent()->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);839 else840 WinSendMsg(hwndLoseFocus, WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);841 }842 }843 //SvL: Check if window is still valid844 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);845 if(win32wnd == NULL)846 return (MRESULT)rc;847 848 if(!(fsFocusChange & FC_NOSETACTIVE))849 {850 Win32BaseWindow *topparent = win32wnd->GetTopParent();851 if(!winfocus || (winfocus->GetTopParent() != topparent))852 {853 if(!(fsFocusChange & FC_NOBRINGTOTOP))854 {855 if(topparent) {856 //put window at the top of z order857 WinSetWindowPos(topparent->getOS2WindowHandle(), HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);858 }859 }860 861 // PH 2000/09/01 Netscape 4.7862 // check if topparent is valid863 if (topparent)864 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);865 }866 }867 //SvL: Check if window is still valid868 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);869 if(win32wnd == NULL)870 return (MRESULT)rc;871 872 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection873 if(!(fsFocusChange & FC_NOSETSELECTION)) {874 WinSendMsg(hwndGainFocus, WM_SETSELECTION, (MPARAM)1, (MPARAM)0);875 }876 877 if(!(fsFocusChange & FC_NOSETFOCUS)) {878 WinSendMsg(hwndGainFocus, WM_SETFOCUS, (MPARAM)hwndLoseFocus, (MPARAM)1);879 }880 }881 else /* no usSetFocus */882 {883 if(!(fsFocusChange & FC_NOLOSEFOCUS)) {884 WinSendMsg(hwndLoseFocus, WM_SETFOCUS, (MPARAM)hwndGainFocus, (MPARAM)0);885 }886 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection887 if(!(fsFocusChange & FC_NOLOSESELECTION)) {888 WinSendMsg(hwndLoseFocus, WM_SETSELECTION, (MPARAM)0, (MPARAM)0);889 }890 //SvL: Check if window is still valid891 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);892 if(win32wnd == NULL) {893 return (MRESULT)rc;894 }895 896 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndGainFocus);897 if(!(fsFocusChange & FC_NOLOSEACTIVE))898 {899 Win32BaseWindow *topparent = win32wnd->GetTopParent();900 901 if(!winfocus || (winfocus->GetTopParent() != topparent))902 {903 // PH 2000/09/01 Netscape 4.7904 // check if topparent is valid905 if (topparent)906 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);907 }908 }909 //SvL: Check if window is still valid910 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);911 if(win32wnd == NULL)912 return (MRESULT)rc;913 914 if(!(fsFocusChange & FC_NOSETACTIVE))915 {916 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent()))917 {918 if(winfocus)919 {920 // PH 2000/09/01 Netscape 4.7921 // check if topparent is valid922 Win32BaseWindow *topparent = winfocus->GetTopParent();923 if (topparent)924 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);925 }926 else927 WinSendMsg(hwndGainFocus, WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);928 }929 }930 }931 932 933 #ifdef DEBUG934 SetWin32TIB();935 dprintf(("OS2: WM_FOCUSCHANGE (end) %x %x %x", win32wnd->getWindowHandle(), mp1, mp2));936 #endif937 return (MRESULT)rc;938 }939 #endif940 941 340 //************************************************************************** 942 341 //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen 943 342 //************************************************************************** 944 #ifndef ODIN_HITTEST945 case WM_HITTEST:946 {947 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {948 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);949 }950 if(win32wnd && win32wnd->IsWindowCreated())951 {952 MRESULT rc;953 954 rc = (MRESULT)win32wnd->MsgHitTest(pWinMsg);955 return rc;956 }957 return (MRESULT)HT_NORMAL;958 }959 #endif960 343 961 344 case WM_BUTTON1DOWN: … … 991 374 case WM_MOUSEMOVE: 992 375 { 993 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {994 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);995 }376 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 377 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 378 } 996 379 if(win32wnd) 997 380 win32wnd->MsgMouseMove(pWinMsg); … … 1068 451 rectl.yBottom != rectl.yTop)) 1069 452 { 1070 PRECT pClient = win32wnd->getClientRectPtr(); 1071 PRECT pWindow = win32wnd->getWindowRect(); 1072 1073 if(!(pClient->left == 0 && pClient->top == 0 && 1074 win32wnd->getClientHeight() == win32wnd->getWindowHeight() && 1075 win32wnd->getClientWidth() == win32wnd->getWindowWidth())) 1076 { 1077 win32wnd->MsgNCPaint(); 1078 } 1079 win32wnd->DispatchMsgA(pWinMsg); 453 win32wnd->DispatchMsgA(pWinMsg); 1080 454 } 1081 455 else goto RunDefWndProc; 1082 1083 //SvL: Not calling the default window procedure causes all sorts of1084 // strange problems (redraw & hanging app)1085 // -> check what WinBeginPaint does what we're forgetting in BeginPaint1086 // WinQueryUpdateRect(hwnd, &rectl);1087 // if(rectl.xLeft == 0 && rectl.yTop == 0 && rectl.xRight == 0 && rectl.yBottom == 0) {1088 // RestoreOS2TIB();1089 // return (MRESULT)FALSE;1090 // }1091 // dprintf(("Update rectangle (%d,%d)(%d,%d) not empty, msg %x", rectl.xLeft, rectl.yTop, rectl.xRight, rectl.yBottom, pWinMsg->message));1092 // goto RunDefWndProc;1093 456 break; 1094 457 } … … 1100 463 } 1101 464 1102 #if 0 1103 case WM_CONTEXTMENU: 1104 { 1105 win32wnd->DispatchMsgA(pWinMsg); 1106 1107 return (MRESULT)TRUE; 1108 } 1109 #endif 1110 1111 case WM_QUERYTRACKINFO: 1112 { 1113 PTRACKINFO trackInfo = (PTRACKINFO)mp2; 1114 1115 dprintf(("OS2: WM_QUERYTRACKINFO %x", win32wnd->getWindowHandle())); 1116 trackInfo->cxBorder = 4; 1117 trackInfo->cyBorder = 4; 1118 win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize); 1119 return (MRESULT)TRUE; 1120 } 1121 1122 case WM_QUERYBORDERSIZE: 1123 { 1124 PWPOINT size = (PWPOINT)mp1; 1125 1126 dprintf(("OS2: WM_QUERYBORDERSIZE %x", win32wnd->getWindowHandle())); 1127 1128 size->x = 0; 1129 size->y = 0; 1130 return (MRESULT)TRUE; 1131 } 465 case WM_CALCVALIDRECTS: 466 dprintf(("OS2: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 467 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 1132 468 1133 469 case WM_REALIZEPALETTE: … … 1163 499 default: 1164 500 dprintf2(("OS2: RunDefWndProc hwnd %x msg %x mp1 %x mp2 %x", hwnd, msg, mp1, mp2)); 1165 RestoreOS2TIB(); 1166 if(isFrame) { 1167 return pfnFrameWndProc(hwnd, msg, mp1, mp2); 1168 } 1169 else return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 1170 } 1171 return (MRESULT)rc; 501 goto RunDefWndProc; 502 } 503 return (MRESULT)rc; 1172 504 1173 505 RunDefWndProc: 1174 506 // dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 1175 RestoreOS2TIB(); 1176 if(isFrame) { 1177 return pfnFrameWndProc(hwnd, msg, mp1, mp2); 1178 } 1179 else return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 507 RestoreOS2TIB(); 508 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 1180 509 } /* End of Win32WindowProc */ 1181 510 //****************************************************************************** … … 1195 524 //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- BEGIN 1196 525 teb = GetThreadTEB(); 1197 win32wnd = Win32BaseWindow::GetWindowFromOS2 Handle(hwnd);526 win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd); 1198 527 1199 528 if(!teb || (msg != WM_CREATE && win32wnd == NULL)) { 1200 dprintf((" Invalid win32wnd pointer for window %x msg %x", hwnd, msg));529 dprintf(("PMFRAME: Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 1201 530 goto RunDefFrameWndProc; 1202 531 } … … 1233 562 case WM_CREATE: 1234 563 { 1235 RestoreOS2TIB(); 1236 pfnFrameWndProc(hwnd, msg, mp1, mp2); 1237 SetWin32TIB(); 1238 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1239 break; 1240 } 564 //WM_CREATE handled during client window creation 565 goto RunDefFrameWndProc; 566 } 567 568 case WM_PAINT: 569 { 570 RECTL rectl; 571 572 573 HPS hps = WinBeginPaint(hwnd, NULL, &rectl); 574 dprintf(("PMFRAME: WM_PAINT %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop)); 575 576 if(win32wnd->IsWindowCreated() && (rectl.xLeft != rectl.xRight && 577 rectl.yBottom != rectl.yTop)) 578 { 579 PRECT pClient = win32wnd->getClientRectPtr(); 580 PRECT pWindow = win32wnd->getWindowRect(); 581 582 if(!(pClient->left == 0 && pClient->top == 0 && 583 win32wnd->getClientHeight() == win32wnd->getWindowHeight() && 584 win32wnd->getClientWidth() == win32wnd->getWindowWidth())) 585 { 586 RECT rectUpdate; 587 588 mapOS2ToWin32Rect(win32wnd->getWindowHeight(), (PRECTLOS2)&rectl, &rectUpdate); 589 win32wnd->MsgNCPaint(&rectUpdate); 590 } 591 } 592 WinEndPaint(hps); 593 break; 594 } 595 596 case WM_ERASEBACKGROUND: 597 { 598 dprintf(("PMFRAME:WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle())); 599 return (MRESULT)FALSE; 600 } 601 602 //************************************************************************** 603 //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen 604 //************************************************************************** 605 606 case WM_BUTTON1DOWN: 607 case WM_BUTTON1UP: 608 case WM_BUTTON1DBLCLK: 609 case WM_BUTTON2DOWN: 610 case WM_BUTTON2UP: 611 case WM_BUTTON2DBLCLK: 612 case WM_BUTTON3DOWN: 613 case WM_BUTTON3UP: 614 case WM_BUTTON3DBLCLK: 615 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 616 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 617 } 618 if(win32wnd) 619 win32wnd->MsgButton(pWinMsg); 620 621 rc = (MRESULT)TRUE; 622 break; 623 624 case WM_BUTTON2MOTIONSTART: 625 case WM_BUTTON2MOTIONEND: 626 case WM_BUTTON2CLICK: 627 case WM_BUTTON1MOTIONSTART: 628 case WM_BUTTON1MOTIONEND: 629 case WM_BUTTON1CLICK: 630 case WM_BUTTON3MOTIONSTART: 631 case WM_BUTTON3MOTIONEND: 632 case WM_BUTTON3CLICK: 633 rc = (MRESULT)TRUE; 634 break; 635 636 case WM_MOUSEMOVE: 637 { 638 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 639 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 640 } 641 if(win32wnd) 642 win32wnd->MsgMouseMove(pWinMsg); 643 break; 644 } 645 646 case WM_ADJUSTWINDOWPOS: 647 { 648 PSWP pswp = (PSWP)mp1; 649 SWP swpOld; 650 WINDOWPOS wp,wpOld; 651 HWND hParent = NULLHANDLE, hwndAfter; 652 653 dprintf(("PMFRAME:WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 654 655 if(pswp->fl & SWP_NOADJUST) { 656 //ignore weird messages (TODO: why are they sent?) 657 break; 658 } 659 //CB: show dialog in front of owner 660 if (win32wnd->IsModalDialogOwner()) 661 { 662 dprintf(("win32wnd->IsModalDialogOwner %x", win32wnd->getWindowHandle())); 663 pswp->fl |= SWP_ZORDER; 664 pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog(); 665 if (pswp->fl & SWP_ACTIVATE) 666 { 667 pswp->fl &= ~SWP_ACTIVATE; 668 WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE); 669 } 670 } 671 672 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 673 goto RunDefWndProc; 674 675 if(!win32wnd->CanReceiveSizeMsgs()) 676 break; 677 678 WinQueryWindowPos(hwnd, &swpOld); 679 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 680 if (win32wnd->isChild()) { 681 if(win32wnd->getParent()) { 682 hParent = win32wnd->getParent()->getOS2WindowHandle(); 683 } 684 else goto RunDefWndProc; 685 } 686 } 687 hwndAfter = pswp->hwndInsertBehind; 688 if(win32wnd->getParent()) { 689 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getClientHeight(), hwnd); 690 } 691 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), hwnd); 692 693 wp.hwnd = win32wnd->getWindowHandle(); 694 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 695 { 696 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 697 if(wndAfter) { 698 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 699 } 700 else wp.hwndInsertAfter = HWND_TOP_W; 701 } 702 703 wpOld = wp; 704 win32wnd->MsgPosChanging((LPARAM)&wp); 705 706 if ((wp.hwndInsertAfter != wpOld.hwndInsertAfter) || 707 (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags)) 708 { 709 ULONG flags = pswp->fl; //make a backup copy; OSLibMapWINDOWPOStoSWP will modify it 710 711 dprintf(("PMFRAME:WM_ADJUSTWINDOWPOS, app changed windowpos struct")); 712 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 713 714 if(win32wnd->getParent()) { 715 OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, win32wnd->getParent()->getClientHeight(), 716 hwnd); 717 } 718 else OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, OSLibQueryScreenHeight(), hwnd); 719 720 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 721 722 //OSLibMapWINDOWPOStoSWP can add flags, but we must not let it remove flags! 723 if(pswp->fl & SWP_SIZE) 724 flags |= SWP_SIZE; 725 726 if(pswp->fl & SWP_MOVE) 727 flags |= SWP_MOVE; 728 729 pswp->fl = flags; //restore flags 730 731 pswp->fl |= SWP_NOADJUST; 732 pswp->hwndInsertBehind = hwndAfter; 733 pswp->hwnd = hwnd; 734 735 return (MRESULT)0xf; 736 } 737 return (MRESULT)0; 738 } 739 740 case WM_WINDOWPOSCHANGED: 741 { 742 PSWP pswp = (PSWP)mp1,pswpOld = pswp+1; 743 SWP swpOld = *(pswp + 1); 744 WINDOWPOS wp; 745 HWND hParent = NULLHANDLE; 746 RECTL rect; 747 748 dprintf(("PMFRAME:WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 749 750 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 751 { 752 if(pswp->fl & SWP_ACTIVATE) 753 { 754 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 755 if(!(WinQueryWindowULong(WinWindowFromID(hwnd,FID_CLIENT), OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE)) 756 { 757 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 758 } 759 } 760 else 761 if(pswp->fl & SWP_DEACTIVATE) 762 { 763 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 764 if(WinQueryWindowULong(WinWindowFromID(hwnd,FID_CLIENT), OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE) 765 { 766 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd); 767 } 768 } 769 goto RunDefWndProc; 770 } 771 772 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) 773 { 774 if(win32wnd->isChild()) 775 { 776 if(win32wnd->getParent()) { 777 hParent = win32wnd->getParent()->getOS2WindowHandle(); 778 } 779 else goto PosChangedEnd; //parent has just been destroyed 780 } 781 } 782 783 784 if(win32wnd->getParent()) { 785 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getClientHeight(), 786 hwnd); 787 } 788 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), hwnd); 789 790 wp.hwnd = win32wnd->getWindowHandle(); 791 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 792 { 793 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 794 if(wndAfter) { 795 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 796 } 797 else wp.hwndInsertAfter = HWND_TOP_W; 798 } 799 800 if(pswp->fl & SWP_SHOW) { 801 WinShowWindow(win32wnd->getOS2WindowHandle(), 1); 802 } 803 #ifndef USE_CALCVALIDRECT 804 if((pswp->fl & (SWP_MOVE | SWP_SIZE))) 805 { 806 //CB: todo: use result for WM_CALCVALIDRECTS 807 //Get old client rectangle (for invalidation of frame window parts later on) 808 //Use new window height to calculate the client area 809 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&rect); 810 811 //Note: Also updates the new window rectangle 812 win32wnd->MsgFormatFrame(&wp); 813 814 if(win32wnd->isOwnDC()) { 815 setPageXForm(win32wnd, (pDCData)GpiQueryDCData(win32wnd->getOwnDC())); 816 } 817 818 if(win32wnd->CanReceiveSizeMsgs()) 819 win32wnd->MsgPosChanged((LPARAM)&wp); 820 821 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy))) 822 { 823 //redraw the frame (to prevent unnecessary client updates) 824 BOOL redrawAll = FALSE; 825 826 dprintf2(("WM_WINDOWPOSCHANGED: redraw frame")); 827 if (win32wnd->getWindowClass()) 828 { 829 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 830 831 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx)) 832 redrawAll = TRUE; 833 else 834 if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy)) 835 redrawAll = TRUE; 836 } 837 else redrawAll = TRUE; 838 839 if(win32wnd->IsMixMaxStateChanging()) { 840 dprintf(("WM_CALCVALIDRECT: window changed min/max/restore state, invalidate entire window")); 841 redrawAll = TRUE; 842 } 843 844 if (redrawAll) 845 { 846 //CB: redraw all children for now 847 // -> problems with update region if we don't do it 848 // todo: rewrite whole handling 849 WinInvalidateRect(hwnd,NULL,TRUE); 850 } 851 else 852 { 853 HPS hps = WinGetPS(hwnd); 854 RECTL frame,client,arcl[4]; 855 856 WinQueryWindowRect(hwnd,&frame); 857 858 //top 859 arcl[0].xLeft = 0; 860 arcl[0].xRight = frame.xRight; 861 arcl[0].yBottom = rect.yTop; 862 arcl[0].yTop = frame.yTop; 863 //right 864 arcl[1].xLeft = rect.xRight; 865 arcl[1].xRight = frame.xRight; 866 arcl[1].yBottom = 0; 867 arcl[1].yTop = frame.yTop; 868 //left 869 arcl[2].xLeft = 0; 870 arcl[2].xRight = rect.xLeft; 871 arcl[2].yBottom = 0; 872 arcl[2].yTop = frame.yTop; 873 //bottom 874 arcl[3].xLeft = 0; 875 arcl[3].xRight = frame.xRight; 876 arcl[3].yBottom = 0; 877 arcl[3].yTop = rect.yBottom; 878 879 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl); 880 881 WinInvalidateRegion(hwnd,hrgn,FALSE); 882 GpiDestroyRegion(hps,hrgn); 883 WinReleasePS(hps); 884 } 885 } 886 } 887 else 888 { 889 #endif //USE_CALCVALIDRECT 890 if(win32wnd->CanReceiveSizeMsgs()) 891 win32wnd->MsgPosChanged((LPARAM)&wp); 892 #ifndef USE_CALCVALIDRECT 893 } 894 #endif 895 896 if(pswp->fl & SWP_ACTIVATE) 897 { 898 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 899 if(!(WinQueryWindowULong(WinWindowFromID(hwnd,FID_CLIENT), OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE)) 900 { 901 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 902 } 903 } 904 else 905 if(pswp->fl & SWP_DEACTIVATE) 906 { 907 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 908 if(WinQueryWindowULong(WinWindowFromID(hwnd,FID_CLIENT), OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE) 909 { 910 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd); 911 } 912 } 913 914 PosChangedEnd: 915 return (MRESULT)FALSE; 916 } 917 918 case WM_CALCVALIDRECTS: 919 #ifdef USE_CALCVALIDRECT 920 { 921 PRECTL oldRect = (PRECTL)mp1, newRect = oldRect+1; 922 PSWP pswp = (PSWP)mp2; 923 SWP swpOld; 924 WINDOWPOS wp; 925 RECTL newClientRect, oldClientRect; 926 ULONG nccalcret; 927 // UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP; 928 UINT res = 0; 929 930 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 931 932 //Get old position info 933 WinQueryWindowPos(hwnd, &swpOld); 934 935 if(win32wnd->getParent()) { 936 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getClientHeight(), 937 win32wnd->getParent()->getClientRectPtr()->left, 938 win32wnd->getParent()->getClientRectPtr()->top, 939 hwnd); 940 } 941 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 942 943 wp.hwnd = win32wnd->getWindowHandle(); 944 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 945 { 946 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 947 if(wndAfter) { 948 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 949 } 950 else wp.hwndInsertAfter = HWND_TOP_W; 951 } 952 953 //Get old client rectangle 954 mapWin32ToOS2Rect(oldRect->yTop - oldRect->yBottom, win32wnd->getClientRectPtr(), (PRECTLOS2)&oldClientRect); 955 956 //Note: Also updates the new window rectangle 957 nccalcret = win32wnd->MsgFormatFrame(&wp); 958 959 //Get new client rectangle 960 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&newClientRect); 961 962 if(nccalcret == 0) { 963 res = CVR_ALIGNTOP | CVR_ALIGNLEFT; 964 } 965 else { 966 if(nccalcret & WVR_ALIGNTOP_W) { 967 res |= CVR_ALIGNTOP; 968 } 969 else 970 if(nccalcret & WVR_ALIGNBOTTOM_W) { 971 res |= CVR_ALIGNBOTTOM; 972 } 973 974 if(nccalcret & WVR_ALIGNLEFT_W) { 975 res |= CVR_ALIGNLEFT; 976 } 977 else 978 if(nccalcret & WVR_ALIGNRIGHT_W) { 979 res |= CVR_ALIGNRIGHT; 980 } 981 982 if(nccalcret & WVR_REDRAW_W) {//WVR_REDRAW_W = (WVR_HREDRAW | WVR_VREDRAW) 983 res |= CVR_REDRAW; 984 } 985 else 986 if(nccalcret & WVR_VALIDRECTS_W) { 987 //TODO: 988 //res = 0; 989 } 990 } 991 if(win32wnd->IsMixMaxStateChanging()) { 992 dprintf(("WM_CALCVALIDRECT: window changed min/max/restore state, invalidate entire window")); 993 res |= CVR_REDRAW; 994 } 995 if(res == (CVR_ALIGNTOP|CVR_ALIGNLEFT)) { 996 oldRect->xRight -= oldClientRect.xLeft; 997 oldRect->yBottom += oldClientRect.yBottom; 998 newRect->xRight -= newClientRect.xLeft; 999 newRect->yBottom += newClientRect.yBottom; 1000 } 1001 return (MRESULT)res; 1002 } 1003 #else 1004 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 1005 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 1006 #endif 1241 1007 1242 1008 case WM_CALCFRAMERECT: 1243 dprintf((" OS2:WM_CALCFRAMERECT %x", win32wnd->getWindowHandle()));1009 dprintf(("PMFRAME:WM_CALCFRAMERECT %x", win32wnd->getWindowHandle())); 1244 1010 rc = (MRESULT)TRUE; 1245 1011 break; … … 1247 1013 case WM_QUERYCTLTYPE: 1248 1014 // This is a frame window 1249 dprintf((" OS2:WM_QUERYCTLTYPE %x", win32wnd->getWindowHandle()));1015 dprintf(("PMFRAME:WM_QUERYCTLTYPE %x", win32wnd->getWindowHandle())); 1250 1016 rc = (MRESULT)CCT_FRAME; 1251 1017 break; 1252 1018 1019 #ifdef DEBUG 1253 1020 case WM_QUERYFOCUSCHAIN: 1254 dprintf(("OS2: WM_QUERYFOCUSCHAIN %x fsCmd %x parent %x", win32wnd->getWindowHandle(), SHORT1FROMMP(mp1), mp2)); 1255 1256 RestoreOS2TIB(); 1257 rc = pfnFrameWndProc(hwnd, msg, mp1, mp2); 1258 SetWin32TIB(); 1259 dprintf(("OS2: WM_QUERYFOCUSCHAIN %x fsCmd %x parent %x returned %x", win32wnd->getWindowHandle(), SHORT1FROMMP(mp1), mp2, rc)); 1260 break; 1261 1021 dprintf(("PMFRAME:WM_QUERYFOCUSCHAIN %x fsCmd %x parent %x", win32wnd->getWindowHandle(), SHORT1FROMMP(mp1), mp2)); 1022 1023 // RestoreOS2TIB(); 1024 // rc = pfnFrameWndProc(hwnd, msg, mp1, mp2); 1025 // SetWin32TIB(); 1026 // dprintf(("PMFRAME:WM_QUERYFOCUSCHAIN %x fsCmd %x parent %x returned %x", win32wnd->getWindowHandle(), SHORT1FROMMP(mp1), mp2, rc)); 1027 // break; 1028 goto RunDefFrameWndProc; 1029 #endif 1030 1031 #if 0 1032 //is sent to both windows gaining and loosing the focus 1033 case WM_FOCUSCHANGE: 1034 { 1035 HWND hwndFocus = (HWND)mp1; 1036 HWND hwndLoseFocus, hwndGainFocus; 1037 USHORT usSetFocus = SHORT1FROMMP(mp2); 1038 USHORT fsFocusChange = SHORT2FROMMP(mp2); 1039 1040 rc = 0; 1041 dprintf(("PMFRAME:WM_FOCUSCHANGE (start) %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange)); 1042 if(usSetFocus) { 1043 hwndGainFocus = hwnd; 1044 hwndLoseFocus = hwndFocus; 1045 } 1046 else { 1047 hwndGainFocus = hwndFocus; 1048 hwndLoseFocus = hwnd; 1049 } 1050 1051 if(usSetFocus) 1052 { 1053 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndLoseFocus); 1054 if(!(fsFocusChange & FC_NOSETACTIVE)) 1055 { 1056 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent())) 1057 { 1058 if(winfocus) 1059 WinSendMsg(winfocus->GetTopParent()->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus); 1060 else 1061 WinSendMsg(hwndLoseFocus, WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus); 1062 } 1063 } 1064 //SvL: Check if window is still valid 1065 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 1066 if(win32wnd == NULL) 1067 return (MRESULT)rc; 1068 1069 if(!(fsFocusChange & FC_NOSETACTIVE)) 1070 { 1071 Win32BaseWindow *topparent = win32wnd->GetTopParent(); 1072 if(!winfocus || (winfocus->GetTopParent() != topparent)) 1073 { 1074 if(!(fsFocusChange & FC_NOBRINGTOTOP)) 1075 { 1076 if(topparent) { 1077 //put window at the top of z order 1078 WinSetWindowPos(topparent->getOS2WindowHandle(), HWND_TOP, 0, 0, 0, 0, SWP_ZORDER); 1079 } 1080 } 1081 1082 // PH 2000/09/01 Netscape 4.7 1083 // check if topparent is valid 1084 if (topparent) 1085 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus); 1086 } 1087 } 1088 //SvL: Check if window is still valid 1089 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 1090 if(win32wnd == NULL) 1091 return (MRESULT)rc; 1092 1093 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection 1094 if(!(fsFocusChange & FC_NOSETSELECTION)) { 1095 WinSendMsg(hwndGainFocus, WM_SETSELECTION, (MPARAM)1, (MPARAM)0); 1096 } 1097 1098 if(!(fsFocusChange & FC_NOSETFOCUS)) { 1099 WinSendMsg(hwndGainFocus, WM_SETFOCUS, (MPARAM)hwndLoseFocus, (MPARAM)1); 1100 } 1101 } 1102 else /* no usSetFocus */ 1103 { 1104 if(!(fsFocusChange & FC_NOLOSEFOCUS)) { 1105 WinSendMsg(hwndLoseFocus, WM_SETFOCUS, (MPARAM)hwndGainFocus, (MPARAM)0); 1106 } 1107 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection 1108 if(!(fsFocusChange & FC_NOLOSESELECTION)) { 1109 WinSendMsg(hwndLoseFocus, WM_SETSELECTION, (MPARAM)0, (MPARAM)0); 1110 } 1111 //SvL: Check if window is still valid 1112 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 1113 if(win32wnd == NULL) { 1114 return (MRESULT)rc; 1115 } 1116 1117 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndGainFocus); 1118 if(!(fsFocusChange & FC_NOLOSEACTIVE)) 1119 { 1120 Win32BaseWindow *topparent = win32wnd->GetTopParent(); 1121 1122 if(!winfocus || (winfocus->GetTopParent() != topparent)) 1123 { 1124 // PH 2000/09/01 Netscape 4.7 1125 // check if topparent is valid 1126 if (topparent) 1127 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus); 1128 } 1129 } 1130 //SvL: Check if window is still valid 1131 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 1132 if(win32wnd == NULL) 1133 return (MRESULT)rc; 1134 1135 if(!(fsFocusChange & FC_NOSETACTIVE)) 1136 { 1137 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent())) 1138 { 1139 if(winfocus) 1140 { 1141 // PH 2000/09/01 Netscape 4.7 1142 // check if topparent is valid 1143 Win32BaseWindow *topparent = winfocus->GetTopParent(); 1144 if (topparent) 1145 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus); 1146 } 1147 else 1148 WinSendMsg(hwndGainFocus, WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus); 1149 } 1150 } 1151 } 1152 1153 1154 #ifdef DEBUG 1155 dprintf(("PMFRAME:WM_FOCUSCHANGE (end) %x %x %x", win32wnd->getWindowHandle(), mp1, mp2)); 1156 #endif 1157 return (MRESULT)rc; 1158 } 1159 #endif 1160 1161 #ifdef DEBUG 1262 1162 case WM_FOCUSCHANGE: 1263 1163 { … … 1267 1167 USHORT fsFocusChange = SHORT2FROMMP(mp2); 1268 1168 1269 dprintf((" OS2:WM_FOCUSCHANGE %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange));1169 dprintf(("PMFRAME:WM_FOCUSCHANGE %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange)); 1270 1170 goto RunDefFrameWndProc; 1271 1171 } 1172 #endif 1272 1173 1273 1174 case WM_ACTIVATE: 1175 { 1176 HWND hwndTitle; 1177 USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS); 1178 1179 dprintf(("PMFRAME: WM_ACTIVATE %x %x %x", hwnd, mp1, mp2)); 1180 if (win32wnd->IsWindowCreated()) 1181 { 1182 WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),WM_ACTIVATE,mp1,mp2); 1183 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 1184 1185 //CB: show owner behind the dialog 1186 if (win32wnd->IsModalDialog()) 1187 { 1188 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 1189 1190 if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 1191 } 1192 } 1193 else 1194 { 1195 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 1196 } 1197 RestoreOS2TIB(); 1198 return 0; 1199 } 1200 1201 case WM_ENABLE: 1202 dprintf(("OS2: WM_ENABLE %x", hwnd)); 1203 win32wnd->MsgEnable(SHORT1FROMMP(mp1)); 1204 break; 1205 1206 case WM_SHOW: 1207 dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1)); 1208 //show client window 1209 WinShowWindow(win32wnd->getOS2WindowHandle(), (BOOL)mp1); 1210 win32wnd->MsgShow((ULONG)mp1); 1211 break; 1212 1274 1213 case WM_SETFOCUS: 1275 1214 { 1276 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE);1277 1215 goto RunDefFrameWndProc; 1278 1216 } 1279 1217 1280 #if 0 1281 //just a test 1282 case WM_ADJUSTWINDOWPOS: 1283 case WM_WINDOWPOSCHANGED: 1284 { 1285 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1218 case WM_QUERYTRACKINFO: 1219 { 1220 PTRACKINFO trackInfo = (PTRACKINFO)mp2; 1221 1222 dprintf(("PMFRAME:WM_QUERYTRACKINFO %x", win32wnd->getWindowHandle())); 1223 trackInfo->cxBorder = 4; 1224 trackInfo->cyBorder = 4; 1225 win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize); 1226 return (MRESULT)TRUE; 1227 } 1228 1229 case WM_QUERYBORDERSIZE: 1230 { 1231 PWPOINT size = (PWPOINT)mp1; 1232 1233 dprintf(("PMFRAME:WM_QUERYBORDERSIZE %x", win32wnd->getWindowHandle())); 1234 1235 size->x = 0; 1236 size->y = 0; 1237 return (MRESULT)TRUE; 1238 } 1239 1240 case WM_QUERYFRAMEINFO: 1241 dprintf(("PMFRAME:WM_QUERYFRAMEINFO %x", win32wnd->getWindowHandle())); 1286 1242 goto RunDefFrameWndProc; 1287 } 1288 #endif 1289 1290 case WM_QUERYFRAMEINFO: 1291 dprintf(("OS2: WM_QUERYFRAMEINFO %x", win32wnd->getWindowHandle())); 1243 1244 case WM_FORMATFRAME: 1245 dprintf(("PMFRAME:WM_FORMATFRAME %x", win32wnd->getWindowHandle())); 1246 break; 1247 1248 case WM_ADJUSTFRAMEPOS: 1249 { 1250 PSWP pswp = (PSWP)mp1; 1251 1252 dprintf(("PMFRAME:WM_ADJUSTFRAMEPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 1292 1253 goto RunDefFrameWndProc; 1293 1294 case WM_FORMATFRAME: 1295 dprintf(("OS2: WM_FORMATFRAME %x", win32wnd->getWindowHandle())); 1254 } 1255 1256 case WM_OWNERPOSCHANGE: 1257 { 1258 PSWP pswp = (PSWP)mp1; 1259 1260 dprintf(("PMFRAME:WM_OWNERPOSCHANGE %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 1296 1261 goto RunDefFrameWndProc; 1297 1298 case WM_ADJUSTFRAMEPOS:1299 {1300 PSWP pswp = (PSWP)mp1;1301 1302 dprintf(("OS2: WM_ADJUSTFRAMEPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));1303 goto RunDefFrameWndProc;1304 }1305 1306 case WM_OWNERPOSCHANGE:1307 {1308 PSWP pswp = (PSWP)mp1;1309 1310 dprintf(("OS2: WM_OWNERPOSCHANGE %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));1311 goto RunDefFrameWndProc;1312 1262 } 1313 1263 … … 1318 1268 if (!win32wnd->IsWindowCreated()) goto RunDefWndProc; 1319 1269 1320 dprintf((" OS2:WM_MINMAXFRAME %x",hwnd));1270 dprintf(("PMFRAME:WM_MINMAXFRAME %x",hwnd)); 1321 1271 if ((swp->fl & SWP_MAXIMIZE) == SWP_MAXIMIZE) 1322 1272 { … … 1346 1296 1347 1297 case WM_UPDATEFRAME: 1348 dprintf((" OS2:WM_UPDATEFRAME %x", win32wnd->getWindowHandle()));1298 dprintf(("PMFRAME:WM_UPDATEFRAME %x", win32wnd->getWindowHandle())); 1349 1299 goto RunDefFrameWndProc; 1350 1300 1351 1301 default: 1352 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1353 break; 1302 goto RunDefFrameWndProc; 1354 1303 } 1355 1304 RestoreOS2TIB(); … … 1362 1311 RunDefWndProc: 1363 1312 RestoreOS2TIB(); 1364 return Win 32WindowProc(hwnd, msg, mp1, mp2);1313 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 1365 1314 } 1366 1315 //****************************************************************************** … … 1373 1322 PRECT pWindowRect, pClientRect; 1374 1323 HWND hwndTracking; 1375 HPS hpsTrack;1376 1324 LONG parentHeight, parentWidth; 1377 LONG clientOrgX, clientOrgY;1378 1325 1379 1326 dprintf(("FrameTrackFrame: %x %x", win32wnd->getWindowHandle(), flags)); … … 1387 1334 pWindowRect = win32wnd->getWindowRect(); 1388 1335 if(win32wnd->getParent()) { 1389 parentHeight = win32wnd->getParent()->get WindowHeight();1390 parentWidth = win32wnd->getParent()->get WindowWidth();1336 parentHeight = win32wnd->getParent()->getClientHeight(); 1337 parentWidth = win32wnd->getParent()->getClientWidth(); 1391 1338 hwndTracking = win32wnd->getParent()->getOS2WindowHandle(); 1392 hpsTrack = WinGetPS(hwndTracking);1393 clientOrgX = win32wnd->getParent()->getClientRectPtr()->left;1394 clientOrgY = win32wnd->getParent()->getClientRectPtr()->top;1395 1339 } 1396 1340 else { … … 1398 1342 parentWidth = OSLibQueryScreenWidth(); 1399 1343 hwndTracking = HWND_DESKTOP; 1400 hpsTrack = NULL;1401 clientOrgX = 0;1402 clientOrgY = 0;1403 1344 } 1404 1345 1405 1346 mapWin32ToOS2Rect(parentHeight, pWindowRect, (PRECTLOS2)&track.rclTrack); 1406 track.rclTrack.xLeft += clientOrgX;1407 track.rclTrack.yTop -= clientOrgY;1408 1347 rcl = track.rclTrack; 1409 1348 WinQueryWindowRect(hwndTracking, &track.rclBoundary); … … 1420 1359 if(WinTrackRect(hwndTracking, NULL, &track) ) 1421 1360 { 1422 if(hpsTrack) WinReleasePS(hpsTrack);1423 1424 1361 /* if successful copy final position back */ 1425 1362 if(!WinEqualRect(0, &rcl, &track.rclTrack)) { 1426 1363 dprintf(("FrameTrackFrame: new (os/2) window rect: (%d,%d)(%d,%d)", track.rclTrack.xLeft, track.rclTrack.yBottom, track.rclTrack.xRight - track.rclTrack.xLeft, track.rclTrack.yTop - track.rclTrack.yBottom)); 1427 1364 if(flags == TF_MOVE) { 1428 WinSetWindowPos(win32wnd->getOS2 WindowHandle(),1365 WinSetWindowPos(win32wnd->getOS2FrameWindowHandle(), 1429 1366 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 1430 1367 0, 0, SWP_MOVE); 1431 1368 } 1432 1369 else { 1433 //// SetWindowPos(win32wnd->getWindowHandle(), 0, track.rclTrack.xLeft, 1434 //// parentHeight - track.rclTrack.yTop, 1435 //// track.rclTrack.xRight - track.rclTrack.xLeft, 1436 //// track.rclTrack.yTop - track.rclTrack.yBottom, 1437 //// SWP_NOACTIVATE_W | SWP_NOZORDER_W | SWP_NOACTIVATE_W); 1438 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 1370 WinSetWindowPos(win32wnd->getOS2FrameWindowHandle(), 1439 1371 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 1440 1372 track.rclTrack.xRight - track.rclTrack.xLeft, … … 1445 1377 return; 1446 1378 } 1447 if(hpsTrack) WinReleasePS(hpsTrack);1448 1379 return; 1449 1380 } -
trunk/src/user32/static.cpp
r5404 r5685 1 /* $Id: static.cpp,v 1.2 3 2001-03-30 11:14:36sandervl Exp $ */1 /* $Id: static.cpp,v 1.24 2001-05-11 08:39:44 sandervl Exp $ */ 2 2 /* 3 3 * Static control … … 413 413 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 414 414 LRESULT lResult; 415 416 #ifndef ODIN_HITTEST417 //SvL: If a static window has children, then we can't return HTTRANSPARENT418 // here. For some reason PM then sends all mouse messages to the parent419 // of the static window; even if they are intended for the children of420 // the static window.421 // TODO: This could break some win32 apps (parent not receiving mouse422 // message for static window (non-child) area)423 if(GetWindow(hwnd, GW_HWNDFIRST) != 0) {424 return HTCLIENT;425 }426 #endif427 415 428 416 if (dwStyle & SS_NOTIFY) -
trunk/src/user32/win32dlg.cpp
r5473 r5685 1 /* $Id: win32dlg.cpp,v 1.6 1 2001-04-04 09:32:25sandervl Exp $ */1 /* $Id: win32dlg.cpp,v 1.62 2001-05-11 08:39:44 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 4 4 * 5 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) (Wine port & OS/2 adaption)5 * Copyright 1999-2001 Sander van Leeuwen (sandervl@xs4all.nl) (Wine port & OS/2 adaption) 6 6 * 7 7 * Based on Wine code (990815; windows\dialog.c) … … 24 24 #include "controls.h" 25 25 #include "syscolor.h" 26 #include "hook.h" 26 27 #include <math.h> 27 28 #include <unicode.h> … … 317 318 topOwner->setModalDialogOwner(TRUE); 318 319 hwndOldDialog = topOwner->getOS2HwndModalDialog(); 319 topOwner->setOS2HwndModalDialog(OS2Hwnd );320 topOwner->setOS2HwndModalDialog(OS2HwndFrame); 320 321 ShowWindow(SW_SHOW); 321 322 … … 328 329 while (TRUE) 329 330 { 330 if (! OSLibWinPeekMsg(&msg,0,0,0,PM_NOREMOVE))331 if (!PeekMessageA(&msg,0,0,0,PM_NOREMOVE)) 331 332 { 332 333 if(!(getStyle() & DS_NOIDLEMSG)) 333 334 topOwner->SendMessageA(WM_ENTERIDLE,MSGF_DIALOGBOX,getWindowHandle()); 334 OSLibWinGetMsg(&msg,0,0,0);335 GetMessageA(&msg,0,0,0); 335 336 } 336 else OSLibWinPeekMsg(&msg,0,0,0,PM_REMOVE); 337 else PeekMessageA(&msg,0,0,0,PM_REMOVE); 338 339 /* Call message filters */ 340 if (HOOK_IsHooked( WH_SYSMSGFILTER ) || HOOK_IsHooked( WH_MSGFILTER )) 341 { 342 LPMSG pmsg = (LPMSG)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG) ); 343 if (pmsg) 344 { 345 BOOL ret; 346 *pmsg = msg; 347 ret = (HOOK_CallHooksA( WH_SYSMSGFILTER, MSGF_DIALOGBOX, 0, 348 (LPARAM) pmsg ) || 349 HOOK_CallHooksA( WH_MSGFILTER, MSGF_DIALOGBOX, 0, 350 (LPARAM) pmsg )); 351 352 HeapFree( GetProcessHeap(), 0, pmsg ); 353 if (ret) 354 { 355 /* Message filtered -> remove it from the queue */ 356 /* if it's still there. */ 357 continue; 358 } 359 } 360 } 337 361 338 362 if(msg.message == WM_QUIT) -
trunk/src/user32/win32wbase.cpp
r5646 r5685 1 /* $Id: win32wbase.cpp,v 1.25 4 2001-05-03 17:51:01sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.255 2001-05-11 08:39:45 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 4 4 * 5 * Copyright 1998-200 0Sander van Leeuwen (sandervl@xs4all.nl)5 * Copyright 1998-2001 Sander van Leeuwen (sandervl@xs4all.nl) 6 6 * Copyright 1999 Daniela Engert (dani@ngrt.de) 7 7 * Copyright 1999-2000 Christoph Bratschi (cbratschi@datacomm.ch) … … 106 106 fCreationFinished= FALSE; 107 107 fMinMaxChange = FALSE; 108 fOwnDCDirty = FALSE; 108 fVisibleRegionChanged = FALSE; 109 fEraseBkgndFlag = TRUE; 109 110 110 111 windowNameA = NULL; … … 116 117 magic = WIN32PM_MAGIC; 117 118 OS2Hwnd = 0; 119 OS2HwndFrame = 0; 118 120 hSysMenu = 0; 119 121 Win32Hwnd = 0; … … 146 148 hIcon = 0; 147 149 hIconSm = 0; 148 149 EraseBkgndFlag = TRUE;150 150 151 151 horzScrollInfo = NULL; … … 467 467 (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP), 468 468 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 469 0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle() );469 0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle(), &OS2HwndFrame); 470 470 if(OS2Hwnd == 0) { 471 471 dprintf(("Window creation failed!! OS LastError %0x", OSLibWinGetLastError())); … … 688 688 689 689 if(fTaskList) { 690 hTaskList = OSLibWinAddToTaskList(OS2Hwnd , windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);690 hTaskList = OSLibWinAddToTaskList(OS2HwndFrame, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0); 691 691 } 692 692 … … 871 871 else setStyle(getStyle() & ~WS_VISIBLE); 872 872 873 return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0); 873 //already sent from ShowWindow 874 //// return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0); 875 return 0; 874 876 } 875 877 //****************************************************************************** … … 897 899 //****************************************************************************** 898 900 //****************************************************************************** 899 #if 0900 ULONG Win32BaseWindow::MsgMinMax()901 {902 903 }904 #endif905 //******************************************************************************906 //******************************************************************************907 901 ULONG Win32BaseWindow::MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos) 908 902 { … … 911 905 return SendInternalMessageA(msg, MAKELONG(scrollCode, scrollPos), 0); 912 906 } 913 //******************************************************************************914 //******************************************************************************915 #ifndef ODIN_HITTEST916 ULONG Win32BaseWindow::MsgHitTest(MSG *msg)917 {918 lastHitTestVal = DispatchMsgA(msg);919 920 dprintf2(("MsgHitTest %x (%d,%d) (%d,%d) (%d,%d) returned %x", getWindowHandle(), LOWORD(msg->lParam), HIWORD(msg->lParam), rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom, lastHitTestVal));921 922 if (lastHitTestVal == HTTRANSPARENT)923 return HTOS_TRANSPARENT;924 else925 return HTOS_NORMAL;926 }927 #endif928 907 //****************************************************************************** 929 908 //****************************************************************************** … … 957 936 958 937 if(hwndOS2Win) { 959 960 } 961 //Warning: temporary hack to force focus to newly created window962 //RealPlayer 8 does not pass WM_ACTIVATE to defwindowproc and doesn't call963 //setfocus -> keyboard focus not set964 //TODO: Find real cause!!938 threadidhwnd = O32_GetWindowThreadProcessId(hwndOS2Win, &procidhwnd); 939 } 940 //Warning: temporary hack to force focus to newly created window 941 //RealPlayer 8 does not pass WM_ACTIVATE to defwindowproc and doesn't call 942 //setfocus -> keyboard focus not set 943 //TODO: Find real cause!! 965 944 if(GetFocus() == 0 && fActivate) { 966 945 if(!(getStyle() & WS_MINIMIZE)) 967 946 SetFocus(getWindowHandle()); 968 947 } 969 //Warning: temporary hack to force focus to newly created window948 //Warning: temporary hack to force focus to newly created window 970 949 971 950 if(fActivate) { 972 973 } 974 else 951 SendInternalMessageA(WM_ACTIVATEAPP, 1, dwThreadId); //activate; specify window thread id 952 } 953 else SendInternalMessageA(WM_ACTIVATEAPP, 0, threadidhwnd); //deactivate; specify thread id of other process 975 954 return rc; 976 955 } … … 1067 1046 1068 1047 //SvL: Calling OSLibSetActiveWindow(hwndTop); causes focus problems 1069 if (win32top) OSLibWinSetFocus(win32top->getOS2 WindowHandle());1048 if (win32top) OSLibWinSetFocus(win32top->getOS2FrameWindowHandle()); 1070 1049 } 1071 1050 } … … 1122 1101 } 1123 1102 //****************************************************************************** 1124 //****************************************************************************** 1125 ULONG Win32BaseWindow::MsgNCPaint() 1126 { 1127 RECT rect; 1128 1129 if(GetOS2UpdateRect(this,&rect)) 1130 { 1103 //TODO: Should use update region, not rectangle 1104 //****************************************************************************** 1105 ULONG Win32BaseWindow::MsgNCPaint(PRECT pUpdateRect) 1106 { 1131 1107 HRGN hrgn; 1132 1108 ULONG rc; 1133 1109 RECT client = rectClient; 1134 1110 1135 if ((rect.left >= client.left) && (rect.left < client.right) && 1136 (rect.right >= client.left) && (rect.right < client.right) && 1137 (rect.top >= client.top) && (rect.top < client.bottom) && 1138 (rect.bottom >= client.top) && (rect.bottom < client.bottom)) 1139 { 1140 return 0; 1141 } 1142 1143 dprintf(("MsgNCPaint (%d,%d)(%d,%d)", rect.left, rect.top, rect.right, rect.bottom)); 1144 hrgn = CreateRectRgnIndirect(&rect); 1145 if (!hrgn) return 0; 1146 1147 rc = SendInternalMessageA(WM_NCPAINT, hrgn, 0); 1148 1149 DeleteObject(hrgn); 1150 1151 return rc; 1152 } 1153 else return 0; 1111 if ((pUpdateRect->left >= client.left) && (pUpdateRect->left < client.right) && 1112 (pUpdateRect->right >= client.left) && (pUpdateRect->right < client.right) && 1113 (pUpdateRect->top >= client.top) && (pUpdateRect->top < client.bottom) && 1114 (pUpdateRect->bottom >= client.top) && (pUpdateRect->bottom < client.bottom)) 1115 { 1116 return 0; 1117 } 1118 1119 dprintf(("MsgNCPaint (%d,%d)(%d,%d)", pUpdateRect->left, pUpdateRect->top, pUpdateRect->right, pUpdateRect->bottom)); 1120 hrgn = CreateRectRgnIndirect(pUpdateRect); 1121 1122 rc = SendInternalMessageA(WM_NCPAINT, hrgn, 0); 1123 1124 DeleteObject(hrgn); 1125 1126 return rc; 1154 1127 } 1155 1128 //****************************************************************************** … … 1164 1137 ULONG rc; 1165 1138 1166 if(lpWndPos)1167 {1139 if(lpWndPos) 1140 { 1168 1141 //set new window rectangle 1169 1142 setWindowRect(lpWndPos->x, lpWndPos->y, lpWndPos->x+lpWndPos->cx, 1170 1143 lpWndPos->y+lpWndPos->cy); 1171 1144 newWindowRect = rectWindow; 1172 }1173 else {1145 } 1146 else { 1174 1147 wndPos.hwnd = getWindowHandle(); 1175 1148 wndPos.hwndInsertAfter = 0; … … 1181 1154 wndPos.flags = SWP_FRAMECHANGED; 1182 1155 lpWndPos = &wndPos; 1183 } 1184 1185 newClientRect = rectClient; 1186 rc = SendNCCalcSize(TRUE, &newWindowRect, &oldWindowRect, &client, lpWndPos, &newClientRect); 1187 rectClient = newClientRect; //must update rectClient here 1188 1189 dprintf(("MsgFormatFrame: old client rect (%d,%d)(%d,%d), new client (%d,%d)(%d,%d)", client.left, client.top, client.right, client.bottom, rectClient.left, rectClient.top, rectClient.right, rectClient.bottom)); 1190 dprintf(("MsgFormatFrame: old window rect (%d,%d)(%d,%d), new window (%d,%d)(%d,%d)", oldWindowRect.left, oldWindowRect.top, oldWindowRect.right, oldWindowRect.bottom, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom)); 1156 } 1157 1158 newClientRect = rectClient; 1159 rc = SendNCCalcSize(TRUE, &newWindowRect, &oldWindowRect, &client, lpWndPos, &newClientRect); 1160 rectClient = newClientRect; //must update rectClient here 1161 1162 dprintf(("MsgFormatFrame: old client rect (%d,%d)(%d,%d), new client (%d,%d)(%d,%d)", client.left, client.top, client.right, client.bottom, rectClient.left, rectClient.top, rectClient.right, rectClient.bottom)); 1163 dprintf(("MsgFormatFrame: old window rect (%d,%d)(%d,%d), new window (%d,%d)(%d,%d)", oldWindowRect.left, oldWindowRect.top, oldWindowRect.right, oldWindowRect.bottom, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom)); 1164 1165 if(fNoSizeMsg || !EqualRect(&client, &rectClient)) { 1166 OSLibWinSetClientPos(getOS2WindowHandle(), rectClient.left, rectClient.top, getClientWidth(), getClientHeight(), getWindowHeight()); 1167 } 1191 1168 1192 1169 #if 1 … … 1430 1407 HandleNCPaint((HRGN)1); 1431 1408 if(hTaskList) { 1432 OSLibWinChangeTaskList(hTaskList, OS2Hwnd , getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);1409 OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 1433 1410 } 1434 1411 } … … 1590 1567 return 1; 1591 1568 } 1592 1569 1593 1570 if (!windowClass || !windowClass->getBackgroundBrush()) return 0; 1594 1571 … … 1917 1894 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 1918 1895 { 1919 HandleNCPaint((HRGN)1);1920 if(hTaskList) {1921 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);1922 }1896 HandleNCPaint((HRGN)1); 1897 if(hTaskList) { 1898 OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 1899 } 1923 1900 } 1924 1901 … … 2231 2208 case SW_HIDE: 2232 2209 if (!wasVisible) goto END; 2233 swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | 2234 SWP_NOACTIVATE | SWP_NOZORDER;2210 2211 swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER; 2235 2212 break; 2236 2213 … … 2242 2219 /* fall through */ 2243 2220 case SW_MINIMIZE: 2244 if(!(getStyle() & WS_CHILD)) 2245 { 2246 if( !(getStyle() & WS_MINIMIZE) ) 2247 swp |= MinMaximize(SW_MINIMIZE, &newPos ); 2248 2249 swp |= SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW; 2250 } 2251 else { 2252 swp |= SWP_FRAMECHANGED; 2253 if( !(getStyle() & WS_MINIMIZE) ) { 2254 swp |= MinMaximize(SW_MINIMIZE, &newPos ); 2255 fMinMaxChange = TRUE; //-> invalidate entire window in WM_CALCINVALIDRECT 2256 } 2257 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2258 } 2221 swp |= SWP_FRAMECHANGED; 2222 if( !(getStyle() & WS_MINIMIZE) ) { 2223 swp |= MinMaximize(SW_MINIMIZE, &newPos ); 2224 fMinMaxChange = TRUE; //-> invalidate entire window in WM_CALCINVALIDRECT 2225 } 2226 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2259 2227 break; 2260 2228 … … 2317 2285 2318 2286 if(!(swp & SWP_NOACTIVATE)) { 2319 OSLibWinSetActiveWindow(OS2Hwnd );2287 OSLibWinSetActiveWindow(OS2HwndFrame); 2320 2288 } 2321 2289 … … 2454 2422 } 2455 2423 } 2456 OSLibWinQueryWindowPos(OS2Hwnd , &swpOld);2424 OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld); 2457 2425 } 2458 2426 2459 2427 if(getParent()) { 2460 OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, getParent()->getWindowHeight(), 2461 getParent()->getClientRectPtr()->left, 2462 getParent()->getClientRectPtr()->top, 2463 OS2Hwnd); 2464 } 2465 else OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, OSLibQueryScreenHeight(), 0, 0, OS2Hwnd); 2428 OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, getParent()->getClientHeight(), 2429 OS2HwndFrame); 2430 } 2431 else OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, OSLibQueryScreenHeight(), OS2HwndFrame); 2432 2466 2433 if (swp.fl == 0) { 2467 2434 if(fuFlags & SWP_FRAMECHANGED) … … 2477 2444 Win32BaseWindow *wndBehind = Win32BaseWindow::GetWindowFromHandle(swp.hwndInsertBehind); 2478 2445 if(wndBehind) { 2479 swp.hwndInsertBehind = wndBehind->getOS2 WindowHandle();2446 swp.hwndInsertBehind = wndBehind->getOS2FrameWindowHandle(); 2480 2447 } 2481 2448 else { … … 2484 2451 } 2485 2452 } 2486 swp.hwnd = OS2Hwnd ;2453 swp.hwnd = OS2HwndFrame; 2487 2454 2488 2455 if(fuFlags & SWP_SHOWWINDOW && !IsWindowVisible(getWindowHandle())) { … … 2490 2457 if(hTaskList) { 2491 2458 dprintf(("Adding window %x to tasklist", getWindowHandle())); 2492 OSLibWinChangeTaskList(hTaskList, OS2Hwnd , getWindowNameA(), 1);2459 OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), 1); 2493 2460 } 2494 2461 } … … 2498 2465 if(hTaskList && !(getStyle() & WS_MINIMIZE)) { 2499 2466 dprintf(("Removing window %x from tasklist", getWindowHandle())); 2500 OSLibWinChangeTaskList(hTaskList, OS2Hwnd , getWindowNameA(), 0);2467 OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), 0); 2501 2468 } 2502 2469 } … … 2510 2477 } 2511 2478 2512 //Restore window origin of parent window with CS_OWNDC style2513 //(fixes paint offset problems in Opera windows)2514 if(getParent() && getParent()->isOwnDC()) {2515 dprintfOrigin(getParent()->getOwnDC());2516 selectClientArea(getParent(), getParent()->getOwnDC());2517 }2518 2519 2479 if((fuFlags & SWP_FRAMECHANGED) && (fuFlags & (SWP_NOMOVE | SWP_NOSIZE) == (SWP_NOMOVE | SWP_NOSIZE))) 2520 2480 { 2521 2481 NotifyFrameChanged(&wpos, &oldClientRect); 2522 2482 } 2523 2483 return (rc); … … 2713 2673 2714 2674 fDestroyWindowCalled = TRUE; 2715 return OSLibWinDestroyWindow(OS2Hwnd );2675 return OSLibWinDestroyWindow(OS2HwndFrame); 2716 2676 } 2717 2677 //****************************************************************************** … … 2770 2730 setParent(newparent); 2771 2731 getParent()->addChild(this); 2772 OSLibWinSetParent(getOS2 WindowHandle(), getParent()->getOS2WindowHandle());2732 OSLibWinSetParent(getOS2FrameWindowHandle(), getParent()->getOS2WindowHandle()); 2773 2733 if(!(getStyle() & WS_CHILD)) 2774 2734 { … … 2776 2736 setStyle(getStyle() | WS_CHILD); 2777 2737 if(getWindowId()) 2778 2779 2780 2781 2738 { 2739 DestroyMenu( (HMENU) getWindowId() ); 2740 setWindowId(0); 2741 } 2782 2742 } 2783 2743 } … … 2785 2745 setParent(windowDesktop); 2786 2746 windowDesktop->addChild(this); 2787 OSLibWinSetParent(getOS2 WindowHandle(), OSLIB_HWND_DESKTOP);2747 OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP); 2788 2748 2789 2749 //TODO: Send WM_STYLECHANGED msg? … … 2824 2784 2825 2785 hwndTop = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP); 2826 if(!isDesktopWindow()) { 2827 topwindow = GetWindowFromOS2Handle(hwndTop); 2828 if(topwindow) { 2829 return topwindow->getWindowHandle(); 2830 } 2831 return 0; 2786 if(!isDesktopWindow()) 2787 { 2788 topwindow = GetWindowFromOS2FrameHandle(hwndTop); 2789 if(topwindow) { 2790 return topwindow->getWindowHandle(); 2791 } 2792 return 0; 2832 2793 } 2833 2794 while(hwndTop) { 2834 topwindow = GetWindowFromOS2Handle(hwndTop);2835 if(topwindow) {2836 return topwindow->getWindowHandle();2837 }2795 topwindow = GetWindowFromOS2FrameHandle(hwndTop); 2796 if(topwindow) { 2797 return topwindow->getWindowHandle(); 2798 } 2838 2799 hwndTop = OSLibWinQueryWindow(hwndTop, QWOS_NEXT); 2839 2800 } … … 3011 2972 while(hwnd) 3012 2973 { 3013 wnd = GetWindowFromOS2 Handle(hwnd);2974 wnd = GetWindowFromOS2FrameHandle(hwnd); 3014 2975 if(wnd == NULL) { 3015 2976 hwnd = OSLibWinQueryClientWindow(hwnd); … … 3041 3002 Win32BaseWindow *window; 3042 3003 3043 #if 13044 3004 switch(uCmd) 3045 3005 { … … 3049 3009 window = (Win32BaseWindow *)getParent(); 3050 3010 hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP); 3051 window = GetWindowFromOS2 Handle(hwndRelated);3011 window = GetWindowFromOS2FrameHandle(hwndRelated); 3052 3012 if(window) { 3053 3013 hwndRelated = window->getWindowHandle(); 3054 3014 } 3055 3015 else hwndRelated = 0; 3056 3016 } 3057 else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop 3017 else { 3018 dprintf(("WARNING: GW_HWNDFIRST not correctly implemented for toplevel/most windows!")); 3019 hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop 3020 } 3058 3021 break; 3059 3022 3060 3023 case GW_HWNDLAST: 3061 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_BOTTOM); 3062 window = GetWindowFromOS2Handle(hwndRelated); 3063 if(window) { 3064 hwndRelated = window->getWindowHandle(); 3065 } 3066 else hwndRelated = 0; 3024 if(getParent()) { 3025 window = (Win32BaseWindow *)getParent(); 3026 hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_BOTTOM); 3027 dprintf(("os2 handle %x", hwndRelated)); 3028 window = GetWindowFromOS2FrameHandle(hwndRelated); 3029 if(window) { 3030 hwndRelated = window->getWindowHandle(); 3031 } 3032 else hwndRelated = 0; 3033 } 3034 else { 3035 dprintf(("WARNING: GW_HWNDLAST not correctly implemented for toplevel/most windows!")); 3036 hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop 3037 } 3067 3038 break; 3068 3039 3069 3040 case GW_HWNDNEXT: 3070 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_NEXT); 3071 window = GetWindowFromOS2Handle(hwndRelated); 3072 if(window) { 3073 hwndRelated = window->getWindowHandle(); 3074 } 3075 else hwndRelated = 0; 3041 if(getParent()) { 3042 hwndRelated = OSLibWinQueryWindow(getOS2FrameWindowHandle(), QWOS_NEXT); 3043 window = GetWindowFromOS2FrameHandle(hwndRelated); 3044 if(window) { 3045 hwndRelated = window->getWindowHandle(); 3046 } 3047 else hwndRelated = 0; 3048 } 3049 else { 3050 dprintf(("WARNING: GW_HWNDNEXT not correctly implemented for toplevel/most windows!")); 3051 hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop 3052 } 3076 3053 break; 3077 3054 3078 3055 case GW_HWNDPREV: 3079 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_PREV); 3080 window = GetWindowFromOS2Handle(hwndRelated); 3081 if(window) { 3082 hwndRelated = window->getWindowHandle(); 3083 } 3084 else hwndRelated = 0; 3056 if(getParent()) { 3057 hwndRelated = OSLibWinQueryWindow(getOS2FrameWindowHandle(), QWOS_PREV); 3058 window = GetWindowFromOS2FrameHandle(hwndRelated); 3059 if(window) { 3060 hwndRelated = window->getWindowHandle(); 3061 } 3062 else hwndRelated = 0; 3063 } 3064 else { 3065 dprintf(("WARNING: GW_HWNDPREV not correctly implemented for toplevel/most windows!")); 3066 hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop 3067 } 3085 3068 break; 3086 3069 … … 3093 3076 case GW_CHILD: 3094 3077 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP); 3095 window = GetWindowFromOS2 Handle(hwndRelated);3078 window = GetWindowFromOS2FrameHandle(hwndRelated); 3096 3079 if(window) { 3097 3080 hwndRelated = window->getWindowHandle(); … … 3100 3083 break; 3101 3084 } 3102 #else3103 switch(uCmd)3104 {3105 case GW_HWNDFIRST:3106 if(getParent()) {3107 window = (Win32BaseWindow *)getParent()->getFirstChild();3108 hwndRelated = window->getWindowHandle();3109 }3110 break;3111 3112 case GW_HWNDLAST:3113 if(!getParent())3114 {3115 goto end;3116 }3117 3118 window = this;3119 while(window->getNextChild())3120 {3121 window = (Win32BaseWindow *)window->getNextChild();3122 }3123 hwndRelated = window->getWindowHandle();3124 break;3125 3126 case GW_HWNDNEXT:3127 window = (Win32BaseWindow *)getNextChild();3128 if(window) {3129 hwndRelated = window->getWindowHandle();3130 }3131 break;3132 3133 case GW_HWNDPREV:3134 if(!getParent())3135 {3136 goto end;3137 }3138 window = (Win32BaseWindow *)(getParent()->getFirstChild()); /* First sibling */3139 if(window == this)3140 {3141 hwndRelated = 0; /* First in list */3142 goto end;3143 }3144 while(window->getNextChild())3145 {3146 if (window->getNextChild() == this)3147 {3148 hwndRelated = window->getWindowHandle();3149 goto end;3150 }3151 window = (Win32BaseWindow *)window->getNextChild();3152 }3153 break;3154 3155 case GW_OWNER:3156 if(getOwner()) {3157 hwndRelated = getOwner()->getWindowHandle();3158 }3159 break;3160 3161 case GW_CHILD:3162 if(getFirstChild()) {3163 hwndRelated = ((Win32BaseWindow *)getFirstChild())->getWindowHandle();3164 }3165 break;3166 }3167 #endif3168 3085 end: 3169 3086 dprintf(("GetWindow %x %d returned %x", getWindowHandle(), uCmd, hwndRelated)); … … 3227 3144 SendMessageA(WM_CANCELMODE, 0, 0); 3228 3145 } 3229 OSLibWinEnableWindow(OS2Hwnd , fEnable);3146 OSLibWinEnableWindow(OS2HwndFrame, fEnable); 3230 3147 if(fEnable == FALSE) { 3231 3148 //SvL: No need to clear focus as PM already does this … … 3436 3353 setStyle(ss.styleNew); 3437 3354 SendInternalMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss); 3438 OSLibSetWindowStyle(getOS2 WindowHandle(), getStyle(), getExStyle());3355 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), getStyle(), getExStyle()); 3439 3356 #ifdef DEBUG 3440 3357 PrintWindowStyle(ss.styleNew, 0); … … 3607 3524 // dprintf2(("Win32BaseWindow::GetWindowFromOS2Handle: not an Odin os2 window %x", hwnd)); 3608 3525 return 0; 3526 } 3527 //****************************************************************************** 3528 //****************************************************************************** 3529 Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2FrameHandle(HWND hwnd) 3530 { 3531 return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT)); 3609 3532 } 3610 3533 //****************************************************************************** … … 3808 3731 return window->getWindowHandle(); 3809 3732 } 3733 window = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd); 3734 if(window) { 3735 return window->getWindowHandle(); 3736 } 3737 3810 3738 // dprintf2(("Win32BaseWindow::OS2ToWin32Handle: not a win32 window %x", hwnd)); 3811 3739 return 0; -
trunk/src/user32/win32wbase.h
r5606 r5685 1 /* $Id: win32wbase.h,v 1.11 5 2001-04-27 17:36:39sandervl Exp $ */1 /* $Id: win32wbase.h,v 1.116 2001-05-11 08:39:45 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 134 134 ULONG MsgPaint(ULONG tmp1, BOOL select = TRUE); 135 135 ULONG MsgEraseBackGround(HDC hdc); 136 #ifndef ODIN_HITTEST 137 ULONG MsgHitTest(MSG *msg); 138 #endif 139 ULONG MsgNCPaint(); 136 ULONG MsgNCPaint(PRECT pUpdateRect); 140 137 ULONG MsgFormatFrame(WINDOWPOS *lpWndPos); 141 138 ULONG DispatchMsgA(MSG *msg); … … 160 157 HWND getWindowHandle() { return Win32Hwnd; }; 161 158 HWND getOS2WindowHandle() { return OS2Hwnd; }; 159 HWND getOS2FrameWindowHandle() { return OS2HwndFrame; }; 162 160 163 161 Win32WndClass *getWindowClass() { return windowClass; }; … … 260 258 BOOL IsMixMaxStateChanging() { return fMinMaxChange; }; 261 259 260 void SetVisibleRegionChanged(BOOL changed) { fVisibleRegionChanged = changed; }; 261 BOOL IsVisibleRegionChanged() { return fVisibleRegionChanged; }; 262 262 263 int GetWindowTextLength(BOOL fUnicode); 263 264 int GetWindowTextLengthA() { return GetWindowTextLength(FALSE); }; … … 317 318 static Win32BaseWindow *GetWindowFromHandle(HWND hwnd); 318 319 static Win32BaseWindow *GetWindowFromOS2Handle(HWND hwnd); 320 static Win32BaseWindow *GetWindowFromOS2FrameHandle(HWND hwnd); 319 321 320 322 static void DestroyAll(); … … 334 336 PROPERTY *findWindowProperty(LPCSTR str); 335 337 336 HWND OS2Hwnd ;338 HWND OS2Hwnd, OS2HwndFrame; 337 339 HMENU hSysMenu; 338 340 HWND Win32Hwnd; … … 358 360 HWND OS2HwndModalDialog; 359 361 360 unsigned fFirstShow:1;361 unsigned fIsDialog:1;362 unsigned fIsModalDialog:1;363 unsigned fIsModalDialogOwner:1;364 unsigned fInternalMsg:1;//Used to distinguish between messages362 ULONG fFirstShow:1, 363 fIsDialog:1, 364 fIsModalDialog:1, 365 fIsModalDialogOwner:1, 366 fInternalMsg:1, //Used to distinguish between messages 365 367 //sent by PM and those sent by apps 366 unsigned fNoSizeMsg:1;367 unsigned fIsDestroyed:1;368 unsigned fDestroyWindowCalled:1;//DestroyWindow was called for this window369 unsigned fCreated:1;370 unsigned fCreationFinished:1;//True when window or dialog has been created successfully368 fNoSizeMsg:1, 369 fIsDestroyed:1, 370 fDestroyWindowCalled:1, //DestroyWindow was called for this window 371 fCreated:1, 372 fCreationFinished:1, //True when window or dialog has been created successfully 371 373 //Needed to prevent DestroyWindow from deleting the window 372 374 //object during construction 373 unsigned fTaskList:1; //should be listed in PM tasklist or not 374 unsigned fXDefault:1; 375 unsigned fCXDefault:1; 376 unsigned fParentDC:1; 377 unsigned fComingToTop:1; 378 unsigned fCreateSetWindowPos:1; //FALSE -> SetWindowPos in Win32BaseWindow::MsgCreate not yet called 379 unsigned isUnicode:1; 380 unsigned fMinMaxChange:1; //set when switching between min/max/restored state 381 unsigned fOwnDCDirty:1; //set when selectClientArea must reset the origin + visible region 375 fTaskList:1, //should be listed in PM tasklist or not 376 fXDefault:1, 377 fCXDefault:1, 378 fParentDC:1, 379 fComingToTop:1, 380 fCreateSetWindowPos:1, //FALSE -> SetWindowPos in Win32BaseWindow::MsgCreate not yet called 381 isUnicode:1, 382 fMinMaxChange:1, //set when switching between min/max/restored state 383 fVisibleRegionChanged:1, //set when visible region has changed -> erase background must be sent during next BeginPaint 384 fEraseBkgndFlag:1; 382 385 383 386 HRGN hWindowRegion; … … 469 472 BOOL isOwnDC() { return (windowClass && windowClass->getStyle() & CS_OWNDC_W); } 470 473 #endif 471 void invalidateOwnDC() { fOwnDCDirty = TRUE; };472 void validateOwnDC() { fOwnDCDirty = FALSE; };473 BOOL isOwnDCDirty() { return fOwnDCDirty; };474 474 475 475 HDC getOwnDC() { return ownDC; } … … 478 478 HDC ownDC; 479 479 480 ULONG EraseBkgndFlag:1,481 filler:31;482 480 public: 483 VOID setEraseBkgnd (BOOL erase) { EraseBkgndFlag = erase; }484 BOOL needsEraseBkgnd() { return EraseBkgndFlag; }481 VOID setEraseBkgnd (BOOL erase) { fEraseBkgndFlag = erase; } 482 BOOL needsEraseBkgnd() { return fEraseBkgndFlag; } 485 483 }; 486 484 -
trunk/src/user32/win32wbasepos.cpp
r5655 r5685 1 /* $Id: win32wbasepos.cpp,v 1.2 3 2001-05-04 17:02:52sandervl Exp $ */1 /* $Id: win32wbasepos.cpp,v 1.24 2001-05-11 08:39:45 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (nonclient/position methods) … … 59 59 if(!(getStyle() & (WS_POPUP | WS_CHILD))) { 60 60 RECT rect; 61 OSLibWinGetMaxPosition(getOS2 WindowHandle(), &rect);61 OSLibWinGetMaxPosition(getOS2FrameWindowHandle(), &rect); 62 62 MinMax.ptMaxPosition.x = rect.left; 63 63 MinMax.ptMaxPosition.y = rect.top; -
trunk/src/user32/win32wdesktop.cpp
r4757 r5685 1 /* $Id: win32wdesktop.cpp,v 1.1 5 2000-12-05 13:05:52sandervl Exp $ */1 /* $Id: win32wdesktop.cpp,v 1.16 2001-05-11 08:39:46 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Desktop Window for OS/2 … … 52 52 53 53 OS2Hwnd = OSLIB_HWND_DESKTOP; 54 OS2HwndFrame = OSLIB_HWND_DESKTOP; 54 55 rectClient = rectWindow; 55 56 -
trunk/src/user32/win32wndhandle.cpp
r4866 r5685 1 /* $Id: win32wndhandle.cpp,v 1. 8 2001-01-02 18:14:59sandervl Exp $ */1 /* $Id: win32wndhandle.cpp,v 1.9 2001-05-11 08:39:46 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Handle Management Code for OS/2 … … 64 64 WindowHandleTable[lastIndex] = dwUserData; 65 65 66 lastIndex++; 66 67 tableMutex.leave(&hGlobalTableMutex); 67 68 return TRUE; -
trunk/src/user32/window.cpp
r5586 r5685 1 /* $Id: window.cpp,v 1.9 4 2001-04-25 20:53:39sandervl Exp $ */1 /* $Id: window.cpp,v 1.95 2001-05-11 08:39:46 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 404 404 405 405 if(hwnd == HWND_DESKTOP) { 406 window = windowDesktop;406 window = windowDesktop; 407 407 } 408 408 else { … … 412 412 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 413 413 return 0; 414 }414 } 415 415 } 416 416 hwndTop = window->GetTopWindow(); … … 947 947 if (!pRect) 948 948 { 949 SetLastError(ERROR_INVALID_PARAMETER);950 return FALSE;949 SetLastError(ERROR_INVALID_PARAMETER); 950 return FALSE; 951 951 } 952 952 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 973 973 if(style == 0 && menu == FALSE && exStyle == 0) { 974 974 dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d) -> no change required", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom)); 975 return TRUE; //nothing needs to be changed (VERIFIED in NT 4)975 return TRUE; //nothing needs to be changed (VERIFIED in NT 4) 976 976 } 977 977 dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d)\n", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom)); … … 988 988 //Adjust rect outer (Win32BaseWindow::AdjustRectOuter) 989 989 if (HAS_THICKFRAME(style,exStyle)) 990 InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );990 InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) ); 991 991 else 992 992 if (HAS_DLGFRAME(style,exStyle)) 993 993 InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) ); 994 995 996 994 else 995 if (HAS_THINFRAME(style)) 996 InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); 997 997 998 998 if ((style & WS_CAPTION) == WS_CAPTION) 999 999 { 1000 if (exStyle & WS_EX_TOOLWINDOW)1001 rect->top -= GetSystemMetrics(SM_CYSMCAPTION);1002 else1003 rect->top -= GetSystemMetrics(SM_CYCAPTION);1000 if (exStyle & WS_EX_TOOLWINDOW) 1001 rect->top -= GetSystemMetrics(SM_CYSMCAPTION); 1002 else 1003 rect->top -= GetSystemMetrics(SM_CYCAPTION); 1004 1004 } 1005 1005 1006 1006 if (menu) 1007 rect->top -= GetSystemMetrics(SM_CYMENU);1007 rect->top -= GetSystemMetrics(SM_CYMENU); 1008 1008 1009 1009 //Adjust rect inner (Win32BaseWindow::AdjustRectInner) 1010 1010 if(!(style & WS_ICONIC)) { 1011 if (exStyle & WS_EX_CLIENTEDGE)1011 if (exStyle & WS_EX_CLIENTEDGE) 1012 1012 InflateRect (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); 1013 1013 1014 if (exStyle & WS_EX_STATICEDGE)1014 if (exStyle & WS_EX_STATICEDGE) 1015 1015 InflateRect (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); 1016 1016 1017 //SvL: scrollbars aren't checked *UNLESS* the style includes a border (any border)1017 //SvL: scrollbars aren't checked *UNLESS* the style includes a border (any border) 1018 1018 // --> VERIFIED IN NT4, SP6 (fixes MFC apps with scrollbars + bar controls) 1019 if(style & (WS_THICKFRAME|WS_BORDER|WS_DLGFRAME)) {1019 if(style & (WS_THICKFRAME|WS_BORDER|WS_DLGFRAME)) { 1020 1020 if (style & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL); 1021 1021 if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL); 1022 }1022 } 1023 1023 } 1024 1024 … … 1687 1687 return FALSE; 1688 1688 } 1689 dprintf(("USER32: ShowOwnedPopups %x %d", hwnd , fShow));1689 dprintf(("USER32: ShowOwnedPopups %x %d", hwndOwner, fShow)); 1690 1690 1691 1691 hwnd = GetWindow(GetDesktopWindow(), GW_CHILD);
Note:
See TracChangeset
for help on using the changeset viewer.