- Timestamp:
- Jun 7, 2000, 4:51:33 PM (25 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/Makefile
r3493 r3662 1 # $Id: Makefile,v 1.7 0 2000-05-05 11:32:35sandervl Exp $1 # $Id: Makefile,v 1.71 2000-06-07 14:51:23 sandervl Exp $ 2 2 3 3 # … … 43 43 $(OBJDIR)\display.obj \ 44 44 $(OBJDIR)\pmwindow.obj \ 45 $(OBJDIR)\pmframe.obj \46 45 $(OBJDIR)\win32class.obj \ 47 46 $(OBJDIR)\win32wnd.obj \ -
trunk/src/user32/USER32.DEF
r3641 r3662 1 ; $Id: USER32.DEF,v 1.3 1 2000-06-01 11:27:55sandervl Exp $1 ; $Id: USER32.DEF,v 1.32 2000-06-07 14:51:24 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 13 13 _GpiQueryDCData = PMGPI.665 14 14 _GpiEnableYInversion = PMGPI.723 15 _GpiQueryYInversion = PMGPI.726 15 16 _HPSToHDC = PMWINX.1022 16 17 _DeleteHDC = PMWINX.1023 -
trunk/src/user32/button.cpp
r3641 r3662 1 /* $Id: button.cpp,v 1.3 6 2000-06-01 11:27:56sandervl Exp $ */1 /* $Id: button.cpp,v 1.37 2000-06-07 14:51:24 sandervl Exp $ */ 2 2 /* File: button.cpp -- Button type widgets 3 3 * … … 176 176 static LRESULT BUTTON_EraseBkgnd(HWND hwnd,WPARAM wParam,LPARAM lParam) 177 177 { 178 //SvL: This is wrong: should be178 DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & 0x0f; 179 179 //SvL: TODO: NT does something extra for ownerdrawn buttons; check this 180 // if(style == BS_OWNERDRAW) { 181 // return DefWindowProcA(hwnd, WM_ERASEBKGND, wParam, lParam); 182 // } 183 // return 1; 184 185 //SvL: Erase background for groupboxes as the paint function only draws 186 // a box 187 DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & 0x0f; 188 // if(style == BS_GROUPBOX) { 180 if(style == BS_OWNERDRAW) { 189 181 return DefWindowProcA(hwnd, WM_ERASEBKGND, wParam, lParam); 190 //}191 //return 1;182 } 183 return 1; 192 184 } 193 185 … … 325 317 DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & 0x0f; 326 318 327 //if (style == BS_GROUPBOX) return HTTRANSPARENT;319 if (style == BS_GROUPBOX) return HTTRANSPARENT; 328 320 329 321 return DefWindowProcA(hwnd,WM_NCHITTEST,wParam,lParam); … … 1205 1197 wndClass.cbWndExtra = sizeof(BUTTONINFO); 1206 1198 wndClass.hCursor = LoadCursorA(0,IDC_ARROWA); 1207 // wndClass.hbrBackground = (HBRUSH)0;1208 1199 wndClass.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); 1209 1200 wndClass.lpszClassName = BUTTONCLASSNAME; -
trunk/src/user32/clipboard.cpp
r3462 r3662 1 /* $Id: clipboard.cpp,v 1. 7 2000-04-29 18:28:34sandervl Exp $ */1 /* $Id: clipboard.cpp,v 1.8 2000-06-07 14:51:25 sandervl Exp $ */ 2 2 3 3 /* … … 40 40 } 41 41 dprintf(("USER32: ChangeClipboardChain\n")); 42 return O32_ChangeClipboardChain(wndRemove->getOS2 FrameWindowHandle(),43 wndNext->getOS2 FrameWindowHandle());42 return O32_ChangeClipboardChain(wndRemove->getOS2WindowHandle(), 43 wndNext->getOS2WindowHandle()); 44 44 } 45 45 //****************************************************************************** … … 108 108 hwndOwner = O32_GetClipboardOwner(); 109 109 110 window = Win32BaseWindow::GetWindowFromOS2 FrameHandle(hwndOwner);110 window = Win32BaseWindow::GetWindowFromOS2Handle(hwndOwner); 111 111 if(!window) { 112 112 //an OS/2 window probably owns the clipboard, we pretend nobody owns it … … 125 125 hwndViewer = O32_GetClipboardViewer(); 126 126 127 window = Win32BaseWindow::GetWindowFromOS2 FrameHandle(hwndViewer);127 window = Win32BaseWindow::GetWindowFromOS2Handle(hwndViewer); 128 128 if(!window) { 129 129 //probably an OS/2 window, we pretend it's nobody … … 142 142 hwnd = O32_GetOpenClipboardWindow(); 143 143 144 window = Win32BaseWindow::GetWindowFromOS2 FrameHandle(hwnd);144 window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 145 145 if(!window) { 146 146 //probably an OS/2 window, we pretend it's nobody … … 176 176 } 177 177 dprintf(("USER32: OpenClipboard\n")); 178 return O32_OpenClipboard(window->getOS2 FrameWindowHandle());178 return O32_OpenClipboard(window->getOS2WindowHandle()); 179 179 } 180 180 //****************************************************************************** … … 219 219 } 220 220 dprintf(("USER32: SetClipboardViewer\n")); 221 hwndOld = O32_SetClipboardViewer(wndnew->getOS2 FrameWindowHandle());222 223 wndold = Win32BaseWindow::GetWindowFromOS2 FrameHandle(hwndOld);221 hwndOld = O32_SetClipboardViewer(wndnew->getOS2WindowHandle()); 222 223 wndold = Win32BaseWindow::GetWindowFromOS2Handle(hwndOld); 224 224 if(!wndold) { 225 225 //probably an OS/2 window, so pretend it's nobody -
trunk/src/user32/dc.cpp
r3641 r3662 1 /* $Id: dc.cpp,v 1.5 8 2000-06-01 11:27:56sandervl Exp $ */1 /* $Id: dc.cpp,v 1.59 2000-06-07 14:51:25 sandervl Exp $ */ 2 2 3 3 /* … … 22 22 #include <stdlib.h> 23 23 24 #include <string.h> 24 25 #include <win32type.h> 25 26 #include <win32api.h> … … 301 302 //****************************************************************************** 302 303 //****************************************************************************** 304 VOID removeClientArea(pDCData pHps) 305 { 306 POINTL point; 307 308 // This function checks to see if a client area is currently selected, if 309 // it is the origin plus the visible region of the frame are restored. 310 311 pHps->isClient = FALSE; 312 313 GreGetDCOrigin(pHps->hps, &point); 314 315 if(pHps->isClientArea) 316 { 317 dprintf2(("removeClientArea: (%d,%d) -> (%d,%d)", point.x, point.y, pHps->ptlOrigin.x, pHps->ptlOrigin.y)); 318 pHps->isClientArea = FALSE; 319 GreSetupDC(pHps->hps, 320 pHps->hrgnVis, 321 pHps->ptlOrigin.x, 322 pHps->ptlOrigin.y, 323 0, 324 SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP); 325 } 326 else dprintf(("removeClientArea: (%d,%d)", point.x, point.y)); 327 328 } 329 //****************************************************************************** 330 //****************************************************************************** 331 HRGN selectClientArea(Win32BaseWindow *window, pDCData pHps, PRECTL prclPaint) 332 { 333 // This function checks to see if the DC needs to be adjusted to a client 334 // area and makes the adjustment. 335 RECTL rcl, rcltemp; 336 HRGN hrgnRect, hrgnClip, hrgnOldClip = 0; 337 HWND hwnd; 338 LONG rc; 339 PRECT pClient = window->getClientRectPtr(); 340 PRECT pWindow = window->getWindowRect(); 341 342 if(pClient->left == 0 && pClient->top == 0 && 343 window->getClientHeight() == window->getWindowHeight() && 344 window->getClientWidth() == window->getWindowWidth()) 345 { 346 //client rectangle = frame rectangle -> no change necessary 347 //only setup the clip region 348 goto setupclipregion; 349 } 350 351 pHps->isClient = TRUE; 352 353 hwnd = window->getOS2WindowHandle(); 354 355 mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&rcl); 356 357 //convert to screen coordinates 358 GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp); 359 rcl.xLeft += rcltemp.xLeft; 360 rcl.xRight += rcltemp.xLeft; 361 rcl.yTop += rcltemp.yBottom; 362 rcl.yBottom += rcltemp.yBottom; 363 364 pHps->ptlOrigin.x = rcltemp.xLeft; 365 pHps->ptlOrigin.y = rcltemp.yBottom; 366 367 dprintf2(("selectClientArea: (%d,%d) -> (%d,%d)", rcltemp.xLeft, rcltemp.yBottom, rcl.xLeft, rcl.yBottom)); 368 369 if(pHps->hrgnVis == 0) 370 pHps->hrgnVis = GreCreateRectRegion(pHps->hps, &rcl, 1); 371 372 hrgnRect = GreCreateRectRegion(pHps->hps, &rcl, 1); 373 374 // Query the visible region 375 GreCopyClipRegion(pHps->hps, pHps->hrgnVis, 0, COPYCRGN_VISRGN); 376 GpiQueryRegionBox(pHps->hps, pHps->hrgnVis, &rcltemp); 377 // And the visible region of the frame with the client rectangle 378 // to get the new visible region 379 GreCombineRegion(pHps->hps, hrgnRect, pHps->hrgnVis, hrgnRect, CRGN_AND); 380 381 // Set the new origin plus visible region in the DC 382 GreSetupDC(pHps->hps, 383 hrgnRect, 384 rcl.xLeft, 385 rcl.yBottom, 386 NULL, 387 SETUPDC_ORIGIN | SETUPDC_VISRGN | SETUPDC_RECALCCLIP); 388 389 /* 390 GpiQueryRegionBox(pHps->hps, hrgnClip, &rcltemp); 391 GpiQueryRegionBox(pHps->hps, hrgnOldClip, &rcltemp); 392 393 GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp); 394 395 GreGetDCOrigin(pHps->hps, (PPOINTL)&rcltemp); 396 397 GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_VISRGN); 398 GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp); 399 400 GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_ALLINTERSECT); 401 GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp); 402 403 GreCopyClipRegion(pHps->hps, hrgnRect, 0, COPYCRGN_CLIPRGN); 404 GpiQueryRegionBox(pHps->hps, hrgnRect, &rcltemp); 405 */ 406 pHps->isClientArea = TRUE; 407 408 // Destroy the region now we have finished with it. 409 GreDestroyRegion(pHps->hps, hrgnRect); 410 411 setupclipregion: 412 if(prclPaint) { 413 hrgnClip = GpiQueryClipRegion(pHps->hps); 414 if(hrgnClip) { 415 rc = GreIntersectClipRectangle(pHps->hps, prclPaint); 416 if(rc == RGN_ERROR) { 417 dprintf(("selectClientArea: GreIntersectClipRectangle returned RGN_ERROR!")); 418 } 419 } 420 else { 421 hrgnClip = GreCreateRectRegion(pHps->hps, prclPaint, 1); 422 GreSelectClipRegion(pHps->hps, hrgnClip, &hrgnOldClip); 423 } 424 } 425 426 return hrgnOldClip; 427 } 428 //****************************************************************************** 429 //****************************************************************************** 303 430 LONG clientHeight(Win32BaseWindow *wnd, HWND hwnd, pDCData pHps) 304 431 { … … 308 435 if ((hwnd != 0) || (pHps == 0)) 309 436 { 310 if (wnd) 311 return (wnd->getClientHeight()); 312 else 313 return OSLibQueryScreenHeight(); 437 if(wnd) { 438 if(pHps && !pHps->isClientArea) { 439 return (wnd->getWindowHeight()); 440 } 441 else return (wnd->getClientHeight()); 442 } 443 else return OSLibQueryScreenHeight(); 314 444 } 315 445 else if (pHps->bitmapHandle) … … 430 560 //****************************************************************************** 431 561 //****************************************************************************** 432 #if 0433 HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps)434 {435 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP;436 pDCData pHps = NULLHANDLE;437 RECTL rect;438 HPS hPS_ownDC = NULLHANDLE;439 440 if ( !lpps )441 {442 SetLastError(ERROR_INVALID_PARAMETER_W);443 return (HDC)NULLHANDLE;444 }445 446 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);447 448 #if 0449 if ((hwnd != HWND_DESKTOP) && wnd->isOwnDC())450 {451 hPS_ownDC = wnd->getOwnDC();452 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)453 if(hPS_ownDC) {454 pHps = (pDCData)GpiQueryDCData(hPS_ownDC);455 if (!pHps)456 {457 SetLastError(ERROR_INVALID_PARAMETER_W);458 return (HDC)NULLHANDLE;459 }460 }461 }462 #endif463 464 HWND hwndClient = wnd->getOS2WindowHandle();465 HPS hps = WinBeginPaint(hwndClient, hPS_ownDC, &rect);466 467 if (!pHps)468 {469 HDC hdc = HPSToHDC (hwndClient, hps, NULL, NULL);470 pHps = (pDCData)GpiQueryDCData(hps);471 }472 473 if (hPS_ownDC == 0)474 setMapMode (wnd, pHps, MM_TEXT_W);475 else476 setPageXForm (wnd, pHps);477 478 pHps->hdcType = TYPE_3;479 480 HideCaret(hwnd);481 482 if(wnd->needsEraseBkgnd()) {483 wnd->setEraseBkgnd(FALSE);484 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) != 0);485 }486 else lpps->fErase = TRUE;487 lpps->hdc = (HDC)hps;488 489 if (!hPS_ownDC)490 {491 long height = wnd->getClientHeight();492 493 rect.yTop = height - rect.yTop;494 rect.yBottom = height - rect.yBottom;495 }496 else497 {498 rect.yTop--;499 rect.yBottom--;500 GpiConvert(pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, (PPOINTL)&rect);501 }502 503 WINRECT_FROM_PMRECT(lpps->rcPaint, rect);504 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));505 506 SetLastError(0);507 return (HDC)pHps->hps;508 }509 510 BOOL WIN32API EndPaint (HWND hwnd, const PAINTSTRUCT_W *pPaint)511 {512 pDCData pHps;513 514 dprintf (("USER32: EndPaint(%x)", hwnd));515 516 ShowCaret(hwnd);517 if (!pPaint || !pPaint->hdc )518 return TRUE;519 520 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);521 522 if (!wnd) goto exit;523 524 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)525 pHps = (pDCData)GpiQueryDCData((HPS)pPaint->hdc);526 if (pHps && (pHps->hdcType == TYPE_3)) {527 WinEndPaint (pHps->hps);528 }529 wnd->setEraseBkgnd(TRUE);530 531 exit:532 SetLastError(0);533 return TRUE;534 }535 #else536 562 HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps) 537 563 { … … 540 566 HPS hPS_ownDC = NULLHANDLE, hpsPaint = 0; 541 567 RECTL rectl = {0, 0, 1, 1}; 542 HRGN hrgnUpdate, hrgnOld ;568 HRGN hrgnUpdate, hrgnOld, hrgnOldClip; 543 569 LONG lComplexity; 544 570 RECTL rectlClient; 571 RECTL rectlClip; 572 573 memset(lpps, 0, sizeof(*lpps)); 545 574 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 546 575 if(!lpps || !wnd) { … … 567 596 } 568 597 if(!hpsPaint) { 569 hpsPaint = GetDCEx(hwnd, 0, DCX_CACHE_W);598 hpsPaint = GetDCEx(hwnd, 0, (DCX_CACHE_W|DCX_WINDOW_W|DCX_USESTYLE_W)); 570 599 pHps = (pDCData)GpiQueryDCData(hpsPaint); 571 600 if (!pHps) … … 577 606 } 578 607 579 #if 0 580 HPS hps = WinBeginPaint(hwndClient, hPS_ownDC, &rect); 581 582 if (!pHps) 583 { 584 HDC hdc = HPSToHDC (hwndClient, hps, NULL, NULL); 585 pHps = (pDCData)GpiQueryDCData(hps); 586 } 587 #endif 588 589 if (hPS_ownDC == 0) 608 if(WinQueryUpdateRect(hwndClient, &rectl) == FALSE) { 609 memset(&rectl, 0, sizeof(rectl)); 610 dprintf (("USER32: WARNING: WinQueryUpdateRect failed (error or no update rectangle)!!")); 611 612 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient); 613 WinOffsetRect(NULL, &rectlClient, -rectlClient.xLeft, -rectlClient.yBottom); 614 615 hrgnOldClip = selectClientArea(wnd, pHps, &rectlClient); 616 //save old clip region (restored for CS_OWNDC windows in EndPaint) 617 wnd->SetClipRegion(hrgnOldClip); 618 lComplexity = RGN_NULL; 619 } 620 else { 621 HRGN hrgnTmp = GpiCreateRegion(pHps->hps, 1, &rectl); 622 623 WinQueryUpdateRegion(hwndClient, hrgnTmp); 624 625 RGNRECT rgnrect = {0, 12, 0, RECTDIR_LFRT_TOPBOT}; 626 RECTL rectls[12], rcltemp; 627 GpiQueryRegionRects(pHps->hps, hrgnTmp, &rcltemp, &rgnrect, &rectls[0]); 628 GpiDestroyRegion(pHps->hps, hrgnTmp); 629 630 WinValidateRect(hwndClient, &rectl, FALSE); 631 632 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient); 633 WinIntersectRect(NULL, &rectlClip, &rectl, &rectlClient); 634 WinOffsetRect(NULL, &rectlClip, -rectlClient.xLeft, -rectlClient.yBottom); 635 636 hrgnOldClip = selectClientArea(wnd, pHps, &rectlClip); 637 638 //save old clip region (restored for CS_OWNDC windows in EndPaint) 639 wnd->SetClipRegion(hrgnOldClip); 640 memcpy(&rectl, &rectlClip, sizeof(RECTL)); 641 lComplexity = RGN_RECT; 642 } 643 644 if(hPS_ownDC == 0) 590 645 setMapMode (wnd, pHps, MM_TEXT_W); 591 646 else 592 setPageXForm 647 setPageXForm(wnd, pHps); 593 648 594 649 pHps->hdcType = TYPE_3; 595 650 596 hrgnUpdate = GpiCreateRegion(pHps->hps, 1, &rectl); 597 lComplexity = WinQueryUpdateRegion(hwndClient, hrgnUpdate); 598 if(lComplexity == RGN_ERROR) { 599 dprintf (("USER32: BeginPaint update region error!!")); 600 SetLastError(ERROR_INVALID_PARAMETER_W); 601 return 0; 602 } 603 WinQueryUpdateRect(hwndClient, &rectl); 604 605 if(lComplexity != RGN_NULL) { 606 WinValidateRegion(hwndClient, hrgnUpdate, FALSE); 607 608 GpiSetClipRegion(pHps->hps, hrgnUpdate, &hrgnOld); 609 //save old clip region (restored for CS_OWNDC windows in EndPaint) 610 wnd->SetClipRegion(hrgnOld); 611 } 651 HideCaret(hwnd); 652 WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE); 612 653 613 654 if(wnd->needsEraseBkgnd() && lComplexity != RGN_NULL) { … … 631 672 } 632 673 633 HideCaret(hwnd);634 635 674 SetLastError(0); 636 675 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)); … … 657 696 if (pHps && (pHps->hdcType == TYPE_3)) 658 697 { 659 GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnOld);698 removeClientArea(pHps); 660 699 if(hrgnOld) { 700 GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnOld); 661 701 GpiDestroyRegion(pHps->hps, hrgnOld); 662 702 } 663 703 if(hwnd == HWND_DESKTOP || !wnd->isOwnDC()) { 704 pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails 664 705 ReleaseDC(hwnd, pPaint->hdc); 665 706 } … … 671 712 pHps->hdcType = TYPE_1; 672 713 } 673 674 //// WinEndPaint (pHps->hps);675 714 } 676 715 else { … … 679 718 wnd->setEraseBkgnd(TRUE); 680 719 ShowCaret(hwnd); 720 WinShowTrackRect(wnd->getOS2WindowHandle(), TRUE); 681 721 682 722 exit: … … 684 724 return TRUE; 685 725 } 726 //****************************************************************************** 727 //****************************************************************************** 728 int WIN32API GetClipBox( HDC hdc, PRECT lpRect) 729 { 730 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc); 731 RECTL rectl; 732 LONG lComplexity; 733 int rc; 734 735 if(!hdc || !lpRect || !pHps) { 736 dprintf(("GDI32: GetClipBox %x %x ERROR_INVALID_PARAMETER", hdc, lpRect)); 737 SetLastError(ERROR_INVALID_PARAMETER_W); 738 return ERROR_W; 739 } 740 if(pHps->isPrinter) 741 { 742 lpRect->left = 0; 743 lpRect->top = 0; 744 lpRect->right = GetDeviceCaps( hdc, HORZRES_W); 745 lpRect->bottom = GetDeviceCaps( hdc, VERTRES_W); 746 747 rc = SIMPLEREGION_W; 748 } 749 else { 750 lComplexity = GpiQueryClipBox(pHps->hps, &rectl); 751 if(lComplexity == RGN_ERROR) 752 { 753 rc = ERROR_W; 754 } 755 else 756 if(lComplexity == RGN_NULL) 757 { 758 memset(lpRect, 0, sizeof(*lpRect)); 759 rc = NULLREGION_W; 760 } 761 else { 762 lpRect->left = rectl.xLeft; 763 lpRect->right = rectl.xRight; 764 #if 0 765 lpRect->top = pHps->height - rectl.yTop; 766 lpRect->bottom = pHps->height - rectl.yBottom; 767 #else 768 //No conversion required as GpiQueryClipBox is affected by 769 //the y-inversion of the window 770 lpRect->top = rectl.yBottom; 771 lpRect->bottom = rectl.yTop; 686 772 #endif 687 //****************************************************************************** 688 //****************************************************************************** 689 int WIN32API GetClipBox( HDC arg1, PRECT arg2) 773 //Convert including/including to including/excluding 774 if(lpRect->left != lpRect->right) { 775 lpRect->right++; 776 } 777 if(lpRect->top != lpRect->bottom) { 778 lpRect->bottom++; 779 } 780 rc = (lComplexity == RGN_RECT) ? SIMPLEREGION_W : COMPLEXREGION_W; 781 } 782 } 783 dprintf(("GDI32: GetClipBox of %X returned %d\n", hdc, rc)); 784 return rc; 785 } 786 //****************************************************************************** 787 //****************************************************************************** 788 int WIN32API GetClipRgn( HDC hdc, HRGN hRgn) 690 789 { 691 790 int rc; 692 791 693 rc = O32_GetClipBox(arg1, arg2); 694 dprintf(("GDI32: GetClipBox of %X returned %d\n", arg1, rc)); 695 return(rc); 696 } 697 //****************************************************************************** 698 //****************************************************************************** 699 int WIN32API GetClipRgn( HDC hdc, HRGN hRgn) 700 { 701 dprintf(("GDI32: GetClipRgn")); 702 return O32_GetClipRgn(hdc, hRgn); 792 rc = O32_GetClipRgn(hdc, hRgn); 793 dprintf(("GDI32: GetClipRgn %x %x returned %x", hdc, hRgn, rc)); 794 return rc; 703 795 } 704 796 //****************************************************************************** … … 708 800 if (!hwnd) 709 801 { 710 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 711 return FALSE; 802 dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase)); 803 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 804 return FALSE; 712 805 } 713 806 … … 717 810 if (!wnd) 718 811 { 719 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 720 return FALSE; 721 } 812 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 813 dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase)); 814 return FALSE; 815 } 816 817 dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase)); 722 818 723 819 BOOL updateRegionExists = WinQueryUpdateRect (wnd->getOS2WindowHandle(), pRect ? &rectl : NULL); … … 781 877 //****************************************************************************** 782 878 //****************************************************************************** 783 BOOL SYSTEM GetOS2UpdateRect(HWND hwnd,LPRECT pRect)879 BOOL GetOS2UpdateRect(Win32BaseWindow *window, LPRECT pRect) 784 880 { 785 881 RECTL rectl; 786 BOOL updateRegionExists = WinQueryUpdateRect( hwnd,pRect ? &rectl:NULL);882 BOOL updateRegionExists = WinQueryUpdateRect(window->getOS2WindowHandle(),pRect ? &rectl:NULL); 787 883 788 884 if (!pRect) … … 793 889 //CB: for PM empty rect is valid 794 890 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE; 795 mapOS2ToWin32Rect( hwnd,(PRECTLOS2)&rectl,pRect);891 mapOS2ToWin32Rect(window->getWindowHeight(), (PRECTLOS2)&rectl,pRect); 796 892 } 797 893 else … … 836 932 // isOwnDC = wnd->isOwnDC() && wnd->getOwnDC(); 837 933 isOwnDC = wnd->isOwnDC() && (wnd->getOwnDC() == hdc); 838 } 839 if (isOwnDC) 840 rc = TRUE; 841 else 842 rc = O32_ReleaseDC (0, hdc); 934 if(!isOwnDC) 935 { 936 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc); 937 if(pHps && pHps->psType == MICRO_CACHED) { 938 removeClientArea(pHps); 939 if(pHps->hrgnVis) { 940 GreDestroyRegion(pHps->hps, pHps->hrgnVis); 941 pHps->hrgnVis = 0; 942 } 943 } 944 else { 945 dprintf(("ERROR: ReleaseDC: pHps == NULL!!")); 946 DebugInt3(); 947 } 948 } 949 } 950 951 if(isOwnDC) { 952 rc = TRUE; 953 } 954 else { 955 rc = O32_ReleaseDC (0, hdc); 956 } 843 957 844 958 dprintf(("ReleaseDC %x %x", hwnd, hdc)); … … 851 965 // DCX_EXCLUDERGN (complex regions allowed) 852 966 // DCX_INTERSECTRGN (complex regions allowed) 967 // DCX_USESTYLE 968 // DCX_CLIPSIBLINGS 969 // DCX_CLIPCHILDREN 970 // DCX_PARENTCLIP 853 971 // 854 972 //TODO: WM_SETREDRAW affects drawingAllowed flag!! … … 880 998 return 0; 881 999 } 882 //SvL: Experimental change (doesn't work right) 883 #if 0 884 if(wnd->fHasParentDC() && wnd->getParent()) { 885 wnd = wnd->getParent(); 886 } 887 #endif 888 if (flags & DCX_WINDOW_W) 889 hWindow = wnd->getOS2FrameWindowHandle(); 890 else 891 hWindow = wnd->getOS2WindowHandle(); 1000 hWindow = wnd->getOS2WindowHandle(); 892 1001 } 893 1002 894 1003 isWindowOwnDC = (((hWindow == HWND_DESKTOP) ? FALSE : (wnd->isOwnDC())) 895 && !(flags & (DCX_CACHE_W | DCX_WINDOW_W)));896 897 if 1004 && !(flags & DCX_CACHE_W)); 1005 1006 if(isWindowOwnDC) 898 1007 { 899 1008 hps = wnd->getOwnDC(); … … 904 1013 goto error; 905 1014 1015 if(flags & DCX_WINDOW_W) 1016 removeClientArea(pHps); 1017 else 1018 selectClientArea(wnd, pHps, NULL); 1019 906 1020 setPageXForm (wnd, pHps); 907 908 1021 pHps->hdcType = TYPE_1; 1022 909 1023 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps)); 910 1024 return (HDC)hps; … … 914 1028 } 915 1029 916 if 1030 if(isWindowOwnDC) 917 1031 { 918 1032 SIZEL sizel = {0,0}; … … 924 1038 else 925 1039 { 926 if (hWindow == HWND_DESKTOP) 1040 if (hWindow == HWND_DESKTOP) { 927 1041 hps = WinGetScreenPS (hWindow); 928 else 929 hps = WinGetPS (hWindow); 930 1042 } 1043 else { 1044 int clipstyle = 0; 1045 int clipwnd = HWND_TOP; 1046 if(flags & (DCX_USESTYLE_W)) { 1047 int style = wnd->getStyle(); 1048 if(style & WS_CLIPCHILDREN_W) { 1049 clipstyle |= PSF_CLIPCHILDREN; 1050 } 1051 if(style & WS_CLIPSIBLINGS_W) { 1052 clipstyle |= PSF_CLIPSIBLINGS; 1053 } 1054 if(wnd->fHasParentDC()) { 1055 clipstyle |= PSF_PARENTCLIP; 1056 } 1057 } 1058 if(flags & DCX_CLIPSIBLINGS_W) { 1059 clipstyle |= PSF_CLIPSIBLINGS; 1060 } 1061 if(flags & DCX_CLIPCHILDREN_W) { 1062 clipstyle |= PSF_CLIPCHILDREN; 1063 } 1064 if(flags & DCX_PARENTCLIP_W) { 1065 clipstyle |= PSF_PARENTCLIP; 1066 } 1067 if(clipstyle) { 1068 dprintf2(("WinGetClipPS style %x", clipstyle)); 1069 hps = WinGetClipPS(hWindow, clipwnd, clipstyle); 1070 } 1071 else hps = WinGetPS (hWindow); 1072 } 931 1073 psType = MICRO_CACHED; 932 1074 } … … 937 1079 HPSToHDC (hWindow, hps, NULL, NULL); 938 1080 pHps = (pDCData)GpiQueryDCData (hps); 1081 1082 if(!(flags & DCX_WINDOW_W)) 1083 { 1084 selectClientArea(wnd, pHps, NULL); 1085 } 1086 else removeClientArea(pHps); 1087 1088 1089 setMapMode(wnd, pHps, MM_TEXT_W); 939 1090 940 1091 if ((flags & DCX_EXCLUDERGN_W) || (flags & DCX_INTERSECTRGN_W)) … … 1037 1188 { 1038 1189 if (!hwnd) hwnd = GetDesktopWindow(); 1039 return GetDCEx (hwnd, NULL, DCX_ USESTYLE_W | DCX_WINDOW_W);1190 return GetDCEx (hwnd, NULL, DCX_WINDOW_W); 1040 1191 } 1041 1192 //****************************************************************************** … … 1091 1242 //TODO: If frame, exclude client window from update 1092 1243 if(redraw & RDW_FRAME_W) { 1093 hwnd = wnd->getOS2 FrameWindowHandle();1244 hwnd = wnd->getOS2WindowHandle(); 1094 1245 } 1095 1246 else hwnd = wnd->getOS2WindowHandle(); … … 1254 1405 } 1255 1406 //****************************************************************************** 1407 //TODO: Change for client rectangle!!!!! 1256 1408 //****************************************************************************** 1257 1409 BOOL setPMRgnIntoWinRgn (HRGN hrgnPM, HRGN hrgnWin, LONG height) … … 1313 1465 } 1314 1466 //****************************************************************************** 1315 //****************************************************************************** 1316 BOOL WIN32API ScrollDC (HDC hDC, int dx, int dy, const RECT *pScroll, 1317 const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate) 1467 //TODO: Check if this one works correctly... 1468 //****************************************************************************** 1469 BOOL WIN32API ScrollDC(HDC hDC, int dx, int dy, const RECT *pScroll, 1470 const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate) 1318 1471 { 1319 1472 BOOL rc = TRUE; 1320 1473 1321 dprintf (("USER32: ScrollDC"));1474 dprintf (("USER32: ScrollDC %x (%d,%d), %x %x %x %x", hDC, dx, dy, pScroll, pClip, hrgnUpdate, pRectUpdate)); 1322 1475 1323 1476 if (!hDC) … … 1341 1494 dy = (int)(ptl[1].y - ptl[0].y); 1342 1495 1343 RECT LscrollRect;1344 RECT LclipRect;1496 RECT scrollRect; 1497 RECT clipRect; 1345 1498 1346 1499 if (pClip) 1347 1500 { 1348 clipRect.xLeft = min (pClip->left, pClip->right); 1349 clipRect.xRight = max (pClip->left, pClip->right); 1350 clipRect.yTop = max (pClip->top, pClip->bottom); 1351 clipRect.yBottom = min (pClip->top, pClip->bottom); 1501 memcpy(&clipRect, pClip, sizeof(clipRect)); 1352 1502 1353 1503 if ((pHps->graphicsMode == GM_COMPATIBLE_W) && 1354 (clipRect. xLeft != clipRect.xRight) &&1355 (clipRect. yBottom != clipRect.yTop))1504 (clipRect.left != clipRect.right) && 1505 (clipRect.bottom != clipRect.top)) 1356 1506 { 1357 1507 if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx)) 1358 clipRect. xRight -= abs(pHps->worldXDeltaFor1Pixel);1508 clipRect.right -= abs(pHps->worldXDeltaFor1Pixel); 1359 1509 else 1360 clipRect. xLeft += abs(pHps->worldXDeltaFor1Pixel);1510 clipRect.left += abs(pHps->worldXDeltaFor1Pixel); 1361 1511 1362 1512 if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy)) 1363 clipRect. yTop-= abs(pHps->worldYDeltaFor1Pixel);1513 clipRect.bottom -= abs(pHps->worldYDeltaFor1Pixel); 1364 1514 else 1365 clipRect. yBottom+= abs(pHps->worldYDeltaFor1Pixel);1366 } 1367 GpiConvert 1368 if (clipRect. xRight < clipRect.xLeft) {1369 ULONG temp = clipRect.xLeft;1370 clipRect. xLeft = clipRect.xRight;1371 clipRect. xRight = temp;1372 } 1373 if (clipRect. yTop < clipRect.yBottom) {1374 ULONG temp = clipRect. yBottom;1375 clipRect. yBottom = clipRect.yTop;1376 clipRect. yTop= temp;1515 clipRect.top += abs(pHps->worldYDeltaFor1Pixel); 1516 } 1517 GpiConvert(pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&clipRect); 1518 if (clipRect.right < clipRect.left) { 1519 ULONG temp = clipRect.left; 1520 clipRect.left = clipRect.right; 1521 clipRect.right = temp; 1522 } 1523 if (clipRect.bottom < clipRect.top) { 1524 ULONG temp = clipRect.top; 1525 clipRect.top = clipRect.bottom; 1526 clipRect.bottom = temp; 1377 1527 } 1378 1528 } … … 1380 1530 if (pScroll) 1381 1531 { 1382 scrollRect.xLeft = min (pScroll->left, pScroll->right); 1383 scrollRect.xRight = max (pScroll->left, pScroll->right); 1384 scrollRect.yTop = max (pScroll->top, pScroll->bottom); 1385 scrollRect.yBottom = min (pScroll->top, pScroll->bottom); 1532 memcpy(&scrollRect, pScroll, sizeof(scrollRect)); 1386 1533 1387 1534 if ((pHps->graphicsMode == GM_COMPATIBLE_W) && 1388 (scrollRect. xLeft != scrollRect.xRight) &&1389 (scrollRect. yBottom != scrollRect.yTop))1535 (scrollRect.left != scrollRect.right) && 1536 (scrollRect.top != scrollRect.bottom)) 1390 1537 { 1391 1538 if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx)) 1392 scrollRect. xRight -= abs(pHps->worldXDeltaFor1Pixel);1539 scrollRect.right -= abs(pHps->worldXDeltaFor1Pixel); 1393 1540 else 1394 scrollRect. xLeft += abs(pHps->worldXDeltaFor1Pixel);1541 scrollRect.left += abs(pHps->worldXDeltaFor1Pixel); 1395 1542 1396 1543 if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy)) 1397 scrollRect. yTop-= abs(pHps->worldYDeltaFor1Pixel);1544 scrollRect.bottom -= abs(pHps->worldYDeltaFor1Pixel); 1398 1545 else 1399 scrollRect. yBottom+= abs(pHps->worldYDeltaFor1Pixel);1546 scrollRect.top += abs(pHps->worldYDeltaFor1Pixel); 1400 1547 } 1401 1548 GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&scrollRect); 1402 if (scrollRect.xRight < scrollRect.xLeft) { 1403 ULONG temp = scrollRect.xLeft; 1404 scrollRect.xLeft = scrollRect.xRight; 1405 scrollRect.xRight = temp; 1406 } 1407 if (scrollRect.yTop < scrollRect.yBottom) { 1408 ULONG temp = scrollRect.yBottom; 1409 scrollRect.yBottom = scrollRect.yTop; 1410 scrollRect.yTop = temp; 1411 } 1412 } 1413 RECTL rectlUpdate; 1414 HRGN hrgn; 1415 1416 LONG lComplexity = WinScrollWindow (hwnd, dx, dy, (pScroll) ? &scrollRect : NULL, (pClip) ? &clipRect : NULL, hrgn, &rectlUpdate, 0); 1549 if (scrollRect.right < scrollRect.left) { 1550 ULONG temp = scrollRect.left; 1551 scrollRect.left = scrollRect.right; 1552 scrollRect.right = temp; 1553 } 1554 if (scrollRect.bottom < scrollRect.top) { 1555 ULONG temp = scrollRect.top; 1556 scrollRect.top = scrollRect.bottom; 1557 scrollRect.bottom = temp; 1558 } 1559 } 1560 RECTL rectlUpdate; 1561 HRGN hrgn; 1562 RECTL clientRect; 1563 RECTL clipOS2; 1564 RECTL scrollOS2; 1565 PRECTL pScrollOS2 = NULL; 1566 PRECTL pClipOS2 = NULL; 1567 1568 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&clientRect); 1569 1570 if(pScroll) { 1571 mapWin32ToOS2RectClientToFrame(wnd, &scrollRect, (PRECTLOS2)&scrollOS2); 1572 pScrollOS2 = &scrollOS2; 1573 1574 //Scroll rectangle relative to client area 1575 WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect); 1576 } 1577 else { 1578 pScrollOS2 = &clientRect; 1579 } 1580 1581 if(pClip) { 1582 mapWin32ToOS2RectClientToFrame(wnd, &clipRect, (PRECTLOS2)&clipOS2); 1583 pClipOS2 = &clipOS2; 1584 1585 //Clip rectangle relative to client area 1586 WinIntersectRect((HAB) 0, pClipOS2, pClipOS2, &clientRect); 1587 } 1588 else { 1589 pClipOS2 = &clientRect; 1590 } 1591 1592 LONG lComplexity = WinScrollWindow(hwnd, dx, dy, pScrollOS2, 1593 pClipOS2, hrgn, &rectlUpdate, 0); 1417 1594 if (lComplexity == RGN_ERROR) 1418 1595 { … … 1421 1598 1422 1599 RECT winRectUpdate; 1423 LONG height = wnd->getClientHeight(); 1424 1425 winRectUpdate.left = rectlUpdate.xLeft; 1426 winRectUpdate.right = rectlUpdate.xRight; 1427 winRectUpdate.top = height - rectlUpdate.yTop; 1428 winRectUpdate.bottom = height - rectlUpdate.yBottom; 1600 1601 mapOS2ToWin32Rect(wnd->getWindowHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate); 1429 1602 1430 1603 if (pRectUpdate) … … 1432 1605 1433 1606 if (hrgnUpdate) 1434 rc = setPMRgnIntoWinRgn (hrgn, hrgnUpdate, height);1607 rc = setPMRgnIntoWinRgn(hrgn, hrgnUpdate, wnd->getWindowHeight()); 1435 1608 1436 1609 return (rc); … … 1438 1611 //****************************************************************************** 1439 1612 //****************************************************************************** 1440 #if 11441 BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip)1442 {1443 Win32BaseWindow *window;1444 APIRET rc;1445 RECTL clientRect;1446 PRECT pClientRect;1447 RECTL scrollRect;1448 RECTL clipRect;1449 PRECTL pScrollRect = NULL;1450 PRECTL pClipRect = NULL;1451 ULONG scrollFlags = SW_INVALIDATERGN;1452 1453 window = Win32BaseWindow::GetWindowFromHandle(hwnd);1454 if(!window) {1455 dprintf(("ScrollWindow, window %x not found", hwnd));1456 return 0;1457 }1458 dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip));1459 1460 pClientRect = window->getClientRectPtr();1461 clientRect.xLeft = 0;1462 clientRect.yBottom = 0;1463 clientRect.xRight = pClientRect->right - pClientRect->left;1464 clientRect.yTop = pClientRect->bottom - pClientRect->top;1465 1466 if(pScroll) {1467 mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect);1468 pScrollRect = &scrollRect;1469 1470 //Scroll rectangle relative to client area1471 WinIntersectRect ((HAB) 0, pScrollRect, pScrollRect, &clientRect);1472 }1473 else scrollFlags |= SW_SCROLLCHILDREN;1474 1475 if(pClip) {1476 mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect);1477 pClipRect = &clipRect;1478 1479 //Clip rectangle relative to client area1480 WinIntersectRect ((HAB) 0, pClipRect, pClipRect, &clientRect);1481 }1482 1483 dy = revertDy (window, dy);1484 1485 rc = WinScrollWindow(window->getOS2WindowHandle(), dx, dy,1486 pScrollRect, pClipRect, NULLHANDLE,1487 NULL, scrollFlags);1488 1489 return (rc != RGN_ERROR);1490 }1491 #else1492 1613 BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip) 1493 1614 { … … 1497 1618 RECTL scrollRect; 1498 1619 RECTL clipRect; 1499 PRECTL pScroll Rect= NULL;1500 PRECTL pClip Rect= NULL;1620 PRECTL pScrollOS2 = NULL; 1621 PRECTL pClipOS2 = NULL; 1501 1622 ULONG scrollFlags = SW_INVALIDATERGN; 1502 1623 … … 1507 1628 } 1508 1629 dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip)); 1509 mapWin32ToOS2Rect(window,window->getClientRectPtr(),(PRECTLOS2)&clientRect); 1510 #if 0 1511 //Rectangle could be relative to parent window, so fix this 1512 if(clientRect.yBottom != 0) { 1513 clientRect.yTop -= clientRect.yBottom; 1514 clientRect.yBottom = 0; 1515 } 1516 if(clientRect.xLeft != 0) { 1517 clientRect.xRight -= clientRect.xLeft; 1518 clientRect.xLeft = 0; 1519 } 1520 #endif 1630 1631 mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect); 1632 1521 1633 if(pScroll) { 1522 mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect); 1523 pScrollRect = &scrollRect; 1524 1525 //Scroll rectangle relative to client area 1526 pScrollRect->xLeft += clientRect.xLeft; 1527 pScrollRect->xRight += clientRect.xLeft; 1528 pScrollRect->yTop += clientRect.yBottom; 1529 pScrollRect->yBottom += clientRect.yBottom; 1530 WinIntersectRect ((HAB) 0, pScrollRect, pScrollRect, &clientRect); 1531 } 1532 else scrollFlags |= SW_SCROLLCHILDREN; 1634 mapWin32ToOS2RectClientToFrame(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect); 1635 pScrollOS2 = &scrollRect; 1636 1637 //Scroll rectangle relative to client area 1638 WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect); 1639 } 1640 else { 1641 pScrollOS2 = &clientRect; 1642 scrollFlags |= SW_SCROLLCHILDREN; 1643 } 1533 1644 1534 1645 if(pClip) { 1535 mapWin32ToOS2Rect (window,(RECT *)pClip, (PRECTLOS2)&clipRect);1536 pClip Rect= &clipRect;1646 mapWin32ToOS2RectClientToFrame(window,(RECT *)pClip, (PRECTLOS2)&clipRect); 1647 pClipOS2 = &clipRect; 1537 1648 1538 1649 //Clip rectangle relative to client area 1539 pClipRect->xLeft += clientRect.xLeft; 1540 pClipRect->xRight += clientRect.xLeft; 1541 pClipRect->yTop += clientRect.yBottom; 1542 pClipRect->yBottom += clientRect.yBottom; 1543 WinIntersectRect ((HAB) 0, pClipRect, pClipRect, &clientRect); 1650 WinIntersectRect ((HAB) 0, pClipOS2, pClipOS2, &clientRect); 1651 } 1652 else { 1653 pClipOS2 = &clientRect; 1544 1654 } 1545 1655 … … 1547 1657 1548 1658 rc = WinScrollWindow(window->getOS2WindowHandle(), dx, dy, 1549 pScroll Rect, pClipRect, NULLHANDLE,1659 pScrollOS2, pClipOS2, NULLHANDLE, 1550 1660 NULL, scrollFlags); 1551 1661 1552 1662 return (rc != RGN_ERROR); 1553 1663 } 1554 #endif1555 1664 //****************************************************************************** 1556 1665 //****************************************************************************** … … 1558 1667 HRGN hrgnUpdate, PRECT pRectUpdate, UINT scrollFlag) 1559 1668 { 1560 Win32BaseWindow *window; 1561 APIRET rc; 1562 RECTL scrollRect; 1563 RECTL clipRect; 1564 ULONG scrollFlags = 0; 1565 int regionType = ERROR_W; 1669 Win32BaseWindow *window; 1670 APIRET rc; 1671 RECTL clientRect; 1672 RECTL scrollRect; 1673 RECTL clipRect; 1674 PRECTL pScrollOS2 = NULL; 1675 PRECTL pClipOS2 = NULL; 1676 ULONG scrollFlags = 0; 1677 int regionType = ERROR_W; 1566 1678 1567 1679 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 1578 1690 if (scrollFlag & SW_SCROLLCHILDREN_W) scrollFlags |= SW_SCROLLCHILDREN; 1579 1691 1580 if(pScroll) mapWin32ToOS2Rect(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect); 1581 if(pClip) mapWin32ToOS2Rect(window,(RECT *)pClip, (PRECTLOS2)&clipRect); 1692 mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect); 1693 1694 if(pScroll) { 1695 mapWin32ToOS2RectClientToFrame(window,(RECT *)pScroll, (PRECTLOS2)&scrollRect); 1696 pScrollOS2 = &scrollRect; 1697 1698 //Scroll rectangle relative to client area 1699 WinIntersectRect ((HAB) 0, pScrollOS2, pScrollOS2, &clientRect); 1700 } 1701 else { 1702 pScrollOS2 = &clientRect; 1703 scrollFlags |= SW_SCROLLCHILDREN; //TODO: ????? 1704 } 1705 1706 if(pClip) { 1707 mapWin32ToOS2RectClientToFrame(window,(RECT *)pClip, (PRECTLOS2)&clipRect); 1708 pClipOS2 = &clipRect; 1709 1710 //Clip rectangle relative to client area 1711 WinIntersectRect ((HAB) 0, pClipOS2, pClipOS2, &clientRect); 1712 } 1713 else { 1714 pClipOS2 = &clientRect; 1715 } 1582 1716 1583 1717 RECTL rectlUpdate; … … 1593 1727 1594 1728 LONG lComplexity = WinScrollWindow (window->getOS2WindowHandle(), dx, dy, 1595 (pScroll) ? &scrollRect : NULL,1596 (pClip) ? &clipRect : NULL,1729 pScrollOS2, 1730 pClipOS2, 1597 1731 hrgn, &rectlUpdate, scrollFlags); 1598 1732 if (lComplexity == RGN_ERROR) … … 1602 1736 1603 1737 RECT winRectUpdate; 1604 LONG height = window->getClientHeight(); 1605 1606 winRectUpdate.left = rectlUpdate.xLeft; 1607 winRectUpdate.right = rectlUpdate.xRight; 1608 winRectUpdate.top = height - rectlUpdate.yTop; 1609 winRectUpdate.bottom = height - rectlUpdate.yBottom; 1738 1739 mapOS2ToWin32Rect(window->getWindowHeight(), (PRECTLOS2)&rectlUpdate, &winRectUpdate); 1610 1740 1611 1741 if (pRectUpdate) … … 1613 1743 1614 1744 if (hrgnUpdate) 1615 rc = setPMRgnIntoWinRgn (hrgn, hrgnUpdate, height); 1616 1745 rc = setPMRgnIntoWinRgn (hrgn, hrgnUpdate, window->getWindowHeight()); 1746 1747 #if 0 1617 1748 //SvL: WinScrollWindow already invalidates the area; no need to do it again 1618 1749 //(call to invalidateRect was wrong; has to include erase flag) 1619 #if 01620 1750 if ((scrollFlag & SW_INVALIDATE_W) && 1621 1751 ((lComplexity == RGN_RECT) || (lComplexity == RGN_COMPLEX))) -
trunk/src/user32/dc.h
r3641 r3662 1 /* $Id: dc.h,v 1.1 2 2000-06-01 11:27:57sandervl Exp $ */1 /* $Id: dc.h,v 1.13 2000-06-07 14:51:25 sandervl Exp $ */ 2 2 /* 3 3 * public dc functions … … 17 17 extern void releaseOwnDC (HDC hps); 18 18 19 BOOL GetOS2UpdateRect(Win32BaseWindow *window,LPRECT pRect); 19 20 20 21 #ifdef INCLUDED_BY_DC … … 168 169 } 169 170 170 //LONG APIENTRY GpiQueryYInversion (HPS hps); 171 LONG APIENTRY _GpiQueryYInversion(ULONG hps); 172 173 inline LONG GpiQueryYInversion(ULONG hps) 174 { 175 LONG yyrc; 176 USHORT sel = RestoreOS2FS(); 177 178 yyrc = _GpiQueryYInversion(hps); 179 SetFS(sel); 180 181 return yyrc; 182 } 171 183 172 184 PVOID APIENTRY _GpiAllocateDCData (HPS GpiH, ULONG size); … … 446 458 447 459 yyrc = _O32_GetClipRgn(a, b); 448 SetFS(sel);449 450 return yyrc;451 }452 453 int OPEN32API _O32_GetClipBox( HDC, PRECT );454 455 inline int O32_GetClipBox(HDC a, PRECT b)456 {457 int yyrc;458 USHORT sel = RestoreOS2FS();459 460 yyrc = _O32_GetClipBox(a, b);461 460 SetFS(sel); 462 461 … … 554 553 #define GreCombineRegion(a,b,c,d,e) (INT) _Gre32Entry7((ULONG)(HDC)(a),(ULONG)(HRGN)(b),(ULONG)(HRGN)(c),(ULONG)(HRGN)(d),(ULONG)(ULONG)(e),0L,0x00004065L) 555 554 #define GreDestroyRegion(a,b) (BOOL) _Gre32Entry4((ULONG)(HDC)(a),(ULONG)(HRGN)(b),0L,0x00004063L) 555 #define GreGetDCOrigin(a,b) (BOOL) _Gre32Entry4((ULONG)(HDC)(a),(ULONG)(PPOINTL)(b),0L,0x000040BAL) 556 #define GreDeviceSetDCOrigin(a,b) (BOOL) _Gre32Entry4((ULONG)(HDC)(a),(ULONG)(PPOINTL)(b),0L,0x000040BBL) 557 #define GreSelectClipRegion(a,b,c) (INT) _Gre32Entry5((ULONG)(HDC)(a),(ULONG)(HRGN)(b),(ULONG)(PHRGN)(c),0L,0x00004074L) 558 #define GreIntersectClipRectangle(a,b) (INT) _Gre32Entry4((ULONG)(HDC)(a),(ULONG)(PRECTL)(b),0L,0x00004075L) 556 559 557 560 #endif //INCLUDED_BY_DC -
trunk/src/user32/oslibgdi.cpp
r3101 r3662 1 /* $Id: oslibgdi.cpp,v 1.1 1 2000-03-13 13:10:45sandervl Exp $ */1 /* $Id: oslibgdi.cpp,v 1.12 2000-06-07 14:51:26 sandervl Exp $ */ 2 2 /* 3 3 * Window GDI wrapper functions for OS/2 … … 30 30 Single y mapping: 31 31 mapScreenY() 32 mapY() 33 mapOS2ToWin32Y() 34 mapWin32ToOS2Y() 35 mapWin32Y() 32 mapY() //only reverses y 33 mapOS2ToWin32Y() //reverse y + subtract parent client offset 34 mapOS2ToWin32X() //subtract parent client offset 35 36 mapWin32ToOS2Y() //reverse y + add parent client offset 37 mapWin32ToOS2Y() //add parent client offset 36 38 37 39 Single point mapping: 38 40 mapScreenPoint() 39 mapPoint()40 41 mapOS2ToWin32Point() 41 42 mapWin32ToOS2Point() … … 52 53 copyOS2ToWin32Rect() 53 54 copyWin32ToOS2Rect() 54 55 Child origin:56 mapOS2ToWin32ChildOrigin()57 55 */ 58 56 … … 70 68 { 71 69 return screenH-1-screenPosY; 72 }73 //******************************************************************************74 // To translation between OS/2 <-> Win3275 //******************************************************************************76 INT mapY(HWND os2Client,INT clientPosY)77 {78 RECTL rect;79 80 if (os2Client == OSLIB_HWND_DESKTOP) os2Client = HWND_DESKTOP; //client shouldn't be desktop81 if (!WinQueryWindowRect(os2Client,&rect)) return 0;82 83 return rect.yTop-1-clientPosY;84 }85 //******************************************************************************86 // To translation between OS/2 <-> Win3287 //******************************************************************************88 INT mapY(Win32BaseWindow *win32wnd,INT clientPosY)89 {90 if (!win32wnd) return 0;91 92 return win32wnd->getClientHeight()-1-clientPosY;93 }94 //******************************************************************************95 //******************************************************************************96 INT mapOS2ToWin32Y(HWND os2From,HWND os2To,INT fromPosY)97 {98 POINTL pt;99 RECTL rect;100 101 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP;102 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP;103 if (os2From != os2To)104 {105 pt.x = 0;106 pt.y = fromPosY;107 if (!WinMapWindowPoints(os2From,os2To,&pt,1)) return 0;108 } else pt.y = fromPosY;109 if (!WinQueryWindowRect(os2To,&rect)) return 0;110 111 return rect.yTop-1-pt.y;112 }113 //******************************************************************************114 //******************************************************************************115 INT mapOS2ToWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY)116 {117 POINTL pt;118 119 if (!wndFrom || !wndTo) return 0;120 if (wndFrom != wndTo)121 {122 pt.x = 0;123 pt.y = fromPosY;124 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),&pt,1)) return 0;125 } else pt.y = fromPosY;126 127 return wndTo->getClientHeight()-1-pt.y;128 }129 //******************************************************************************130 //******************************************************************************131 INT mapWin32Y(HWND os2From,HWND os2To,INT fromPosY)132 {133 POINTL pt;134 RECTL rect;135 136 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP;137 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP;138 if (os2From == os2To) return fromPosY;139 if (!WinQueryWindowRect(os2From,&rect)) return 0;140 pt.y = rect.yTop-1-fromPosY;141 pt.x = 0;142 if (!WinMapWindowPoints(os2From,os2To,&pt,1)) return 0;143 if (!WinQueryWindowRect(os2To,&rect)) return 0;144 145 return rect.yTop-1-pt.y;146 }147 //******************************************************************************148 //******************************************************************************149 INT mapWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY)150 {151 POINTL pt;152 153 if (!wndFrom || !wndTo) return 0;154 if (wndFrom == wndTo) return fromPosY;155 pt.y = wndFrom->getClientHeight()-1-fromPosY;156 pt.x = 0;157 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),&pt,1)) return 0;158 159 return wndTo->getClientHeight()-1-pt.y;160 70 } 161 71 //****************************************************************************** … … 182 92 // To translation between OS/2 <-> Win32 183 93 //****************************************************************************** 184 BOOL map Point(HWND os2Client,OSLIBPOINT *clientPt)94 BOOL mapOS2ToWin32Rect(int height, PRECTLOS2 rectOS2, PRECT rectWin32) 185 95 { 186 RECTL rect; 187 188 if (!clientPt) return FALSE; 189 if (os2Client == OSLIB_HWND_DESKTOP) os2Client = HWND_DESKTOP; //client shouldn't be desktop 190 if (!WinQueryWindowRect(os2Client,&rect)) return 0; 191 clientPt->y = rect.yTop-1-clientPt->y; 192 193 return TRUE; 194 } 195 //****************************************************************************** 196 // To translation between OS/2 <-> Win32 197 //****************************************************************************** 198 BOOL mapPoint(Win32BaseWindow *win32wnd,OSLIBPOINT *clientPt) 199 { 200 if (!win32wnd || !clientPt) return FALSE; 201 clientPt->y = win32wnd->getClientHeight()-1-clientPt->y; 202 203 return TRUE; 204 } 205 //****************************************************************************** 206 //****************************************************************************** 207 BOOL mapOS2ToWin32Point(HWND os2From,HWND os2To,OSLIBPOINT *fromPt) 208 { 209 RECTL rect; 210 211 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 212 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 213 if (os2From != os2To) 214 { 215 if (!WinMapWindowPoints(os2From,os2To,(PPOINTL)fromPt,1)) return FALSE; 96 if(!rectOS2 || !rectWin32) { 97 DebugInt3(); 98 return FALSE; 216 99 } 217 if (!WinQueryWindowRect(os2To,&rect)) return FALSE; 218 fromPt->y = rect.yTop-1-fromPt->y; 219 220 return TRUE; 221 } 222 //****************************************************************************** 223 //****************************************************************************** 224 BOOL mapOS2ToWin32Point(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,OSLIBPOINT *fromPt) 225 { 226 if (!wndFrom || !wndTo) return 0; 227 if (wndFrom != wndTo) 228 { 229 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),(PPOINTL)fromPt,1)) return FALSE; 230 } 231 fromPt->y = wndTo->getClientHeight()-1-fromPt->y; 232 233 return TRUE; 234 } 235 //****************************************************************************** 236 //****************************************************************************** 237 BOOL mapWin32Point(HWND os2From,HWND os2To,OSLIBPOINT *fromPt) 238 { 239 RECTL rect; 240 241 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 242 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 243 if (os2From == os2To) return TRUE; 244 if (!WinQueryWindowRect(os2From,&rect)) return 0; 245 fromPt->y = rect.yTop-1-fromPt->y; 246 if (!WinMapWindowPoints(os2From,os2To,(PPOINTL)fromPt,1)) return 0; 247 if (!WinQueryWindowRect(os2To,&rect)) return 0; 248 fromPt->y = rect.yTop-1-fromPt->y; 249 250 return TRUE; 251 } 252 //****************************************************************************** 253 //****************************************************************************** 254 BOOL mapWin32Point(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,OSLIBPOINT *fromPt) 255 { 256 if (!wndFrom || !wndTo) return FALSE; 257 if (wndFrom == wndTo) return TRUE; 258 fromPt->y = wndFrom->getClientHeight()-1-fromPt->y; 259 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),(PPOINTL)fromPt,1)) return 0; 260 fromPt->y = wndTo->getClientHeight()-1-fromPt->y; 261 262 return TRUE; 263 } 264 //****************************************************************************** 265 //****************************************************************************** 266 BOOL mapOS2ToWin32ScreenRect(PRECTLOS2 rectOS2,PRECT rectWin32) 267 { 268 if (!rectOS2 || !rectWin32) return FALSE; 269 rectWin32->bottom = ScreenHeight-rectOS2->yBottom; 270 rectWin32->top = ScreenHeight-rectOS2->yTop; 100 rectWin32->bottom = height-rectOS2->yBottom; 101 rectWin32->top = height-rectOS2->yTop; 271 102 rectWin32->left = rectOS2->xLeft; 272 103 rectWin32->right = rectOS2->xRight; … … 276 107 //****************************************************************************** 277 108 //****************************************************************************** 278 BOOL mapWin32ToOS2 ScreenRect(PRECT rectWin32,PRECTLOS2 rectOS2)109 BOOL mapWin32ToOS2Rect(int height, PRECT rectWin32, PRECTLOS2 rectOS2) 279 110 { 280 if (!rectOS2 || !rectWin32) return FALSE; 281 rectOS2->yBottom = ScreenHeight-rectWin32->bottom; 282 rectOS2->yTop = ScreenHeight-rectWin32->top; 111 if(!rectOS2 || !rectWin32) { 112 DebugInt3(); 113 return FALSE; 114 } 115 rectOS2->yBottom = height-rectWin32->bottom; 116 rectOS2->yTop = height-rectWin32->top; 283 117 rectOS2->xLeft = rectWin32->left; 284 118 rectOS2->xRight = rectWin32->right; … … 288 122 //****************************************************************************** 289 123 //****************************************************************************** 290 BOOL map OS2ToWin32Rect(HWND os2Client,PRECTLOS2 rectOS2,PRECT rectWin32)124 BOOL mapWin32ToOS2RectClientToFrame(Win32BaseWindow *window, PRECT rectWin32,PRECTLOS2 rectOS2) 291 125 { 292 RECTL rect; 126 int height; 127 int xclientorg; 128 int yclientorg; 293 129 294 if (!rectOS2 || !rectWin32) return FALSE;295 if (os2Client == OSLIB_HWND_DESKTOP) os2Client = HWND_DESKTOP; //shouldn't be the case 296 if (!WinQueryWindowRect(os2Client,&rect))return FALSE;297 rectWin32->bottom = rect.yTop-rectOS2->yBottom;298 rectWin32->top = rect.yTop-rectOS2->yTop;299 rectWin32->left = rectOS2->xLeft;300 rectWin32->right = rectOS2->xRight;130 if(!window || !rectOS2 || !rectWin32) { 131 DebugInt3(); 132 return FALSE; 133 } 134 height = window->getWindowHeight(); 135 xclientorg = window->getClientRectPtr()->left; 136 yclientorg = window->getClientRectPtr()->top; 301 137 302 return TRUE; 303 } 304 //****************************************************************************** 305 //****************************************************************************** 306 BOOL mapOS2ToWin32Rect(Win32BaseWindow *win32wnd,PRECTLOS2 rectOS2,PRECT rectWin32) 307 { 308 INT windowH; 309 310 if (!win32wnd || !rectOS2 || !rectWin32) return FALSE; 311 windowH = win32wnd->getClientHeight(); 312 rectWin32->bottom = windowH-rectOS2->yBottom; 313 rectWin32->top = windowH-rectOS2->yTop; 314 rectWin32->left = rectOS2->xLeft; 315 rectWin32->right = rectOS2->xRight; 316 317 return TRUE; 318 } 319 //****************************************************************************** 320 //****************************************************************************** 321 BOOL mapOS2ToWin32Rect(HWND os2From,HWND os2To,PRECTLOS2 rectOS2,PRECT rectWin32) 322 { 323 RECTL rect,temp; 324 325 if (!rectOS2 || !rectWin32) return FALSE; 326 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 327 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 328 temp = *((PRECTL)rectOS2); 329 if (os2From != os2To) 330 { 331 if (!WinMapWindowPoints(os2From,os2To,(PPOINTL)&temp,2)) return FALSE; 332 } 333 if (!WinQueryWindowRect(os2To,&rect)) return FALSE; 334 rectWin32->bottom = rect.yTop-temp.yBottom; 335 rectWin32->top = rect.yTop-temp.yTop; 336 rectWin32->left = temp.xLeft; 337 rectWin32->right = temp.xRight; 338 339 return TRUE; 340 } 341 //****************************************************************************** 342 //****************************************************************************** 343 BOOL mapOS2ToWin32Rect(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,PRECTLOS2 rectOS2,PRECT rectWin32) 344 { 345 RECTL temp; 346 INT windowH; 347 348 if (!wndFrom || !wndTo || !rectOS2 || !rectWin32) return FALSE; 349 temp = *((PRECTL)rectOS2); 350 if (wndFrom != wndTo) 351 { 352 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),(PPOINTL)&temp,2)) return FALSE; 353 } 354 windowH = wndTo->getClientHeight(); 355 rectWin32->bottom = windowH-temp.yBottom; 356 rectWin32->top = windowH-temp.yTop; 357 rectWin32->left = temp.xLeft; 358 rectWin32->right = temp.xRight; 359 360 return TRUE; 361 } 362 //****************************************************************************** 363 //****************************************************************************** 364 BOOL mapWin32ToOS2Rect(HWND os2Client,PRECT rectWin32,PRECTLOS2 rectOS2) 365 { 366 RECTL rect; 367 368 if (!rectOS2 || !rectWin32) return FALSE; 369 if (os2Client == OSLIB_HWND_DESKTOP) os2Client = HWND_DESKTOP; //shouldn't be the case 370 if (!WinQueryWindowRect(os2Client,&rect)) return FALSE; 371 rectOS2->yBottom = rect.yTop-rectWin32->bottom; 372 rectOS2->yTop = rect.yTop-rectWin32->top; 373 rectOS2->xLeft = rectWin32->left; 374 rectOS2->xRight = rectWin32->right; 375 376 return TRUE; 377 } 378 //****************************************************************************** 379 //****************************************************************************** 380 BOOL mapWin32ToOS2Rect(Win32BaseWindow *win32wnd,PRECT rectWin32,PRECTLOS2 rectOS2) 381 { 382 INT windowH; 383 384 if (!win32wnd || !rectOS2 || !rectWin32) return FALSE; 385 windowH = win32wnd->getClientHeight(); 386 rectOS2->yBottom = windowH-rectWin32->bottom; 387 rectOS2->yTop = windowH-rectWin32->top; 388 rectOS2->xLeft = rectWin32->left; 389 rectOS2->xRight = rectWin32->right; 390 391 return TRUE; 392 } 393 //****************************************************************************** 394 //****************************************************************************** 395 BOOL mapWin32ToOS2Rect(HWND os2From,HWND os2To,PRECT rectWin32,PRECTLOS2 rectOS2) 396 { 397 RECTL rect; 398 399 if (!rectOS2 || !rectWin32) return FALSE; 400 if (os2From == OSLIB_HWND_DESKTOP) os2From = HWND_DESKTOP; 401 if (os2To == OSLIB_HWND_DESKTOP) os2To = HWND_DESKTOP; 402 if (!WinQueryWindowRect(os2From,&rect)) return FALSE; 403 rectOS2->yBottom = rect.yTop-rectWin32->bottom; 404 rectOS2->yTop = rect.yTop-rectWin32->top; 405 rectOS2->xLeft = rectWin32->left; 406 rectOS2->xRight = rectWin32->right; 407 if (os2From != os2To) 408 { 409 if (!WinMapWindowPoints(os2From,os2To,(PPOINTL)rectOS2,2)) return FALSE; 410 } 411 412 return TRUE; 413 } 414 //****************************************************************************** 415 //****************************************************************************** 416 BOOL mapWin32ToOS2Rect(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,PRECT rectWin32,PRECTLOS2 rectOS2) 417 { 418 INT windowH; 419 420 if (!wndFrom || !wndTo || !rectOS2 || !rectWin32) return FALSE; 421 windowH = wndFrom->getClientHeight(); 422 rectOS2->yBottom = windowH-rectWin32->bottom; 423 rectOS2->yTop = windowH-rectWin32->top; 424 rectOS2->xLeft = rectWin32->left; 425 rectOS2->xRight = rectWin32->right; 426 if (wndFrom != wndTo) 427 { 428 if (!WinMapWindowPoints(wndFrom->getOS2WindowHandle(),wndTo->getOS2WindowHandle(),(PPOINTL)rectOS2,2)) return FALSE; 429 } 430 431 return TRUE; 432 } 433 //****************************************************************************** 434 //****************************************************************************** 435 BOOL mapWin32Rect(HWND os2From,HWND os2To,PRECT rectWin32) 436 { 437 RECTL rect; 438 439 mapWin32ToOS2Rect(os2From,rectWin32,(PRECTLOS2)&rect); 440 WinMapWindowPoints((os2From == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP:os2From,(os2To == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP:os2To,(PPOINTL)&rect,2); 441 mapOS2ToWin32Rect(os2To,(PRECTLOS2)&rect,rectWin32); 138 rectOS2->yBottom = height - (rectWin32->bottom + yclientorg); 139 rectOS2->yTop = height - (rectWin32->top + yclientorg); 140 rectOS2->xLeft = rectWin32->left - xclientorg; 141 rectOS2->xRight = rectWin32->right - xclientorg; 442 142 443 143 return TRUE; … … 467 167 //****************************************************************************** 468 168 //****************************************************************************** 469 INT mapOS2ToWin32ChildOrigin(INT parentH,INT parentPosY,INT childH)470 {471 return parentH-parentPosY-childH;//Does: parentH-1-parentPosY-(childH-1)472 }473 //******************************************************************************474 //******************************************************************************475 HDC OSLibWinBeginPaint(HWND hwnd, RECT *rectWin32)476 {477 RECTL rectl;478 479 if(WinQueryUpdateRect(hwnd, &rectl) == FALSE)480 {481 dprintf(("BeginPaint, NO update rectl"));482 return 0;483 }484 mapOS2ToWin32Rect(hwnd,(RECTLOS2 *)&rectl, rectWin32);485 return WinBeginPaint(hwnd, NULLHANDLE, &rectl);486 }487 //******************************************************************************488 //******************************************************************************489 BOOL OSLibWinEndPaint(HDC hdc)490 {491 return WinEndPaint((HPS)hdc);492 }493 //******************************************************************************494 //******************************************************************************495 HDC OSLibWinGetPS(HWND hwnd)496 {497 if(hwnd == OSLIB_HWND_DESKTOP)498 hwnd = HWND_DESKTOP;499 500 return (HDC)WinGetPS(hwnd);501 }502 //******************************************************************************503 //******************************************************************************504 BOOL OSLibWinReleasePS(HDC hdc)505 {506 return WinReleasePS((HPS)hdc);507 }508 //******************************************************************************509 //******************************************************************************510 BOOL OSLibWinInvalidateRect(HWND hwnd, PRECT pRect, BOOL fIncludeChildren)511 {512 RECTLOS2 rectl;513 514 if(pRect) {515 mapWin32ToOS2Rect(hwnd,pRect, &rectl);516 return WinInvalidateRect(hwnd, (PRECTL)&rectl, fIncludeChildren);517 }518 return WinInvalidateRect(hwnd, NULL, fIncludeChildren);519 }520 //******************************************************************************521 //Returns rectangle in Win32 window coordinates522 //******************************************************************************523 BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect)524 {525 BOOL rc;526 RECTLOS2 rectl;527 528 rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);529 if(rc) {530 mapOS2ToWin32Rect(hwnd,&rectl, pRect);531 }532 else memset(pRect, 0, sizeof(RECT));533 return rc;534 }535 //******************************************************************************536 //******************************************************************************537 -
trunk/src/user32/oslibgdi.h
r2469 r3662 1 /* $Id: oslibgdi.h,v 1. 5 2000-01-18 20:08:10sandervl Exp $ */1 /* $Id: oslibgdi.h,v 1.6 2000-06-07 14:51:26 sandervl Exp $ */ 2 2 /* 3 3 * Window GDI wrapper functions for OS/2 … … 32 32 } OSLIBPOINT; 33 33 34 HDC OSLibWinBeginPaint(HWND hwnd, RECT *pRectl);35 BOOL OSLibWinEndPaint(HDC hdc);36 37 HDC OSLibWinGetPS(HWND hwnd);38 BOOL OSLibWinReleasePS(HDC hdc);39 40 BOOL OSLibWinInvalidateRect(HWND hwnd, PRECT pRect, BOOL fIncludeChildren); //must be RECTL pointer!41 BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect);42 43 34 //Mapping functions 44 35 45 36 INT mapScreenY(INT screenPosY); 46 37 INT mapScreenY(INT screenH,INT screenPosY); 47 INT mapY(HWND os2Client,INT clientPosY); 48 INT mapY(Win32BaseWindow *win32wnd,INT clientPosY); 49 INT mapOS2ToWin32Y(HWND os2From,HWND os2To,INT fromPosY); 38 INT inline mapY(INT height, int y) 39 { 40 return height - 1 - y; 41 } 42 43 INT inline mapY(Win32BaseWindow *win32wnd,INT y) 44 { 45 return win32wnd->getWindowHeight() - 1 - y; 46 } 47 48 INT inline mapOS2ToWin32Y(Win32BaseWindow *win32wnd,INT y) 49 { 50 return win32wnd->getWindowHeight() - 1 - (y + win32wnd->getClientRectPtr()->top); 51 } 52 53 INT inline mapOS2ToWin32X(Win32BaseWindow *win32wnd,INT x) 54 { 55 return x - win32wnd->getClientRectPtr()->left; 56 } 57 58 INT inline mapWin32ToOS2Y(Win32BaseWindow *win32wnd,INT y) 59 { 60 if(win32wnd->getParent()) { 61 return win32wnd->getWindowHeight() - 1 - (y - win32wnd->getParent()->getClientRectPtr()->top); 62 } 63 else return y; 64 } 65 66 INT inline mapWin32ToOS2X(Win32BaseWindow *win32wnd,INT x) 67 { 68 if(win32wnd->getParent()) { 69 return x + win32wnd->getParent()->getClientRectPtr()->left; 70 } 71 else return x; 72 } 73 50 74 INT mapOS2ToWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY); 51 INT mapWin32Y(HWND os2From,HWND os2To,INT fromPosY);52 75 INT mapWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY); 53 76 BOOL mapScreenPoint(OSLIBPOINT *screenPt); 54 77 BOOL mapScreenPoint(INT screenH,OSLIBPOINT *screenPt); 55 BOOL mapPoint(HWND os2Client,OSLIBPOINT *clientPt); 56 BOOL mapPoint(Win32BaseWindow *win32wnd,OSLIBPOINT *clientPt); 57 BOOL mapOS2ToWin32Point(HWND os2From,HWND os2To,OSLIBPOINT *fromPt); 58 BOOL mapOS2ToWin32Point(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,OSLIBPOINT *fromPt); 59 BOOL mapWin32Point(HWND os2From,HWND os2To,OSLIBPOINT *fromPt); 60 BOOL mapWin32Point(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,OSLIBPOINT *fromPt); 61 BOOL mapOS2ToWin32ScreenRect(PRECTLOS2 rectOS2,PRECT rectWin32); 62 BOOL mapWin32ToOS2ScreenRect(PRECT rectWin32,PRECTLOS2 rectOS2); 63 BOOL mapOS2ToWin32Rect(HWND os2Client,PRECTLOS2 rectOS2,PRECT rectWin32); 64 BOOL mapOS2ToWin32Rect(Win32BaseWindow *win32wnd,PRECTLOS2 rectOS2,PRECT rectWin32); 65 BOOL mapOS2ToWin32Rect(HWND os2From,HWND os2To,PRECTLOS2 rectOS2,PRECT rectWin32); 66 BOOL mapOS2ToWin32Rect(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,PRECTLOS2 rectOS2,PRECT rectWin32); 67 BOOL mapWin32ToOS2Rect(HWND os2Client,PRECT rectWin32,PRECTLOS2 rectOS2); 68 BOOL mapWin32ToOS2Rect(Win32BaseWindow *win32wnd,PRECT rectWin32,PRECTLOS2 rectOS2); 69 BOOL mapWin32ToOS2Rect(HWND os2From,HWND os2To,PRECT rectWin32,PRECTLOS2 rectOS2); 70 BOOL mapWin32ToOS2Rect(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,PRECT rectWin32,PRECTLOS2 rectOS2); 71 BOOL mapWin32Rect(HWND os2From,HWND os2To,PRECT rectWin32); 78 79 BOOL mapOS2ToWin32Rect(int height, PRECTLOS2 rectOS2, PRECT rectWin32); 80 BOOL mapWin32ToOS2Rect(int height, PRECT rectWin32,PRECTLOS2 rectOS2); 81 82 BOOL mapWin32ToOS2RectClientToFrame(Win32BaseWindow *window, PRECT rectWin32,PRECTLOS2 rectOS2); 83 84 #define mapWin32ToOS2RectFrame(window, rectWin32, rectOS2) \ 85 if(window->getParent()) { \ 86 mapWin32ToOS2Rect(window->getParent()->getWindowHeight(), rectWin32, rectOS2); \ 87 } \ 88 else mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectWin32, rectOS2); 89 90 #define mapWin32ToOS2RectClient(window, rectWin32, rectOS2) \ 91 mapWin32ToOS2Rect(window->getClientHeight(), rectWin32, rectOS2) 92 93 #define mapWin32ToOS2ScreenRect(rectOS2, rectWin32) \ 94 mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32) 95 96 #define mapOS2ToWin32RectFrame(window, rectOS2, rectWin32) \ 97 if(window->getParent()) { \ 98 mapOS2ToWin32Rect(window->getParent()->getWindowHeight(), rectOS2, rectWin32); \ 99 } \ 100 else mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32); 101 102 103 #define mapOS2ToWin32RectClient(window, rectOS2, rectWin32) \ 104 mapOS2ToWin32Rect(window->getClientHeight(), rectOS2, rectWin32) 105 106 #define mapOS2ToWin32ScreenRect(rectOS2, rectWin32) \ 107 mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32) 108 72 109 BOOL copyOS2ToWin32Rect(PRECTLOS2 rectOS2,PRECT rectWin32); 73 110 BOOL copyWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2); -
trunk/src/user32/oslibmsgtranslate.cpp
r3637 r3662 1 /* $Id: oslibmsgtranslate.cpp,v 1.3 3 2000-05-29 22:43:31sandervl Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.34 2000-06-07 14:51:26 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 143 143 memset(winMsg, 0, sizeof(MSG)); 144 144 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(os2Msg->hwnd); 145 if (!win32wnd) win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(os2Msg->hwnd);146 145 147 146 //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle … … 159 158 winMsg->hwnd = win32wnd->getWindowHandle(); 160 159 161 if (win32wnd && (os2Msg->hwnd == win32wnd->getOS2FrameWindowHandle()))162 {163 //special frame messages164 165 switch (os2Msg->msg)166 {167 case WM_HITTEST:168 winMsg->message = WINWM_NCHITTEST;169 winMsg->wParam = 0;170 winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);171 172 if(!win32wnd->IsWindowEnabled()) {173 if(win32wnd->getParent()) {174 winMsg->hwnd = win32wnd->getParent()->getWindowHandle();175 }176 else goto dummymessage; //don't send mouse messages to disabled windows177 }178 return TRUE;179 180 case WM_BUTTON1DOWN:181 case WM_BUTTON1UP:182 case WM_BUTTON1DBLCLK:183 case WM_BUTTON2DOWN:184 case WM_BUTTON2UP:185 case WM_BUTTON2DBLCLK:186 case WM_BUTTON3DOWN:187 case WM_BUTTON3UP:188 case WM_BUTTON3DBLCLK:189 //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window190 191 #ifdef ODIN_HITTEST192 //Send WM_HITTEST message193 win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));194 #endif195 196 //if a window is disabled, it's parent receives the mouse messages197 if(!win32wnd->IsWindowEnabled()) {198 if(win32wnd->getParent()) {199 win32wnd = win32wnd->getParent();200 }201 dprintf(("Rerouting mouse messages to parent %x of disabled window %x", win32wnd->getWindowHandle(), winMsg->hwnd));202 fWasDisabled = TRUE;203 }204 205 if (IsNCMouseMsg(win32wnd)) {206 winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);207 winMsg->wParam = win32wnd->getLastHitTestVal();208 winMsg->lParam = MAKELONG(winMsg->pt.x, winMsg->pt.y); //screen coordinates209 }210 else {211 point.x = (*(POINTS *)&os2Msg->mp1).x;212 point.y = (*(POINTS *)&os2Msg->mp1).y;213 ClientPoint.x = point.x;214 ClientPoint.y = mapOS2ToWin32Y(os2Msg->hwnd,win32wnd->getOS2WindowHandle(),point.y);215 216 winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);217 winMsg->wParam = GetMouseKeyState();218 winMsg->lParam = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates219 }220 if(ISMOUSE_CAPTURED())221 {222 if(DInputMouseHandler(win32wnd->getWindowHandle(), winMsg->message, winMsg->pt.x, winMsg->pt.y)) {223 goto dummymessage; //dinput swallowed message224 }225 }226 if(fWasDisabled) {227 if(win32wnd) {228 winMsg->hwnd = win32wnd->getWindowHandle();229 }230 else goto dummymessage; //don't send mouse messages to disabled windows231 }232 return TRUE;233 234 case WM_BUTTON2MOTIONSTART:235 case WM_BUTTON2MOTIONEND:236 case WM_BUTTON2CLICK:237 case WM_BUTTON1MOTIONSTART:238 case WM_BUTTON1MOTIONEND:239 case WM_BUTTON1CLICK:240 case WM_BUTTON3MOTIONSTART:241 case WM_BUTTON3MOTIONEND:242 case WM_BUTTON3CLICK:243 goto dummymessage;244 245 case WM_MOUSEMOVE:246 {247 //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window248 249 #ifdef ODIN_HITTEST250 //Send WM_HITTEST message251 win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));252 #endif253 //if a window is disabled, it's parent receives the mouse messages254 if(!win32wnd->IsWindowEnabled()) {255 if(win32wnd->getParent()) {256 win32wnd = win32wnd->getParent();257 }258 dprintf(("Rerouting mouse messages to parent %x of disabled window %x", win32wnd->getWindowHandle(), winMsg->hwnd));259 fWasDisabled = TRUE;260 }261 if (IsNCMouseMsg(win32wnd))262 {263 winMsg->message = WINWM_NCMOUSEMOVE;264 winMsg->wParam = (WPARAM)win32wnd->getLastHitTestVal();265 winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);266 }267 else268 {269 winMsg->message = WINWM_MOUSEMOVE;270 winMsg->wParam = GetMouseKeyState();271 winMsg->lParam = MAKELONG(SHORT1FROMMP(os2Msg->mp1),mapOS2ToWin32Y(win32wnd->getOS2FrameWindowHandle(),win32wnd->getOS2WindowHandle(),SHORT2FROMMP(os2Msg->mp1)));272 }273 if(ISMOUSE_CAPTURED())274 {275 if(DInputMouseHandler(win32wnd->getWindowHandle(), winMsg->message, winMsg->pt.x, winMsg->pt.y)) {276 goto dummymessage; //dinput swallowed message277 }278 }279 if(fWasDisabled) {280 if(win32wnd) {281 winMsg->hwnd = win32wnd->getWindowHandle();282 }283 else goto dummymessage; //don't send mouse messages to disabled windows284 }285 //OS/2 Window coordinates -> Win32 Window coordinates286 return TRUE;287 }288 289 case WM_PAINT:290 {291 winMsg->message = WINWM_NCPAINT;292 return TRUE;293 }294 295 case WM_ACTIVATE:296 {297 winMsg->message = WINWM_NCACTIVATE;298 winMsg->wParam = SHORT1FROMMP(os2Msg->mp1);299 300 return TRUE;301 }302 case WM_WINDOWPOSCHANGED:303 {304 //todo: proper translation305 return FALSE;306 }307 }308 //do normal translation for all other messages309 }310 311 160 switch(os2Msg->msg) 312 161 { … … 383 232 } 384 233 } 385 OSLibMapSWPtoWINDOWPOS(pswp, &thdb->wp, &swpOld, hParent, win32wnd->getOS2FrameWindowHandle()); 234 if(win32wnd->getParent()) { 235 OSLibMapSWPtoWINDOWPOS(pswp, &thdb->wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 236 win32wnd->getParent()->getClientRectPtr()->left, 237 win32wnd->getParent()->getClientRectPtr()->top, 238 win32wnd->getOS2WindowHandle()); 239 } 240 else OSLibMapSWPtoWINDOWPOS(pswp, &thdb->wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, win32wnd->getOS2WindowHandle()); 386 241 387 242 if (!win32wnd->CanReceiveSizeMsgs()) goto dummymessage; 388 389 ULONG windowStyle = WinQueryWindowULong(os2Msg->hwnd, QWL_STYLE);390 win32wnd->setStyle(win32wnd->getStyle() & ~(WS_MAXIMIZE_W|WS_MINIMIZE_W));391 if (windowStyle & WS_MINIMIZED) {392 win32wnd->setStyle(win32wnd->getStyle() | WS_MINIMIZE_W);393 }394 else395 if (windowStyle & WS_MAXIMIZED) {396 win32wnd->setStyle(win32wnd->getStyle() | WS_MAXIMIZE_W);397 }398 243 399 244 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 400 245 dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy)); 401 win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);246 ///// win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy); 402 247 403 248 thdb->wp.hwnd = win32wnd->getWindowHandle(); … … 408 253 thdb->wp.hwndInsertAfter = wndAfter->getWindowHandle(); 409 254 } 410 411 PRECT lpRect = win32wnd->getWindowRect(); 412 //SvL: Only send it when the client has changed & the frame hasn't 413 // If the frame size/position has changed, pmframe.cpp will send 414 // this message 415 if(lpRect->right == thdb->wp.x+thdb->wp.cx && lpRect->bottom == thdb->wp.y+thdb->wp.cy) { 416 winMsg->message = WINWM_WINDOWPOSCHANGED; 417 winMsg->lParam = (LPARAM)&thdb->wp; 418 break; 419 } 420 } 421 goto dummymessage; 255 } 256 winMsg->message = WINWM_WINDOWPOSCHANGED; 257 winMsg->lParam = (LPARAM)&thdb->wp; 258 break; 422 259 } 423 260 … … 434 271 } 435 272 436 if( WinQueryWindowULong(os2Msg->hwnd, QWL_STYLE) & WS_MINIMIZED)273 if(win32wnd->getStyle() & WS_MINIMIZE_W) 437 274 { 438 275 fMinimized = TRUE; … … 497 334 win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y)); 498 335 #endif 336 win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y)); 499 337 500 338 //if a window is disabled, it's parent receives the mouse messages … … 514 352 point.x = (*(POINTS *)&os2Msg->mp1).x; 515 353 point.y = (*(POINTS *)&os2Msg->mp1).y; 516 ClientPoint.x = point.x;517 ClientPoint.y = map Y(os2Msg->hwnd,point.y);354 ClientPoint.x = mapOS2ToWin32X(win32wnd, point.x); 355 ClientPoint.y = mapOS2ToWin32Y(win32wnd, point.y); 518 356 519 357 winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN); … … 571 409 else 572 410 { 411 point.x = (*(POINTS *)&os2Msg->mp1).x; 412 point.y = (*(POINTS *)&os2Msg->mp1).y; 413 ClientPoint.x = mapOS2ToWin32X(win32wnd, point.x); 414 ClientPoint.y = mapOS2ToWin32Y(win32wnd, point.y); 415 573 416 winMsg->message = WINWM_MOUSEMOVE; 574 417 winMsg->wParam = GetMouseKeyState(); 575 winMsg->lParam = MAKELONG( SHORT1FROMMP(os2Msg->mp1),mapY(win32wnd,SHORT2FROMMP(os2Msg->mp1)));418 winMsg->lParam = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates 576 419 } 577 420 if((fMsgRemoved == MSG_REMOVE) && ISMOUSE_CAPTURED()) -
trunk/src/user32/oslibwin.cpp
r3610 r3662 1 /* $Id: oslibwin.cpp,v 1.7 8 2000-05-26 18:43:34sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.79 2000-06-07 14:51:26 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, HWND *hwndFrame,55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, 56 56 ULONG id, BOOL fTaskList,BOOL fShellPosition, 57 57 int classStyle) 58 58 { 59 59 HWND hwndClient; 60 61 dprintf(("WinCreateWindow %x %s %x task %d shell %d classstyle %x", hwndParent, pszName, id, fTaskList, fShellPosition, classStyle)); 60 ULONG dwFrameStyle = 0; 62 61 63 62 if(pszName && *pszName == 0) { … … 70 69 Owner = HWND_DESKTOP; 71 70 } 72 ULONG dwClientStyle = 0;73 ULONG dwFrameStyle = 0;74 75 71 BOOL TopLevel = hwndParent == HWND_DESKTOP; 76 77 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0};78 72 79 73 if(classStyle & CS_SAVEBITS_W) dwWinStyle |= WS_SAVEBITS; 80 74 if(classStyle & CS_PARENTDC_W) dwWinStyle |= WS_PARENTCLIP; 81 75 82 dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPSIBLINGS); 83 84 dwFrameStyle |= FCF_NOBYTEALIGN; 76 dwWinStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP); 77 85 78 if(fTaskList) 86 79 { … … 89 82 if (fShellPosition) dwFrameStyle |= FCF_SHELLPOSITION; 90 83 91 dwWinStyle &= ~WS_CLIPCHILDREN;84 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0}; 92 85 FCData.flCreateFlags = dwFrameStyle; 93 86 94 *hwndFrame = WinCreateWindow (hwndParent, 95 TopLevel ? WC_FRAME : WIN32_INNERFRAME, 96 pszName, dwWinStyle, 0, 0, 0, 0, 97 Owner, HWND_TOP, 98 id, &FCData, NULL); 99 100 if (*hwndFrame) { 101 hwndClient = WinCreateWindow (*hwndFrame, (classStyle & CS_SAVEBITS_W) ? WIN32_STDCLASS2:WIN32_STDCLASS, 102 NULL, dwClientStyle, 0, 0, 0, 0, 103 *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL); 104 return hwndClient; 105 } 106 dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB()))); 107 return 0; 87 dprintf(("WinCreateWindow %x %s %x task %d shell %d classstyle %x winstyle %x", hwndParent, pszName, id, fTaskList, fShellPosition, classStyle, dwWinStyle)); 88 89 #if 1 90 return WinCreateWindow (hwndParent, 91 // TopLevel ? WIN32_STDFRAMECLASS : WIN32_STDCLASS, 92 WIN32_STDFRAMECLASS, 93 pszName, dwWinStyle, 0, 0, 0, 0, 94 Owner, HWND_TOP, 95 id, &FCData, NULL); 96 #else 97 return WinCreateWindow (hwndParent, 98 WIN32_STDCLASS, 99 pszName, dwWinStyle, 0, 0, 0, 0, 100 Owner, HWND_TOP, 101 id, NULL, NULL); 102 #endif 108 103 } 109 104 //****************************************************************************** … … 258 253 //****************************************************************************** 259 254 //****************************************************************************** 260 BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo) 255 #if 0 256 BOOL OSLibWinQueryWindowRect(Win32BaseWindow *window, PRECT pRect, int RelativeTo) 261 257 { 262 258 BOOL rc; 263 259 RECTLOS2 rectl; 264 260 265 rc = WinQueryWindowRect( hwnd, (PRECTL)&rectl);261 rc = WinQueryWindowRect(window->getOS2WindowHandle(), (PRECTL)&rectl); 266 262 if(rc) { 267 263 if(RelativeTo == RELATIVE_TO_SCREEN) { 268 mapOS2ToWin32Rect (hwnd,OSLIB_HWND_DESKTOP,&rectl,pRect);264 mapOS2ToWin32RectFrame(window,windowDesktop,&rectl,pRect); 269 265 } 270 else mapOS2ToWin32Rect (hwnd,&rectl,pRect);266 else mapOS2ToWin32RectFrame(window,&rectl,pRect); 271 267 } 272 268 else memset(pRect, 0, sizeof(RECT)); 273 269 return rc; 274 270 } 271 #endif 275 272 //****************************************************************************** 276 273 //****************************************************************************** … … 294 291 BOOL OSLibWinSetActiveWindow(HWND hwnd) 295 292 { 296 return WinSetActiveWindow(HWND_DESKTOP, hwnd); 293 BOOL rc; 294 295 rc = WinSetActiveWindow(HWND_DESKTOP, hwnd); 296 if(rc == FALSE) { 297 dprintf(("WinSetActiveWindow %x failure: %x", hwnd, OSLibWinGetLastError())); 298 } 299 return rc; 297 300 } 298 301 //****************************************************************************** … … 392 395 //****************************************************************************** 393 396 //****************************************************************************** 394 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, HWND hParent, HWND hFrame) 397 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, 398 int parentHeight, int clientOrgX, int clientOrgY, 399 HWND hwnd) 395 400 { 396 401 HWND hWindow = pswp->hwnd; 397 402 HWND hWndInsertAfter = pswp->hwndInsertBehind; 398 long x = pswp->x ;399 long y = pswp->y ;403 long x = pswp->x - clientOrgX; 404 long y = pswp->y + clientOrgY; 400 405 long cx = pswp->cx; 401 406 long cy = pswp->cy; 402 407 UINT fuFlags = (UINT)pswp->fl; 403 ULONG parentHeight;404 408 405 409 HWND hWinAfter; 406 410 ULONG flags = 0; 407 SWP swpFrame, swpClient;408 POINTL point;409 411 410 412 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow; … … 429 431 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W; 430 432 431 WinQueryWindowPos(hFrame, &swpFrame);432 433 433 if(fuFlags & (SWP_MOVE | SWP_SIZE)) 434 434 { 435 point.x = swpFrame.x; 436 point.y = swpFrame.y; 437 438 if (hParent) 439 { 440 RECTL parentRect; 441 442 WinQueryWindowRect(hParent,&parentRect); 443 parentHeight = parentRect.yTop; 444 } else 445 { 446 parentHeight = ScreenHeight; 447 } 448 449 point.y = parentHeight-point.y-swpFrame.cy; 450 451 cy = swpFrame.cy; 452 cx = swpFrame.cx; 453 x = point.x; 454 y = point.y; 435 y = parentHeight - y - pswp->cy; 455 436 456 437 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y)) … … 470 451 471 452 pswpOld->x = pswp->x; 472 pswpOld->y = swpFrame.cy-pswp->y-pswp->cy;453 pswpOld->y = parentHeight-pswp->y-pswp->cy; 473 454 pswpOld->cx = pswp->cx; 474 455 pswpOld->cy = pswp->cy; … … 487 468 //****************************************************************************** 488 469 //****************************************************************************** 489 void OSLibMapSWPtoWINDOWPOSFrame(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame) 490 { 491 HWND hWindow = pswp->hwnd; 492 HWND hWndInsertAfter = pswp->hwndInsertBehind; 493 long x = pswp->x; 494 long y = pswp->y; 495 long cx = pswp->cx; 496 long cy = pswp->cy; 497 UINT fuFlags = (UINT)pswp->fl; 498 ULONG parentHeight; 499 500 HWND hWinAfter; 501 ULONG flags = 0; 502 SWP swpClient; 503 POINTL point; 504 505 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow; 506 507 if (hWndInsertAfter == HWND_TOP) 508 hWinAfter = HWND_TOP_W; 509 else if (hWndInsertAfter == HWND_BOTTOM) 510 hWinAfter = HWND_BOTTOM_W; 511 else 512 hWinAfter = (HWND) hWndInsertAfter; 513 514 //*********************************** 515 // convert PM flags to Windows flags 516 //*********************************** 517 if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W; 518 if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W; 519 if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W; 520 if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W; 521 if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W; 522 if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W; 523 if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W; 524 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W; 525 526 WinQueryWindowPos(WinWindowFromID(hFrame, FID_CLIENT), &swpClient); 527 528 if(fuFlags & (SWP_MOVE | SWP_SIZE)) 529 { 530 if (hParent) 531 { 532 RECTL parentRect; 533 534 WinQueryWindowRect(hParent,&parentRect); 535 parentHeight = parentRect.yTop; 536 } else 537 { 538 parentHeight = ScreenHeight; 539 } 540 541 point.x = x; 542 point.y = parentHeight-y-cy; 543 544 x = point.x; 545 y = point.y; 546 547 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y)) 548 flags |= SWP_NOMOVE_W; 549 550 if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy)) 551 flags |= SWP_NOSIZE_W; 552 553 if (fuFlags & SWP_SIZE) 554 { 555 if (pswp->cy != pswpOld->cy) 556 { 557 flags &= ~SWP_NOMOVE_W; 558 } 559 } 560 } 561 562 pswpOld->x = swpClient.x; 563 pswpOld->y = pswp->cy-swpClient.y-swpClient.cy; 564 pswpOld->cx = swpClient.cx; 565 pswpOld->cy = swpClient.cy; 566 567 dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)", 568 x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy)); 569 570 pwpos->flags = (UINT)flags; 571 pwpos->cy = cy; 572 pwpos->cx = cx; 573 pwpos->x = x; 574 pwpos->y = y; 575 pwpos->hwndInsertAfter = hWinAfter; 576 pwpos->hwnd = hWindow; 577 } 578 //****************************************************************************** 579 //****************************************************************************** 580 void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame) 470 void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, 471 int parentHeight, int clientOrgX, int clientOrgY, HWND hFrame) 581 472 { 582 473 BOOL fCvt = FALSE; … … 584 475 HWND hWnd = pwpos->hwnd; 585 476 HWND hWndInsertAfter = pwpos->hwndInsertAfter; 586 long x = pwpos->x ;587 long y = pwpos->y ;477 long x = pwpos->x + clientOrgX; 478 long y = pwpos->y + clientOrgY; 588 479 long cx = pwpos->cx; 589 480 long cy = pwpos->cy; 590 481 UINT fuFlags = pwpos->flags; 591 ULONG parentHeight;592 482 593 483 HWND hWinAfter; … … 617 507 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST; 618 508 619 if 509 if(flags & (SWP_MOVE | SWP_SIZE)) 620 510 { 621 if (hParent == NULLHANDLE) 622 parentHeight = ScreenHeight; 623 else 624 parentHeight = OSLibGetWindowHeight(hParent); 625 626 if ((flags & SWP_MOVE) == 0) 511 if((flags & SWP_MOVE) == 0) 627 512 { 628 513 x = pswpOld->x; 629 514 y = pswpOld->y; 630 515 631 y = parentHeight -y-pswpOld->cy;632 633 634 if 516 y = parentHeight - y - pswpOld->cy; 517 } 518 519 if(flags & SWP_SIZE) 635 520 { 636 521 if (cy != pswpOld->cy) … … 642 527 cy = pswpOld->cy; 643 528 } 644 y = parentHeight-y-cy;529 y = parentHeight - y - cy; 645 530 646 531 if ((pswpOld->x == x) && (pswpOld->y == y)) … … 664 549 //Position in screen coordinates 665 550 //****************************************************************************** 666 void OSLibMapWINDOWPOStoSWPFrame(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame) 667 { 668 BOOL fCvt = FALSE; 669 670 HWND hWnd = pwpos->hwnd; 671 HWND hWndInsertAfter = pwpos->hwndInsertAfter; 672 long x = pwpos->x; 673 long y = pwpos->y; 674 long cx = pwpos->cx; 675 long cy = pwpos->cy; 676 UINT fuFlags = pwpos->flags; 677 ULONG parentHeight; 678 679 HWND hWinAfter; 680 ULONG flags = 0; 681 HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP; 682 683 if (hWndInsertAfter == HWND_TOPMOST_W) 684 // hWinAfter = HWND_TOPMOST; 685 hWinAfter = HWND_TOP; 686 else if (hWndInsertAfter == HWND_NOTOPMOST_W) 687 // hWinAfter = HWND_NOTOPMOST; 688 hWinAfter = HWND_TOP; 689 else if (hWndInsertAfter == HWND_TOP_W) 690 hWinAfter = HWND_TOP; 691 else if (hWndInsertAfter == HWND_BOTTOM_W) 692 hWinAfter = HWND_BOTTOM; 693 else 694 hWinAfter = (HWND) hWndInsertAfter; 695 696 if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE; 697 if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE; 698 if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER; 699 if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW; 700 if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE; 701 if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW; 702 if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE; 703 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST; 704 705 if (flags & (SWP_MOVE | SWP_SIZE)) 706 { 707 if (hParent) 708 { 709 RECTL parentRect; 710 711 WinQueryWindowRect(hParent,&parentRect); 712 parentHeight = parentRect.yTop; 713 } else 714 { 715 parentHeight = ScreenHeight; 716 } 717 718 if (flags & SWP_SIZE) 719 { 720 if (cy != pswpOld->cy) 721 flags |= SWP_MOVE; 722 } 723 else 724 { 725 cx = pswpOld->cx; 726 cy = pswpOld->cy; 727 } 728 y = parentHeight-y-cy; 729 730 if ((pswpOld->x == x) && (pswpOld->y == y)) 731 flags &= ~SWP_MOVE; 732 733 if ((pswpOld->cx == cx) && (pswpOld->cy == cy)) 734 flags &= ~SWP_SIZE; 735 } 736 737 pswp->fl = flags; 738 pswp->cy = cy; 739 pswp->cx = cx; 740 pswp->x = x; 741 pswp->y = y; 742 pswp->hwndInsertBehind = hWinAfter; 743 pswp->hwnd = hWindow; 744 pswp->ulReserved1 = 0; 745 pswp->ulReserved2 = 0; 746 } 747 //****************************************************************************** 748 //****************************************************************************** 749 BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient) 551 BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient) 750 552 { 751 553 BOOL rc; -
trunk/src/user32/oslibwin.h
r3610 r3662 1 /* $Id: oslibwin.h,v 1.4 5 2000-05-26 18:43:34sandervl Exp $ */1 /* $Id: oslibwin.h,v 1.46 2000-06-07 14:51:27 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 HWND *hwndFrame,ULONG id, BOOL fTaskList,BOOL fShellPosition, int classStyle);42 ULONG id, BOOL fTaskList,BOOL fShellPosition, int classStyle); 43 43 44 44 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle); … … 73 73 ULONG OSLibGetWindowHeight(HWND hwnd); //for point transformation 74 74 75 extern ULONG ScreenHeight ;75 extern ULONG ScreenHeight, ScreenWidth; 76 76 inline ULONG OSLibQueryScreenHeight(void) { return (ScreenHeight); } 77 inline ULONG OSLibQueryScreenWidth(void) { return (ScreenWidth); } 77 78 78 79 //reserved deleted … … 220 221 #define RELATIVE_TO_WINDOW 0 221 222 #define RELATIVE_TO_SCREEN 1 222 BOOL OSLibWinQueryWindowRect( HWND hwnd, PRECT pRect, int RelativeTo = RELATIVE_TO_WINDOW);223 BOOL OSLibWinQueryWindowRect(Win32BaseWindow *window, PRECT pRect, int RelativeTo = RELATIVE_TO_WINDOW); 223 224 BOOL OSLibWinCalcFrameRect(HWND hwnd, RECT *pRect, BOOL fClient); 224 225 BOOL OSLibGetMinMaxInfo(HWND hwndFrame, MINMAXINFO *pMinMax); … … 247 248 248 249 BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp); 249 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame); 250 void OSLibMapSWPtoWINDOWPOSFrame(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame); 251 void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame); 252 void OSLibMapWINDOWPOStoSWPFrame(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame); 250 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, 251 int parentHeight, int clientOrgX, int clientOrgY, 252 HWND hwnd); 253 void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, 254 int parentHeight, int clientOrgX, int clientOrgY, HWND hFrame); 253 255 254 256 HWND OSLibWinBeginEnumWindows(HWND hwnd); -
trunk/src/user32/pmwindow.cpp
r3603 r3662 1 /* $Id: pmwindow.cpp,v 1.9 1 2000-05-24 19:30:06sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.92 2000-06-07 14:51:27 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 15 15 #define INCL_GPICONTROL /* GPI control Functions */ 16 16 #define INCL_DOSPROCESS 17 #define INCL_WINTRACKRECT 17 18 18 19 #include <os2wrap.h> … … 52 53 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 53 54 55 PFNWP PMFrameWindowProc = 0; 56 54 57 //****************************************************************************** 55 58 //Initialize PM; create hab, message queue and register special Win32 window classes … … 57 60 BOOL InitPM() 58 61 { 59 CLASSINFO FrameClassInfo; 60 62 61 63 hab = WinInitialize(0); 62 64 dprintf(("Winitialize returned %x", hab)); … … 96 98 (PSZ)WIN32_STDCLASS, /* Window class name */ 97 99 (PFNWP)Win32WindowProc, /* Address of window procedure */ 98 #ifdef ODIN_HITTEST99 0,100 #else101 100 CS_HITTEST, 102 #endif103 101 NROF_WIN32WNDBYTES)) { 104 102 dprintf(("WinRegisterClass Win32BaseWindow failed")); 105 103 return(FALSE); 106 } 104 } 105 106 CLASSINFO FrameClassInfo; 107 if(!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) { 108 dprintf (("WinQueryClassInfo WC_FRAME failed")); 109 return (FALSE); 110 } 111 dprintf(("WC_FRAME style %x", FrameClassInfo.flClassStyle)); 112 113 PMFrameWindowProc = FrameClassInfo.pfnWindowProc; 107 114 if(!WinRegisterClass( /* Register window class */ 108 115 hab, /* Anchor block handle */ 109 (PSZ)WIN32_STD CLASS2,/* Window class name */116 (PSZ)WIN32_STDFRAMECLASS, /* Window class name */ 110 117 (PFNWP)Win32WindowProc, /* Address of window procedure */ 111 #ifdef ODIN_HITTEST 112 CS_SAVEBITS, 113 #else 114 CS_SAVEBITS | CS_HITTEST, 115 #endif 116 NROF_WIN32WNDBYTES)) { 117 dprintf(("WinRegisterClass Win32BaseWindow failed")); 118 CS_HITTEST | CS_FRAME, 119 FrameClassInfo.cbWindowData+NROF_WIN32WNDBYTES)) { 120 dprintf(("WinRegisterClass Win32BaseWindow failed %x", WinGetLastError(hab))); 118 121 return(FALSE); 119 } 120 if (!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) { 121 dprintf (("WinQueryClassInfo WC_FRAME failed")); 122 return (FALSE); 123 } 124 FrameClassInfo.flClassStyle &= ~(CS_PUBLIC | CS_CLIPSIBLINGS); 125 if (!WinRegisterClass (hab, 126 WIN32_INNERFRAME, 127 FrameClassInfo.pfnWindowProc, 128 #ifdef ODIN_HITTEST 129 FrameClassInfo.flClassStyle, 130 #else 131 FrameClassInfo.flClassStyle | CS_HITTEST, 132 #endif 133 FrameClassInfo.cbWindowData)) { 134 dprintf (("WinRegisterClass Win32InnerFrame failed")); 135 return (FALSE); 136 } 137 138 WinQueryWindowRect(HWND_DESKTOP, &desktopRectl); 139 ScreenWidth = desktopRectl.xRight; 140 ScreenHeight = desktopRectl.yTop; 141 142 143 HDC hdc; /* Device-context handle */ 144 /* context data structure */ 145 DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, 146 NULL, NULL, NULL}; 147 148 /* create memory device context */ 149 hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); 150 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel); 151 DevCloseDC(hdc); 152 153 dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight)); 154 return TRUE; 122 } 123 124 WinQueryWindowRect(HWND_DESKTOP, &desktopRectl); 125 ScreenWidth = desktopRectl.xRight; 126 ScreenHeight = desktopRectl.yTop; 127 128 HDC hdc; /* Device-context handle */ 129 /* context data structure */ 130 DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, 131 NULL, NULL, NULL}; 132 133 /* create memory device context */ 134 hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); 135 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel); 136 DevCloseDC(hdc); 137 138 dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight)); 139 return TRUE; 155 140 } /* End of main */ 156 141 //****************************************************************************** … … 223 208 win32wnd = (Win32BaseWindow *)thdb->newWindow; 224 209 thdb->newWindow = 0; 225 226 if(win32wnd->MsgCreate(WinQueryWindow(hwnd, QW_PARENT), hwnd) == FALSE) 210 if(win32wnd->MsgCreate(hwnd) == FALSE) 227 211 { 228 212 RestoreOS2TIB(); 229 213 return (MRESULT)TRUE; //discontinue window creation 230 214 } 215 RestoreOS2TIB(); 216 PMFrameWindowProc(hwnd, msg, mp1, mp2); 217 SetWin32TIB(); 231 218 createfail: 232 219 RestoreOS2TIB(); … … 247 234 dprintf(("OS2: WM_DESTROY %x", hwnd)); 248 235 win32wnd->MsgDestroy(); 249 break; 236 WinSetVisibleRegionNotify(hwnd, FALSE); 237 goto RunDefWndProc; 250 238 251 239 case WM_ENABLE: … … 261 249 case WM_ADJUSTWINDOWPOS: 262 250 { 263 PSWP pswp = (PSWP)mp1; 264 dprintf(("PMWINDOW: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 265 goto RunDefWndProc; 251 PSWP pswp = (PSWP)mp1; 252 SWP swpOld; 253 WINDOWPOS wp,wpOld; 254 HWND hParent = NULLHANDLE, hwndAfter; 255 256 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)); 257 258 //CB: show dialog in front of owner 259 if (win32wnd->IsModalDialogOwner()) 260 { 261 pswp->fl |= SWP_ZORDER; 262 pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog(); 263 if (pswp->fl & SWP_ACTIVATE) 264 { 265 pswp->fl &= ~SWP_ACTIVATE; 266 WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE); 267 } 268 } 269 270 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 271 goto RunDefWndProc; 272 273 if(!win32wnd->CanReceiveSizeMsgs()) 274 break; 275 276 WinQueryWindowPos(hwnd, &swpOld); 277 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 278 if (win32wnd->isChild()) { 279 if(win32wnd->getParent()) { 280 hParent = win32wnd->getParent()->getOS2WindowHandle(); 281 } 282 else goto RunDefWndProc; 283 } 284 } 285 hwndAfter = pswp->hwndInsertBehind; 286 if(win32wnd->getParent()) { 287 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 288 win32wnd->getParent()->getClientRectPtr()->left, 289 win32wnd->getParent()->getClientRectPtr()->top, 290 hwnd); 291 } 292 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 293 294 wp.hwnd = win32wnd->getWindowHandle(); 295 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 296 { 297 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 298 if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle(); 299 } 300 301 wpOld = wp; 302 win32wnd->MsgPosChanging((LPARAM)&wp); 303 304 if ((wp.hwndInsertAfter != wpOld.hwndInsertAfter) || 305 (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags)) 306 { 307 dprintf(("OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct")); 308 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 309 310 if(win32wnd->getParent()) { 311 OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, win32wnd->getParent()->getWindowHeight(), 312 win32wnd->getParent()->getClientRectPtr()->left, 313 win32wnd->getParent()->getClientRectPtr()->top, 314 hwnd); 315 } 316 else OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 317 318 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 319 pswp->fl |= SWP_NOADJUST; 320 pswp->hwndInsertBehind = hwndAfter; 321 pswp->hwnd = hwnd; 322 323 RestoreOS2TIB(); 324 return (MRESULT)0xf; 325 } 326 RestoreOS2TIB(); 327 return (MRESULT)0; 266 328 } 267 329 268 330 case WM_WINDOWPOSCHANGED: 269 331 { 270 if(pWinMsg->message != 0) 271 win32wnd->MsgPosChanged((LPARAM)&thdb->wp); 272 goto RunDefWndProc; 332 PSWP pswp = (PSWP)mp1,pswpOld = pswp+1; 333 SWP swpOld = *(pswp + 1); 334 WINDOWPOS wp; 335 HWND hParent = NULLHANDLE; 336 RECTL rect; 337 338 dprintf(("OS2: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 339 340 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 341 { 342 goto RunDefWndProc; 343 } 344 345 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 346 if(win32wnd->isChild()) { 347 if(win32wnd->getParent()) { 348 hParent = win32wnd->getParent()->getOS2WindowHandle(); 349 } 350 else goto PosChangedEnd; //parent has just been destroyed 351 } 352 } 353 354 355 if(win32wnd->getParent()) { 356 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 357 win32wnd->getParent()->getClientRectPtr()->left, 358 win32wnd->getParent()->getClientRectPtr()->top, 359 hwnd); 360 } 361 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 362 363 if((pswp->fl & (SWP_MOVE | SWP_SIZE)) && !(win32wnd->getStyle() & WS_MINIMIZE_W)) 364 { 365 //Note: Also updates the new window rectangle 366 win32wnd->MsgFormatFrame(&wp); 367 368 //CB: todo: use result for WM_CALCVALIDRECTS 369 mapWin32ToOS2RectFrame(win32wnd, win32wnd->getClientRectPtr(), (PRECTLOS2)&rect); 370 371 if(win32wnd->CanReceiveSizeMsgs()) 372 win32wnd->MsgPosChanged((LPARAM)&wp); 373 374 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy))) 375 { 376 //redraw the frame (to prevent unnecessary client updates) 377 BOOL redrawAll = FALSE; 378 379 if (win32wnd->getWindowClass()) 380 { 381 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 382 383 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx)) 384 redrawAll = TRUE; 385 else if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy)) 386 redrawAll = TRUE; 387 } else redrawAll = TRUE; 388 389 if (redrawAll) 390 { 391 //CB: redraw all children for now 392 // -> problems with update region if we don't do it 393 // todo: rewrite whole handling 394 WinInvalidateRect(hwnd,NULL,TRUE); 395 } 396 else 397 { 398 HPS hps = WinGetPS(hwnd); 399 RECTL frame,client,arcl[4]; 400 401 WinQueryWindowRect(hwnd,&frame); 402 //top 403 arcl[0].xLeft = 0; 404 arcl[0].xRight = frame.xRight; 405 arcl[0].yBottom = rect.yTop; 406 arcl[0].yTop = frame.yTop; 407 //right 408 arcl[1].xLeft = rect.xRight; 409 arcl[1].xRight = frame.xRight; 410 arcl[1].yBottom = 0; 411 arcl[1].yTop = frame.yTop; 412 //left 413 arcl[2].xLeft = 0; 414 arcl[2].xRight = rect.xLeft; 415 arcl[2].yBottom = 0; 416 arcl[2].yTop = frame.yTop; 417 //bottom 418 arcl[3].xLeft = 0; 419 arcl[3].xRight = frame.xRight; 420 arcl[3].yBottom = 0; 421 arcl[3].yTop = rect.yBottom; 422 423 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl); 424 425 WinInvalidateRegion(hwnd,hrgn,FALSE); 426 GpiDestroyRegion(hps,hrgn); 427 WinReleasePS(hps); 428 } 429 } 430 } 431 else 432 { 433 if(win32wnd->CanReceiveSizeMsgs()) 434 win32wnd->MsgPosChanged((LPARAM)&wp); 435 } 436 437 PosChangedEnd: 438 RestoreOS2TIB(); 439 return (MRESULT)FALSE; 273 440 } 274 441 275 442 case WM_ACTIVATE: 276 443 { 444 USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS); 445 277 446 dprintf(("OS2: WM_ACTIVATE %x %x %x", hwnd, mp1, mp2)); 278 447 279 if(win32wnd->IsWindowCreated()) 448 if(win32wnd->IsWindowCreated()) 449 { 450 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 280 451 win32wnd->MsgActivate((LOWORD(pWinMsg->wParam) == WA_ACTIVE_W) ? 1 : 0, HIWORD(pWinMsg->wParam), pWinMsg->lParam, (HWND)mp2); 281 452 453 //CB: show owner behind the dialog 454 if(win32wnd->IsModalDialog()) 455 { 456 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 457 458 if(topOwner) WinSetWindowPos(topOwner->getOS2WindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 459 } 460 } 461 282 462 break; 283 463 } … … 289 469 } 290 470 471 291 472 case WM_MINMAXFRAME: 292 473 { 293 dprintf(("OS2: WM_MINMAXFRAME")); 294 break; 474 PSWP swp = (PSWP)mp1; 475 476 if (!win32wnd->IsWindowCreated()) goto RunDefFrameProc; 477 dprintf(("OS2: WM_MINMAXFRAME %x",hwnd)); 478 if ((swp->fl & SWP_MAXIMIZE) == SWP_MAXIMIZE) 479 { 480 win32wnd->setStyle((win32wnd->getStyle() & ~WS_MINIMIZE_W) | WS_MAXIMIZE_W); 481 482 RECT rect; 483 484 rect.left = rect.top = rect.right = rect.bottom = 0; 485 win32wnd->AdjustMaximizedRect(&rect); 486 swp->x += rect.left; 487 swp->cx += rect.right-rect.left; 488 swp->y -= rect.bottom; 489 swp->cy += rect.bottom-rect.top; 490 } 491 else if ((swp->fl & SWP_MINIMIZE) == SWP_MINIMIZE) 492 { 493 win32wnd->setStyle((win32wnd->getStyle() & ~WS_MAXIMIZE_W) | WS_MINIMIZE_W); 494 } 495 else if ((swp->fl & SWP_RESTORE) == SWP_RESTORE) 496 { 497 win32wnd->setStyle(win32wnd->getStyle() & ~(WS_MINIMIZE_W | WS_MAXIMIZE_W)); 498 } 499 goto RunDefFrameProc; 295 500 } 296 501 … … 322 527 } 323 528 #else 324 dprintf(("PMWINDOW: WM_CALCVALIDRECTS "));529 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 325 530 RestoreOS2TIB(); 326 531 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 327 532 #endif 533 534 case WM_VRNENABLED: 535 if(!win32wnd->isComingToTop() && ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == WS_EX_TOPMOST_W)) 536 { 537 HWND hwndrelated; 538 Win32BaseWindow *topwindow; 539 540 win32wnd->setComingToTop(TRUE); 541 542 hwndrelated = WinQueryWindow(hwnd, QW_PREV); 543 dprintf(("WM_VRNENABLED hwndrelated = %x (hwnd=%x)", hwndrelated, hwnd)); 544 topwindow = Win32BaseWindow::GetWindowFromOS2Handle(hwndrelated); 545 if(topwindow == NULL || ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == 0)) { 546 //put window at the top of z order 547 WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 548 } 549 550 win32wnd->setComingToTop(FALSE); 551 break; 552 } 553 goto RunDefWndProc; 328 554 329 555 case WM_SETFOCUS: … … 350 576 //************************************************************************** 351 577 case WM_HITTEST: 352 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 353 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 354 } 355 if(win32wnd) 356 rc = win32wnd->MsgHitTest(pWinMsg); 357 break; 358 578 { 579 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 580 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 581 } 582 if(win32wnd && win32wnd->IsWindowCreated()) 583 { 584 MRESULT rc; 585 586 rc = (MRESULT)win32wnd->MsgHitTest(pWinMsg); 587 RestoreOS2TIB(); 588 return rc; 589 } 590 return (MRESULT)HT_NORMAL; 591 } 359 592 360 593 case WM_BUTTON1DOWN: … … 452 685 case WM_PAINT: 453 686 { 454 // RECTL rectl; 455 456 dprintf(("OS2: WM_PAINT")); 457 win32wnd->DispatchMsgA(pWinMsg); 687 RECTL rectl; 688 689 WinQueryUpdateRect(hwnd, &rectl); 690 dprintf(("OS2: WM_PAINT (%d,%d) (%d,%d)", rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop)); 691 if(win32wnd->IsWindowCreated()) 692 { 693 PRECT pClient = win32wnd->getClientRectPtr(); 694 PRECT pWindow = win32wnd->getWindowRect(); 695 696 if(!(pClient->left == 0 && pClient->top == 0 && 697 win32wnd->getClientHeight() == win32wnd->getWindowHeight() && 698 win32wnd->getClientWidth() == win32wnd->getWindowWidth())) 699 { 700 win32wnd->MsgNCPaint(); 701 } 702 win32wnd->DispatchMsgA(pWinMsg); 703 } 458 704 //SvL: Not calling the default window procedure causes all sorts of 459 705 // strange problems (redraw & hanging app) 706 // -> check what WinBeginPaint does what we're forgetting in BeginPaint 460 707 // WinQueryUpdateRect(hwnd, &rectl); 461 708 // if(rectl.xLeft == 0 && rectl.yTop == 0 && rectl.xRight == 0 && rectl.yBottom == 0) { … … 465 712 // dprintf(("Update rectangle (%d,%d)(%d,%d) not empty, msg %x", rectl.xLeft, rectl.yTop, rectl.xRight, rectl.yBottom, pWinMsg->message)); 466 713 goto RunDefWndProc; 467 } 468 469 case WM_CONTEXTMENU: 470 { 471 win32wnd->DispatchMsgA(pWinMsg); 472 473 RestoreOS2TIB(); 474 return (MRESULT)TRUE; 714 // break; 475 715 } 476 716 … … 482 722 } 483 723 724 #if 0 725 case WM_CONTEXTMENU: 726 { 727 win32wnd->DispatchMsgA(pWinMsg); 728 729 RestoreOS2TIB(); 730 return (MRESULT)TRUE; 731 } 732 #endif 733 484 734 case WM_FOCUSCHANGE: 485 735 dprintf(("OS2: WM_FOCUSCHANGE %x", win32wnd->getWindowHandle())); 486 736 goto RunDefWndProc; 737 738 case WM_QUERYTRACKINFO: 739 { 740 PTRACKINFO trackInfo = (PTRACKINFO)mp2; 741 742 dprintf(("OS2: WM_QUERYTRACKINFO %x", win32wnd->getWindowHandle())); 743 RestoreOS2TIB(); 744 PMFrameWindowProc(hwnd,msg,mp1,mp2); 745 SetWin32TIB(); 746 trackInfo->cxBorder = 4; 747 trackInfo->cyBorder = 4; 748 win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize); 749 RestoreOS2TIB(); 750 return (MRESULT)TRUE; 751 } 752 753 case WM_QUERYBORDERSIZE: 754 { 755 PWPOINT size = (PWPOINT)mp1; 756 757 dprintf(("OS2: WM_QUERYBORDERSIZE %x", win32wnd->getWindowHandle())); 758 759 size->x = 0; 760 size->y = 0; 761 RestoreOS2TIB(); 762 return (MRESULT)TRUE; 763 } 764 765 case WM_FORMATFRAME: 766 dprintf(("OS2: WM_FORMATFRAME %x", win32wnd->getWindowHandle())); 767 break; 768 769 #if 0 770 case WM_ADJUSTFRAMEPOS: 771 dprintf(("OS2: WM_ADJUSTFRAMEPOS %x", win32wnd->getWindowHandle())); 772 break; 773 774 case WM_QUERYFRAMEINFO: 775 dprintf(("OS2: WM_QUERYFRAMEINFO %x", win32wnd->getWindowHandle())); 776 return (MRESULT)(FI_FRAME|FI_ACTIVATEOK); 777 778 case WM_QUERYFOCUSCHAIN: 779 { 780 USHORT fsCmd = SHORT1FROMMP(mp1); 781 782 dprintf(("OS2: WM_QUERYFOCUSCHAIN %x %x %x", win32wnd->getWindowHandle(), mp1, mp2)); 783 switch(fsCmd) { 784 case QFC_NEXTINCHAIN: 785 break; 786 case QFC_ACTIVE: 787 case QFC_FRAME: 788 if(win32wnd->GetTopParent()) { 789 dprintf(("Frame = %x", win32wnd->GetTopParent()->getOS2WindowHandle())); 790 return (MRESULT)win32wnd->GetTopParent()->getOS2WindowHandle(); 791 } 792 break; 793 case QFC_SELECTACTIVE: 794 break; 795 case QFC_PARTOFCHAIN: 796 return (MRESULT)TRUE; 797 } 798 break; 799 } 800 #endif 487 801 488 802 case WM_INITMENU: … … 511 825 case WM_SEMANTICEVENT: 512 826 default: 513 //dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));827 // dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 514 828 RestoreOS2TIB(); 515 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 829 return PMFrameWindowProc(hwnd, msg, mp1, mp2); 830 // return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 516 831 } 517 832 RestoreOS2TIB(); 518 833 return (MRESULT)rc; 519 834 835 RunDefFrameProc: 836 RestoreOS2TIB(); 837 return PMFrameWindowProc(hwnd, msg, mp1, mp2); 838 520 839 RunDefWndProc: 521 840 // dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 522 841 RestoreOS2TIB(); 523 524 return WinDefWindowProc( hwnd, msg, mp1, mp2 );842 return PMFrameWindowProc(hwnd, msg, mp1, mp2); 843 // return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 525 844 } /* End of Win32WindowProc */ 526 845 //****************************************************************************** 846 //TODO: Quickly moving a window two times doesn't force a repaint (1st time) 527 847 //****************************************************************************** 848 VOID FrameTrackFrame(Win32BaseWindow *win32wnd,DWORD flags) 849 { 850 TRACKINFO track; 851 RECTL rcl; 852 PRECT pWindowRect; 853 HWND hwndTracking; 854 HPS hpsTrack; 855 LONG parentHeight, parentWidth; 856 857 track.cxBorder = 4; 858 track.cyBorder = 4; /* 4 pel wide lines used for rectangle */ 859 track.cxGrid = 1; 860 track.cyGrid = 1; /* smooth tracking with mouse */ 861 track.cxKeyboard = 8; 862 track.cyKeyboard = 8; /* faster tracking using cursor keys */ 863 864 pWindowRect = win32wnd->getWindowRect(); 865 if(win32wnd->getParent()) { 866 parentHeight = win32wnd->getParent()->getWindowHeight(); 867 parentWidth = win32wnd->getParent()->getWindowWidth(); 868 hwndTracking = win32wnd->getParent()->getOS2WindowHandle(); 869 hpsTrack = WinGetPS(hwndTracking); 870 } 871 else { 872 parentHeight = OSLibQueryScreenHeight(); 873 parentWidth = OSLibQueryScreenWidth(); 874 hwndTracking = HWND_DESKTOP; 875 hpsTrack = NULL; 876 } 877 878 rcl.xLeft = pWindowRect->left; 879 rcl.yTop = OSLibQueryScreenHeight() - pWindowRect->top; 880 rcl.xRight = pWindowRect->right; 881 rcl.yBottom = OSLibQueryScreenHeight() - pWindowRect->bottom; 882 if(hwndTracking != HWND_DESKTOP) { 883 WinMapWindowPoints(win32wnd->getOS2WindowHandle(), HWND_DESKTOP, (PPOINTL)&rcl, 2); 884 } 885 WinCopyRect(hab, &track.rclTrack, &rcl); /* starting point */ 886 887 WinSetRect(hab, &track.rclBoundary, 0, 0, parentWidth, parentHeight); /* bounding rectangle */ 888 889 track.ptlMinTrackSize.x = 10; 890 track.ptlMinTrackSize.y = 10; /* set smallest allowed size of rectangle */ 891 track.ptlMaxTrackSize.x = parentWidth; 892 track.ptlMaxTrackSize.y = parentHeight; /* set largest allowed size of rectangle */ 893 894 win32wnd->AdjustTrackInfo((PPOINT)&track.ptlMinTrackSize, (PPOINT)&track.ptlMaxTrackSize); 895 896 track.fs = flags; 897 898 if(WinTrackRect(HWND_DESKTOP, NULL, &track) ) 899 { 900 if(hpsTrack) WinReleasePS(hpsTrack); 901 902 /* if successful copy final position back */ 903 if(!WinEqualRect(0, &rcl, &track.rclTrack)) { 904 if(flags == TF_MOVE) { 905 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 906 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 907 0, 0, SWP_MOVE); 908 } 909 else { 910 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 911 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 912 track.rclTrack.xRight - track.rclTrack.xLeft, 913 track.rclTrack.yTop - track.rclTrack.yBottom, 914 SWP_SIZE|SWP_MOVE); 915 } 916 } 917 return; 918 } 919 if(hpsTrack) WinReleasePS(hpsTrack); 920 return; 921 } 922 //****************************************************************************** 923 //****************************************************************************** -
trunk/src/user32/pmwindow.h
r2469 r3662 1 /* $Id: pmwindow.h,v 1. 8 2000-01-18 20:08:13sandervl Exp $ */1 /* $Id: pmwindow.h,v 1.9 2000-06-07 14:51:27 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 9 9 #define __PMWINDOW_H__ 10 10 11 #define WIN32_STDCLASS "Win32WindowClass" 12 #define WIN32_STDCLASS2 "Win32WindowClass2" 13 #define WIN32_INNERFRAME "Win32InnerFrameClass" 11 #define WIN32_STDCLASS "Win32WindowClass" 12 #define WIN32_STDFRAMECLASS "Win32FrameClass" 14 13 15 14 BOOL InitPM(); 16 17 PVOID SubclassWithDefHandler(HWND hwnd);18 15 19 16 void RegisterSystemClasses(ULONG hModule); -
trunk/src/user32/unknown.cpp
r2804 r3662 1 /* $Id: unknown.cpp,v 1. 8 2000-02-16 14:34:38 sandervl Exp $ */1 /* $Id: unknown.cpp,v 1.9 2000-06-07 14:51:28 sandervl Exp $ */ 2 2 3 3 /* … … 180 180 181 181 182 /***********************************************************************183 * SetInternalWindowPos (USER32.483)184 */185 void WIN32API SetInternalWindowPos(HWND hwnd,186 UINT showCmd,187 LPRECT rect,188 LPPOINT pt )189 {190 dprintf(("USER32: SetInternalWindowPos(%08xh,%08xh,%08xh,%08xh) not implemented.\n",191 hwnd,192 showCmd,193 rect,194 pt));195 }196 182 -
trunk/src/user32/user32.cpp
r3628 r3662 1 /* $Id: user32.cpp,v 1.8 2 2000-05-28 19:50:54sandervl Exp $ */1 /* $Id: user32.cpp,v 1.83 2000-06-07 14:51:28 sandervl Exp $ */ 2 2 3 3 /* … … 1706 1706 int WIN32API FillRect(HDC hDC, const RECT * lprc, HBRUSH hbr) 1707 1707 { 1708 dprintf 2(("USER32: FillRect (%d,%d)(%d,%d) brush %X\n", lprc->left, lprc->top, lprc->right, lprc->bottom, hbr));1708 dprintf(("USER32: FillRect (%d,%d)(%d,%d) brush %X\n", lprc->left, lprc->top, lprc->right, lprc->bottom, hbr)); 1709 1709 return O32_FillRect(hDC,lprc,hbr); 1710 1710 } -
trunk/src/user32/win32dlg.cpp
r3488 r3662 1 /* $Id: win32dlg.cpp,v 1. 49 2000-05-03 18:35:53sandervl Exp $ */1 /* $Id: win32dlg.cpp,v 1.50 2000-06-07 14:51:29 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 212 212 //****************************************************************************** 213 213 //****************************************************************************** 214 ULONG Win32Dialog::MsgCreate(HWND hwnd Frame, HWND hwndClient)214 ULONG Win32Dialog::MsgCreate(HWND hwndOS2) 215 215 { 216 216 CREATESTRUCTA *cs = tmpcs; //pointer to CREATESTRUCT used in CreateWindowExA method … … 218 218 LPSTR dlgTemplate = tmpDlgTemplate; 219 219 220 Win32BaseWindow::MsgCreate(hwnd Frame, hwndClient);220 Win32BaseWindow::MsgCreate(hwndOS2); 221 221 222 222 if(!isUnicode) { … … 303 303 topOwner->setModalDialogOwner(TRUE); 304 304 hwndOldDialog = topOwner->getOS2HwndModalDialog(); 305 topOwner->setOS2HwndModalDialog(OS2Hwnd Frame);305 topOwner->setOS2HwndModalDialog(OS2Hwnd); 306 306 ShowWindow(SW_SHOW); 307 307 -
trunk/src/user32/win32dlg.h
r2469 r3662 1 /* $Id: win32dlg.h,v 1.1 0 2000-01-18 20:08:16sandervl Exp $ */1 /* $Id: win32dlg.h,v 1.11 2000-06-07 14:51:30 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 73 73 BOOL MapDialogRect(LPRECT rect); 74 74 75 virtual ULONG MsgCreate(HWND hwnd Frame, HWND hwndClient);75 virtual ULONG MsgCreate(HWND hwndOS2); 76 76 77 77 virtual LONG SetWindowLongA(int index, ULONG value, BOOL fUnicode = FALSE); -
trunk/src/user32/win32wbase.cpp
r3641 r3662 1 /* $Id: win32wbase.cpp,v 1.19 7 2000-06-01 11:27:57sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.198 2000-06-07 14:51:30 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 15 15 * TODO: Not thread/process safe 16 16 * 17 * NOTE: Client rectangle always relative to frame window; window rectangle in screen coordinates 17 * NOTE: Client rectangle always relative to frame window 18 * Window rectangle in parent coordinates (relative to parent's client window) 19 * (screen coord. if no parent) 18 20 * 19 21 * Project Odin Software License can be found in LICENSE.TXT … … 39 41 #include "win32wndhandle.h" 40 42 #include "dc.h" 41 #include "pmframe.h"42 43 #include "win32wdesktop.h" 43 44 #include "pmwindow.h" … … 104 105 magic = WIN32PM_MAGIC; 105 106 OS2Hwnd = 0; 106 OS2HwndFrame = 0;107 107 hSysMenu = 0; 108 108 Win32Hwnd = 0; … … 126 126 hotkey = 0; 127 127 128 pOldFrameProc = NULL;129 128 130 129 hwndLinkAfter = HWND_BOTTOM; … … 156 155 dwThreadId = GetCurrentThreadId(); 157 156 dwProcessId = currentProcessId; 157 158 memset(&windowpos, 0, sizeof(windowpos)); 158 159 } 159 160 //****************************************************************************** … … 166 167 } 167 168 168 OSLibWinSetVisibleRegionNotify(OS2Hwnd Frame, FALSE);169 OSLibWinSetVisibleRegionNotify(OS2Hwnd, FALSE); 169 170 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0); 170 171 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0); … … 412 413 413 414 hwndLinkAfter = HWND_TOP; 415 #if 1 414 416 if(CONTROLS_IsControl(this, BUTTON_CONTROL) && ((dwStyle & 0x0f) == BS_GROUPBOX)) 415 417 { … … 418 420 } 419 421 else 422 #endif 420 423 if(CONTROLS_IsControl(this, STATIC_CONTROL) && !(dwStyle & WS_GROUP)) { 421 424 dwStyle |= WS_CLIPSIBLINGS; … … 515 518 (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP, 516 519 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 517 &OS2HwndFrame,0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle());520 0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle()); 518 521 if(OS2Hwnd == 0) { 519 522 dprintf(("Window creation failed!!")); … … 521 524 return FALSE; 522 525 } 523 OSLibWinSetVisibleRegionNotify(OS2Hwnd Frame, TRUE);526 OSLibWinSetVisibleRegionNotify(OS2Hwnd, TRUE); 524 527 SetLastError(0); 525 528 return TRUE; … … 527 530 //****************************************************************************** 528 531 //****************************************************************************** 529 BOOL Win32BaseWindow::MsgCreate(HWND hwnd Frame, HWND hwndClient)532 BOOL Win32BaseWindow::MsgCreate(HWND hwndOS2) 530 533 { 531 534 CREATESTRUCTA *cs = tmpcs; //pointer to CREATESTRUCT used in CreateWindowExA method 532 535 POINT maxSize, maxPos, minTrack, maxTrack; 533 536 534 OS2Hwnd = hwndClient; 535 OS2HwndFrame = hwndFrame; 537 OS2Hwnd = hwndOS2; 536 538 537 539 fNoSizeMsg = TRUE; … … 556 558 557 559 //SvL: Returns invalid rectangle (not the expected shell default size) 558 OSLibWinQueryWindowRect(OS2Hwnd Frame,&rect,RELATIVE_TO_SCREEN);560 OSLibWinQueryWindowRect(OS2Hwnd,&rect,RELATIVE_TO_SCREEN); 559 561 if (getParent()) mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),&rect); 560 562 if (fXDefault) … … 575 577 #endif 576 578 577 OSLibWinSetOwner(OS2Hwnd, OS2HwndFrame);578 579 579 fakeWinBase.hwndThis = OS2Hwnd; 580 580 fakeWinBase.pWindowClass = windowClass; … … 582 582 //Set icon from window or class 583 583 if (hIcon) 584 OSLibWinSetIcon(OS2Hwnd Frame,hIcon);584 OSLibWinSetIcon(OS2Hwnd,hIcon); 585 585 else if (windowClass->getIcon()) 586 OSLibWinSetIcon(OS2Hwnd Frame,windowClass->getIcon());586 OSLibWinSetIcon(OS2Hwnd,windowClass->getIcon()); 587 587 588 588 /* Get class or window DC if needed */ 589 589 if(windowClass->getStyle() & CS_OWNDC) { 590 590 dprintf(("Class with CS_OWNDC style")); 591 ownDC = GetDC (getWindowHandle()); //TODO: or GetWindowDC???591 ownDC = GetDCEx(getWindowHandle(), NULL, DCX_USESTYLE); 592 592 } 593 593 else 594 594 if (windowClass->getStyle() & CS_PARENTDC) { 595 dprintf(("WARNING: Class with CS_PARENTDC style!"));596 595 fParentDC = TRUE; 597 596 ownDC = 0; … … 624 623 hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0; 625 624 626 // Subclass frame627 pOldFrameProc = FrameSubclassFrameWindow(this);628 629 625 /* Send the WM_GETMINMAXINFO message and fix the size if needed */ 630 626 if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD))) … … 656 652 OffsetRect(&rectClient, -rectClient.left, -rectClient.top); 657 653 658 if (getParent()) mapWin32Rect(getParent()->getOS2WindowHandle(),OSLIB_HWND_DESKTOP,&rectWindow);659 654 /* Send the WM_CREATE message 660 655 * Perhaps we shouldn't allow width/height changes as well. … … 667 662 668 663 if(fTaskList) { 669 hTaskList = OSLibWinAddToTaskList(OS2Hwnd Frame, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);664 hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0); 670 665 } 671 666 … … 690 685 rectWindow.bottom = cs->y+cs->cy; 691 686 tmpRect = rectWindow; 692 if (getParent()) mapWin32Rect(getParent()->getOS2WindowHandle(),OSLIB_HWND_DESKTOP,&rectWindow);693 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);694 687 695 688 rectClient = rectWindow; 696 689 OffsetRect(&rectClient, -rectClient.left, -rectClient.top); 690 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top); 697 691 698 692 //set the window size and update the client … … 855 849 ULONG Win32BaseWindow::MsgHitTest(MSG *msg) 856 850 { 857 lastHitTestVal = DispatchM essageA(msg);858 859 dprintf2(("MsgHitTest %x (%d,%d) (%d,%d) (%d,%d) returned %x", getWindowHandle(), LOWORD(msg->lParam), HIWORD(msg->lParam), rectWindow.left, rectWindow. right, rectWindow.top, rectWindow.bottom, lastHitTestVal));851 lastHitTestVal = DispatchMsgA(msg); 852 853 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)); 860 854 861 855 if (lastHitTestVal == HTTRANSPARENT) … … 878 872 //default processing is cancelled 879 873 //TODO: According to Wine we should proceed anyway if window is sysmodal 880 #if 0881 874 if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate) 882 875 { 876 dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing")); 883 877 return 0; 884 878 } 885 #endif886 879 /* child windows get WM_CHILDACTIVATE message */ 887 880 if((getStyle() & (WS_CHILD | WS_POPUP)) == WS_CHILD ) … … 995 988 996 989 //SvL: Calling OSLibSetActiveWindow(hwndTop); causes focus problems 997 if (win32top) OSLibWinSetFocus(win32top->getOS2 FrameWindowHandle());990 if (win32top) OSLibWinSetFocus(win32top->getOS2WindowHandle()); 998 991 } 999 992 } … … 1023 1016 1024 1017 if (hdcErase == 0) 1025 hdcErase = O32_GetDC(OS2Hwnd);1018 hdcErase = GetDC(getWindowHandle()); 1026 1019 1027 1020 if(IsWindowIconic()) … … 1030 1023 rc = SendInternalMessageA(WM_ERASEBKGND, hdcErase, 0); 1031 1024 if (hdc == 0) 1032 O32_ReleaseDC(OS2Hwnd, hdcErase);1025 ReleaseDC(getWindowHandle(), hdcErase); 1033 1026 return (rc); 1034 1027 } … … 1055 1048 RECT rect; 1056 1049 1057 if (GetOS2UpdateRect(OS2HwndFrame,&rect))1050 if(GetOS2UpdateRect(this,&rect)) 1058 1051 { 1059 1052 HRGN hrgn; … … 1073 1066 if (!hrgn) return 0; 1074 1067 1075 rc = SendInternalMessageA(WM_NCPAINT, hrgn,0);1068 rc = SendInternalMessageA(WM_NCPAINT, hrgn, 0); 1076 1069 1077 1070 DeleteObject(hrgn); … … 1093 1086 if(lpWndPos) 1094 1087 { 1095 POINT point; 1096 1097 //set new window rectangle 1098 point.x = lpWndPos->x; 1099 point.y = lpWndPos->y; 1100 if (getParent()) ClientToScreen(getParent()->getWindowHandle(),&point); 1101 1102 setWindowRect(point.x,point.y,point.x+lpWndPos->cx,point.y+lpWndPos->cy); 1103 newWindowRect = rectWindow; 1088 //set new window rectangle 1089 setWindowRect(lpWndPos->x, lpWndPos->y, lpWndPos->x+lpWndPos->cx, 1090 lpWndPos->y+lpWndPos->cy); 1091 newWindowRect = rectWindow; 1104 1092 } 1105 1093 else { 1106 wndPos.hwnd = getWindowHandle(); 1107 wndPos.hwndInsertAfter = 0; 1108 newWindowRect= rectWindow; 1109 if (getParent()) { 1110 mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),&newWindowRect); 1111 } 1112 wndPos.x = newWindowRect.left; 1113 wndPos.y = newWindowRect.top; 1114 wndPos.cx = newWindowRect.right - newWindowRect.left; 1115 wndPos.cy = newWindowRect.bottom - newWindowRect.top; 1116 wndPos.flags = SWP_FRAMECHANGED; 1117 lpWndPos = &wndPos; 1118 1119 if (getParent()) { 1120 newWindowRect= rectWindow; //reset; was modified 1121 } 1094 wndPos.hwnd = getWindowHandle(); 1095 wndPos.hwndInsertAfter = 0; 1096 newWindowRect= rectWindow; 1097 wndPos.x = newWindowRect.left; 1098 wndPos.y = newWindowRect.top; 1099 wndPos.cx = newWindowRect.right - newWindowRect.left; 1100 wndPos.cy = newWindowRect.bottom - newWindowRect.top; 1101 wndPos.flags = SWP_FRAMECHANGED; 1102 lpWndPos = &wndPos; 1122 1103 } 1123 1104 … … 1125 1106 1126 1107 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)); 1108 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)); 1127 1109 return rc; 1128 1110 } … … 1169 1151 BOOL Win32BaseWindow::isFrameWindow() 1170 1152 { 1171 // if(isMDIChild() || IsDialog() || (getParent() == NULL || getParent() == windowDesktop) && ((dwStyle & WS_CAPTION) == WS_CAPTION)) 1172 if((dwStyle & WS_CAPTION) == WS_CAPTION || dwStyle & (WS_VSCROLL|WS_HSCROLL)) 1153 if(getParent() == NULL) 1173 1154 return TRUE; 1174 1155 … … 1343 1324 HandleNCPaint((HRGN)1); 1344 1325 if(hTaskList) { 1345 OSLibWinChangeTaskList(hTaskList, OS2Hwnd Frame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);1326 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 1346 1327 } 1347 1328 } … … 1355 1336 { 1356 1337 setStyle(getStyle() | WS_VISIBLE); 1357 OSLibWinEnableWindowUpdate(OS2Hwnd Frame,TRUE);1338 OSLibWinEnableWindowUpdate(OS2Hwnd,TRUE); 1358 1339 } 1359 1340 else … … 1362 1343 { 1363 1344 setStyle(getStyle() & ~WS_VISIBLE); 1364 OSLibWinEnableWindowUpdate(OS2Hwnd Frame,FALSE);1345 OSLibWinEnableWindowUpdate(OS2Hwnd,FALSE); 1365 1346 } 1366 1347 } … … 1742 1723 hIcon = (HICON)lParam; 1743 1724 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 1744 OSLibWinSetIcon(OS2Hwnd Frame,hIcon);1725 OSLibWinSetIcon(OS2Hwnd,hIcon); 1745 1726 } 1746 1727 } … … 1803 1784 HandleNCPaint((HRGN)1); 1804 1785 if(hTaskList) { 1805 OSLibWinChangeTaskList(hTaskList, OS2Hwnd Frame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);1786 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 1806 1787 } 1807 1788 } … … 1868 1849 if (getParent()) 1869 1850 { 1870 POINTS pt = MAKEPOINTS(lParam);1871 POINT point;1872 1873 point.x = pt.x;1874 point.y = pt.y;1875 mapWin32Point(OS2Hwnd,getParent()->getOS2WindowHandle(),(OSLIBPOINT*)&point);1876 NotifyParent(Msg,wParam,MAKELPARAM(point.x,point.y));1851 POINTS pt = MAKEPOINTS(lParam); 1852 POINT point; 1853 1854 point.x = pt.x; 1855 point.y = pt.y; 1856 MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1); 1857 NotifyParent(Msg,wParam,MAKELPARAM(point.x,point.y)); 1877 1858 } 1878 1859 rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam); … … 2057 2038 BOOL Win32BaseWindow::ShowWindow(ULONG nCmdShow) 2058 2039 { 2059 ULONG s howstate= 0;2040 ULONG swp = 0; 2060 2041 HWND hWinAfter; 2061 2042 BOOL rc,wasVisible,showFlag; 2043 RECT newPos = {0, 0, 0, 0}; 2062 2044 2063 2045 dprintf(("ShowWindow %x %x", getWindowHandle(), nCmdShow)); 2064 2046 2047 wasVisible = (getStyle() & WS_VISIBLE) != 0; 2048 2065 2049 switch(nCmdShow) 2066 2050 { 2067 case SW_SHOW: 2068 case SW_SHOWDEFAULT: //todo 2069 showstate = SWPOS_SHOW | SWPOS_ACTIVATE; 2070 break; 2071 case SW_HIDE: 2072 if (!wasVisible) return wasVisible; 2073 if(GetCapture() == getWindowHandle() || IsChild(GetCapture())) 2074 ReleaseCapture(); 2075 2076 showstate = SWPOS_HIDE; 2077 break; 2078 case SW_RESTORE: 2079 showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE; 2080 break; 2081 case SW_MINIMIZE: 2082 showstate = SWPOS_MINIMIZE; 2083 break; 2084 case SW_SHOWMAXIMIZED: 2085 showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE; 2086 break; 2087 case SW_SHOWMINIMIZED: 2088 showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE; 2089 break; 2090 case SW_SHOWMINNOACTIVE: 2091 showstate = SWPOS_MINIMIZE | SWPOS_SHOW; 2092 break; 2093 case SW_SHOWNA: 2094 showstate = SWPOS_SHOW; 2095 break; 2096 case SW_SHOWNOACTIVATE: 2097 showstate = SWPOS_SHOW; 2098 break; 2099 case SW_SHOWNORMAL: 2100 showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW; 2101 break; 2102 } 2103 2104 /* We can't activate a child window (WINE) */ 2051 case SW_HIDE: 2052 if (!wasVisible) goto END; 2053 swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | 2054 SWP_NOACTIVATE | SWP_NOZORDER; 2055 break; 2056 2057 case SW_SHOWMINNOACTIVE: 2058 swp |= SWP_NOACTIVATE | SWP_NOZORDER; 2059 /* fall through */ 2060 case SW_SHOWMINIMIZED: 2061 swp |= SWP_SHOWWINDOW; 2062 /* fall through */ 2063 case SW_MINIMIZE: 2064 swp |= SWP_FRAMECHANGED; 2065 if( !(getStyle() & WS_MINIMIZE) ) 2066 swp |= MinMaximize(SW_MINIMIZE, &newPos ); 2067 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2068 break; 2069 2070 case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */ 2071 swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; 2072 if( !(getStyle() & WS_MAXIMIZE) ) 2073 swp |= MinMaximize(SW_MAXIMIZE, &newPos ); 2074 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2075 break; 2076 2077 case SW_SHOWNA: 2078 swp |= SWP_NOACTIVATE | SWP_NOZORDER; 2079 /* fall through */ 2080 case SW_SHOW: 2081 swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE; 2082 2083 /* 2084 * ShowWindow has a little peculiar behavior that if the 2085 * window is already the topmost window, it will not 2086 * activate it. 2087 */ 2088 if (::GetTopWindow((HWND)0)==getWindowHandle() && (wasVisible || GetActiveWindow() == getWindowHandle())) 2089 swp |= SWP_NOACTIVATE; 2090 2091 break; 2092 2093 case SW_SHOWNOACTIVATE: 2094 swp |= SWP_NOZORDER; 2095 if (GetActiveWindow()) swp |= SWP_NOACTIVATE; 2096 /* fall through */ 2097 case SW_SHOWNORMAL: /* same as SW_NORMAL: */ 2098 case SW_SHOWDEFAULT: /* FIXME: should have its own handler */ 2099 case SW_RESTORE: 2100 swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; 2101 2102 if( getStyle() & (WS_MINIMIZE | WS_MAXIMIZE) ) 2103 swp |= MinMaximize(SW_RESTORE, &newPos ); 2104 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2105 break; 2106 } 2107 2108 showFlag = (nCmdShow != SW_HIDE); 2109 if (showFlag != wasVisible) 2110 { 2111 SendInternalMessageA(WM_SHOWWINDOW, showFlag, 0 ); 2112 if (!::IsWindow( getWindowHandle() )) goto END; 2113 } 2114 2115 /* We can't activate a child window */ 2105 2116 if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_MDICHILD)) 2106 showstate &= ~SWPOS_ACTIVATE; 2107 2108 if(showstate & SWPOS_SHOW) { 2109 setStyle(getStyle() | WS_VISIBLE); 2110 if(hTaskList) { 2111 OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 2112 } 2113 } 2114 else { 2115 if(hTaskList) { 2116 OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 2117 } 2118 setStyle(getStyle() & ~WS_VISIBLE); 2119 } 2120 showFlag = (nCmdShow != SW_HIDE); 2121 2122 rc = OSLibWinShowWindow(OS2HwndFrame, showstate); 2123 OSLibWinShowWindow(OS2Hwnd, showstate); 2124 2125 SendInternalMessageA(WM_SHOWWINDOW, (showstate & SWPOS_SHOW) ? 1 : 0, 0); 2126 2127 //CB: PMFrame: WM_MINMAXFRAME SWP_* handling isn't always successful! 2128 if ((showstate & SWPOS_MAXIMIZE) == SWPOS_MAXIMIZE) 2129 setStyle((getStyle() & ~WS_MINIMIZE) | WS_MAXIMIZE); 2130 else if ((showstate & SWPOS_MINIMIZE) == SWPOS_MINIMIZE) 2131 setStyle((getStyle() & ~WS_MAXIMIZE) | WS_MINIMIZE); 2132 else if ((showstate & SWPOS_RESTORE) == SWPOS_RESTORE) 2133 setStyle(getStyle() & ~(WS_MINIMIZE | WS_MAXIMIZE)); 2117 swp |= SWP_NOACTIVATE | SWP_NOZORDER; 2118 2119 SetWindowPos(HWND_TOP, newPos.left, newPos.top, newPos.right, newPos.bottom, LOWORD(swp)); 2134 2120 2135 2121 if (flags & WIN_NEED_SIZE) … … 2150 2136 SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top)); 2151 2137 } 2152 2153 return rc;2138 END: 2139 return wasVisible; 2154 2140 } 2155 2141 //****************************************************************************** … … 2160 2146 Win32BaseWindow *window; 2161 2147 HWND hParent = 0; 2148 RECT oldClientRect = rectClient; 2162 2149 2163 2150 if (fuFlags & … … 2224 2211 if(~fuFlags & (SWP_NOMOVE | SWP_NOSIZE)) 2225 2212 { 2226 if (isChild()) 2227 { 2228 Win32BaseWindow *windowParent = getParent(); 2229 if(windowParent) { 2230 hParent = getParent()->getOS2WindowHandle(); 2231 } 2232 else dprintf(("WARNING: Win32BaseWindow::SetWindowPos window %x is child but has no parent!!", getWindowHandle())); 2233 } 2234 OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld); 2235 } 2236 2237 OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, hParent, OS2HwndFrame); 2213 if (isChild()) 2214 { 2215 if(!getParent()) { 2216 dprintf(("WARNING: Win32BaseWindow::SetWindowPos window %x is child but has no parent!!", getWindowHandle())); 2217 } 2218 } 2219 OSLibWinQueryWindowPos(OS2Hwnd, &swpOld); 2220 } 2221 2222 if(getParent()) { 2223 OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, getParent()->getWindowHeight(), 2224 getParent()->getClientRectPtr()->left, 2225 getParent()->getClientRectPtr()->top, 2226 OS2Hwnd); 2227 } 2228 else OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, OSLibQueryScreenHeight(), 0, 0, OS2Hwnd); 2238 2229 if (swp.fl == 0) { 2239 if (fuFlags & SWP_FRAMECHANGED) 2240 { 2241 FrameUpdateClient(this); 2230 if(fuFlags & SWP_FRAMECHANGED) 2231 { 2232 MsgFormatFrame(NULL); 2233 UnionRect(&oldClientRect, &oldClientRect, &rectClient); 2234 InvalidateRect(getWindowHandle(), &oldClientRect, TRUE); 2235 //TODO: move child windows!! 2242 2236 } 2243 2237 return TRUE; … … 2249 2243 Win32BaseWindow *wndBehind = Win32BaseWindow::GetWindowFromHandle(swp.hwndInsertBehind); 2250 2244 if(wndBehind) { 2251 swp.hwndInsertBehind = wndBehind->getOS2 FrameWindowHandle();2245 swp.hwndInsertBehind = wndBehind->getOS2WindowHandle(); 2252 2246 } 2253 2247 else { … … 2256 2250 } 2257 2251 } 2258 swp.hwnd = OS2Hwnd Frame;2252 swp.hwnd = OS2Hwnd; 2259 2253 2260 2254 dprintf (("WinSetWindowPos %x %x (%d,%d)(%d,%d) %x", swp.hwnd, swp.hwndInsertBehind, swp.x, swp.y, swp.cx, swp.cy, swp.fl)); 2255 rc = OSLibWinSetMultWindowPos(&swp, 1); 2261 2256 2262 2257 if(fuFlags & SWP_SHOWWINDOW && !IsWindowVisible()) { 2263 2258 setStyle(getStyle() | WS_VISIBLE); 2264 //SvL: TODO: Send WM_SHOWWINDOW??2265 OSLibWinShowWindow(OS2Hwnd, SWPOS_SHOW);2266 2259 if(hTaskList) { 2267 OSLibWinChangeTaskList(hTaskList, OS2Hwnd Frame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);2260 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 2268 2261 } 2269 2262 } … … 2271 2264 if(fuFlags & SWP_HIDEWINDOW && IsWindowVisible()) { 2272 2265 setStyle(getStyle() & ~WS_VISIBLE); 2273 //SvL: TODO: Send WM_SHOWWINDOW??2274 OSLibWinShowWindow(OS2Hwnd, SWPOS_HIDE);2275 2266 if(hTaskList) { 2276 OSLibWinChangeTaskList(hTaskList, OS2Hwnd Frame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);2267 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 2277 2268 } 2278 2269 } 2279 rc = OSLibWinSetMultWindowPos(&swp, 1);2280 2270 2281 2271 if(rc == FALSE) … … 2287 2277 if((fuFlags & SWP_FRAMECHANGED) && (fuFlags & (SWP_NOMOVE | SWP_NOSIZE) == (SWP_NOMOVE | SWP_NOSIZE))) 2288 2278 { 2289 FrameUpdateClient(this); 2279 UnionRect(&oldClientRect, &oldClientRect, &rectClient); 2280 InvalidateRect(getWindowHandle(), &oldClientRect, TRUE); 2281 //TODO: move child windows!! 2290 2282 } 2291 2283 return (rc); 2292 2284 } 2293 2285 //****************************************************************************** 2294 //TODO: WPF_RESTOREMAXIMIZED 2295 //****************************************************************************** 2296 BOOL Win32BaseWindow::SetWindowPlacement(WINDOWPLACEMENT *winpos) 2297 { 2298 if(isFrameWindow()) 2286 //****************************************************************************** 2287 BOOL Win32BaseWindow::SetWindowPlacement(WINDOWPLACEMENT *wndpl) 2288 { 2289 windowpos.ptMinPosition = wndpl->ptMinPosition; 2290 windowpos.ptMaxPosition = wndpl->ptMaxPosition; 2291 windowpos.rcNormalPosition = wndpl->rcNormalPosition; 2292 2293 if(getStyle() & WS_MINIMIZE ) 2299 2294 { 2300 // Set the minimized position 2301 if (winpos->flags & WPF_SETMINPOSITION) 2302 { 2303 OSLibSetWindowMinPos(OS2HwndFrame, winpos->ptMinPosition.x, winpos->ptMinPosition.y); 2304 } 2305 2306 //TODO: Max position 2307 2308 // Set the new restore position. 2309 OSLibSetWindowRestoreRect(OS2HwndFrame, &winpos->rcNormalPosition); 2295 //TODO: Why can't this be (0,0)? 2296 if(wndpl->flags & WPF_SETMINPOSITION && !(!windowpos.ptMinPosition.x && !windowpos.ptMinPosition.y)) { 2297 SetWindowPos(0, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y, 2298 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 2299 } 2310 2300 } 2311 2312 return ShowWindow(winpos->showCmd); 2301 else 2302 if(getStyle() & WS_MAXIMIZE ) 2303 { 2304 //TODO: Why can't this be (0,0)? 2305 if(windowpos.ptMaxPosition.x != 0 || windowpos.ptMaxPosition.y != 0 ) 2306 SetWindowPos(0, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y, 2307 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 2308 } 2309 else { 2310 SetWindowPos(0, windowpos.rcNormalPosition.left, windowpos.rcNormalPosition.top, 2311 windowpos.rcNormalPosition.right - windowpos.rcNormalPosition.left, 2312 windowpos.rcNormalPosition.bottom - windowpos.rcNormalPosition.top, 2313 SWP_NOZORDER | SWP_NOACTIVATE ); 2314 } 2315 ShowWindow(wndpl->showCmd); 2316 if( ::IsWindow(getWindowHandle()) && getStyle() & WS_MINIMIZE ) 2317 { 2318 /* SDK: ...valid only the next time... */ 2319 if(wndpl->flags & WPF_RESTORETOMAXIMIZED) 2320 setFlags(getFlags() | WIN_RESTORE_MAX); 2321 } 2322 return TRUE; 2323 } 2324 //****************************************************************************** 2325 //****************************************************************************** 2326 BOOL Win32BaseWindow::GetWindowPlacement(LPWINDOWPLACEMENT wndpl) 2327 { 2328 wndpl->length = sizeof(*wndpl); 2329 if(getStyle() & WS_MINIMIZE ) 2330 wndpl->showCmd = SW_SHOWMINIMIZED; 2331 else wndpl->showCmd = (getStyle() & WS_MAXIMIZE) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL; 2332 2333 if(getFlags() & WIN_RESTORE_MAX ) 2334 wndpl->flags = WPF_RESTORETOMAXIMIZED; 2335 else wndpl->flags = 0; 2336 2337 wndpl->ptMinPosition = windowpos.ptMinPosition; 2338 wndpl->ptMaxPosition = windowpos.ptMaxPosition; 2339 wndpl->rcNormalPosition = windowpos.rcNormalPosition; 2340 2341 return TRUE; 2313 2342 } 2314 2343 //****************************************************************************** … … 2360 2389 2361 2390 fDestroyWindowCalled = TRUE; 2362 return OSLibWinDestroyWindow(OS2Hwnd Frame);2391 return OSLibWinDestroyWindow(OS2Hwnd); 2363 2392 } 2364 2393 //****************************************************************************** … … 2373 2402 HWND Win32BaseWindow::GetParent() 2374 2403 { 2375 Win32BaseWindow *wndparent; 2376 2377 if ((!(getStyle() & (WS_POPUP|WS_CHILD)))) 2378 { 2379 return 0; 2380 } 2381 wndparent = ((getStyle() & WS_CHILD) ? getParent() : getOwner()); 2382 2383 return (wndparent) ? wndparent->getWindowHandle() : 0; 2404 if(getStyle() & WS_CHILD) { 2405 if(getParent()) { 2406 return getParent()->getWindowHandle(); 2407 } 2408 DebugInt3(); 2409 return 0; 2410 } 2411 else return (getOwner()) ? getOwner()->getWindowHandle() : 0; 2384 2412 } 2385 2413 //****************************************************************************** … … 2390 2418 Win32BaseWindow *newparent; 2391 2419 Win32BaseWindow *oldparent = (Win32BaseWindow *)ChildWindow::GetParent(); 2420 BOOL fShow = FALSE; 2392 2421 2393 2422 if(oldparent) { … … 2397 2426 else oldhwnd = 0; 2398 2427 2428 /* Windows hides the window first, then shows it again 2429 * including the WM_SHOWWINDOW messages and all */ 2430 if(fCreated && (getStyle() & WS_VISIBLE)) { 2431 ShowWindow(SW_HIDE); 2432 fShow = TRUE; 2433 } 2434 2399 2435 newparent = GetWindowFromHandle(hwndNewParent); 2400 2436 if(newparent) … … 2402 2438 setParent(newparent); 2403 2439 getParent()->AddChild(this); 2404 OSLibWinSetParent(getOS2FrameWindowHandle(), getParent()->getOS2WindowHandle()); 2405 return oldhwnd; 2440 OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle()); 2406 2441 } 2407 2442 else { 2408 2443 setParent(windowDesktop); 2409 2444 windowDesktop->AddChild(this); 2410 OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP); 2411 return oldhwnd; 2445 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP); 2412 2446 } 2447 /* SetParent additionally needs to make hwndChild the topmost window 2448 in the x-order and send the expected WM_WINDOWPOSCHANGING and 2449 WM_WINDOWPOSCHANGED notification messages. 2450 */ 2451 if(fCreated) { 2452 SetWindowPos(HWND_TOPMOST, 0, 0, 0, 0, 2453 SWP_NOMOVE|SWP_NOSIZE|(fShow? SWP_SHOWWINDOW : 0)); 2454 2455 /* FIXME: a WM_MOVE is also generated (in the DefWindowProc handler 2456 * for WM_WINDOWPOSCHANGED) in Windows, should probably remove SWP_NOMOVE */ 2457 } 2458 return oldhwnd; 2413 2459 } 2414 2460 //****************************************************************************** … … 2601 2647 hwnd = OSLibWinQueryClientWindow(hwnd); 2602 2648 if(hwnd) wnd = GetWindowFromOS2Handle(hwnd); 2603 if(!hwnd) wnd = GetWindowFromOS2FrameHandle(hwnd);2604 2649 } 2605 2650 … … 2703 2748 2704 2749 dprintf(("SetActiveWindow %x", getWindowHandle())); 2705 if(OSLibWinSetActiveWindow(OS2Hwnd Frame) == FALSE) {2706 dprintf(("OSLibWinSetActiveWindow %x returned FALSE!", OS2Hwnd Frame));2750 if(OSLibWinSetActiveWindow(OS2Hwnd) == FALSE) { 2751 dprintf(("OSLibWinSetActiveWindow %x returned FALSE!", OS2Hwnd)); 2707 2752 } 2708 2753 hwndActive = GetActiveWindow(); … … 2721 2766 SendMessageA(WM_CANCELMODE, 0, 0); 2722 2767 } 2723 OSLibWinEnableWindow(OS2Hwnd Frame, fEnable);2768 OSLibWinEnableWindow(OS2Hwnd, fEnable); 2724 2769 if(fEnable == FALSE) { 2725 2770 //SvL: No need to clear focus as PM already does this … … 2735 2780 BOOL Win32BaseWindow::CloseWindow() 2736 2781 { 2737 return OSLibWinMinimizeWindow(OS2Hwnd Frame);2782 return OSLibWinMinimizeWindow(OS2Hwnd); 2738 2783 } 2739 2784 //****************************************************************************** … … 2756 2801 BOOL Win32BaseWindow::IsWindowEnabled() 2757 2802 { 2758 return OSLibWinIsWindowEnabled(OS2Hwnd Frame);2803 return OSLibWinIsWindowEnabled(OS2Hwnd); 2759 2804 } 2760 2805 //****************************************************************************** … … 2762 2807 BOOL Win32BaseWindow::IsWindowVisible() 2763 2808 { 2809 //TODO: Do we have to check the state of the parent window? (as Wine does) 2764 2810 #if 1 2765 2811 return (dwStyle & WS_VISIBLE) == WS_VISIBLE; 2766 2812 #else 2767 return OSLibWinIsWindowVisible(OS2Hwnd Frame);2813 return OSLibWinIsWindowVisible(OS2Hwnd); 2768 2814 #endif 2769 2815 } … … 2900 2946 setStyle(ss.styleNew); 2901 2947 SendInternalMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss); 2902 //// OSLibSetWindowStyle(getOS2 FrameWindowHandle(), getStyle(), getExStyle(),2948 //// OSLibSetWindowStyle(getOS2WindowHandle(), getStyle(), getExStyle(), 2903 2949 //// windowClass->getStyle() & CS_SAVEBITS); 2904 2950 #ifdef DEBUG … … 2961 3007 break; 2962 3008 case GWL_HWNDPARENT: 2963 if(getParent()) { 2964 value = getParent()->getWindowHandle(); 2965 } 2966 else value = 0; 3009 value = GetParent(); 2967 3010 break; 2968 3011 case GWL_ID: … … 3029 3072 } 3030 3073 //****************************************************************************** 3031 //Note: Should return NULL if window is frame window! (IsOS2FrameWindowHandle depends on this3032 // behaviour)3033 3074 //****************************************************************************** 3034 3075 Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2Handle(HWND hwnd) … … 3053 3094 //****************************************************************************** 3054 3095 //****************************************************************************** 3055 Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2FrameHandle(HWND hwnd)3056 {3057 return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT));3058 }3059 //******************************************************************************3060 //******************************************************************************3061 3096 HWND Win32BaseWindow::Win32ToOS2Handle(HWND hwnd) 3062 3097 { … … 3071 3106 //****************************************************************************** 3072 3107 //****************************************************************************** 3073 HWND Win32BaseWindow::Win32ToOS2FrameHandle(HWND hwnd)3074 {3075 Win32BaseWindow *window = GetWindowFromHandle(hwnd);3076 3077 if(window) {3078 return window->getOS2FrameWindowHandle();3079 }3080 // dprintf2(("Win32BaseWindow::Win32ToOS2FrameHandle: not a win32 window %x", hwnd));3081 return hwnd;3082 }3083 //******************************************************************************3084 //******************************************************************************3085 3108 HWND Win32BaseWindow::OS2ToWin32Handle(HWND hwnd) 3086 3109 { 3087 3110 Win32BaseWindow *window = GetWindowFromOS2Handle(hwnd); 3088 3111 3089 if(window) {3090 return window->getWindowHandle();3091 }3092 window = GetWindowFromOS2FrameHandle(hwnd);3093 3112 if(window) { 3094 3113 return window->getWindowHandle(); … … 3099 3118 } 3100 3119 //****************************************************************************** 3101 //******************************************************************************3102 BOOL Win32BaseWindow::IsOS2FrameWindowHandle(HWND hwndWin32, HWND hwndOS2)3103 {3104 Win32BaseWindow *window = GetWindowFromHandle(hwndWin32);3105 3106 if(window->getOS2FrameWindowHandle() == hwndOS2) {3107 return TRUE;3108 }3109 return FALSE;3110 }3111 //******************************************************************************3112 // GetNextDlgTabItem32 (USER32.276)3113 3120 //****************************************************************************** 3114 3121 HWND Win32BaseWindow::getNextDlgTabItem(HWND hwndCtrl, BOOL fPrevious) -
trunk/src/user32/win32wbase.h
r3610 r3662 1 /* $Id: win32wbase.h,v 1.9 6 2000-05-26 18:43:35sandervl Exp $ */1 /* $Id: win32wbase.h,v 1.97 2000-06-07 14:51:31 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 104 104 virtual ~Win32BaseWindow(); 105 105 106 virtual ULONG MsgCreate(HWND hwnd Frame, HWND hwndClient);106 virtual ULONG MsgCreate(HWND hwndOS2); 107 107 ULONG MsgQuit(); 108 108 ULONG MsgClose(); … … 145 145 HWND getWindowHandle() { return Win32Hwnd; }; 146 146 HWND getOS2WindowHandle() { return OS2Hwnd; }; 147 HWND getOS2FrameWindowHandle() { return OS2HwndFrame; };148 147 Win32WndClass *getWindowClass() { return windowClass; }; 149 148 … … 212 211 BOOL SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags); 213 212 BOOL SetWindowPlacement(WINDOWPLACEMENT *winpos); 213 BOOL GetWindowPlacement(LPWINDOWPLACEMENT winpos); 214 214 BOOL DestroyWindow(); 215 215 HWND SetActiveWindow(); … … 297 297 298 298 static HWND Win32ToOS2Handle(HWND hwnd); 299 static HWND Win32ToOS2FrameHandle(HWND hwnd);300 299 static HWND OS2ToWin32Handle(HWND hwnd); 301 static BOOL IsOS2FrameWindowHandle(HWND hwndWin32, HWND hwndOS2);302 300 303 301 static Win32BaseWindow *GetWindowFromHandle(HWND hwnd); 304 302 static Win32BaseWindow *GetWindowFromOS2Handle(HWND hwnd); 305 static Win32BaseWindow *GetWindowFromOS2FrameHandle(HWND hwnd);306 303 307 304 static void DestroyAll(); 308 309 PVOID getOldFrameProc() { return pOldFrameProc; };310 VOID setOldFrameProc(PVOID aOldFrameProc) { pOldFrameProc = aOldFrameProc; };311 312 PVOID getOldWndProc() { return pOldWndProc; }313 VOID setOldWndProc(PVOID aOldWndProc) { pOldWndProc = aOldWndProc; }314 305 315 306 protected: … … 326 317 327 318 HWND OS2Hwnd; 328 HWND OS2HwndFrame;329 319 HMENU hSysMenu; 330 320 HWND Win32Hwnd; … … 371 361 DWORD dwThreadId; //id of thread that created this window 372 362 DWORD dwProcessId; //id of process that created this window 373 PVOID pOldFrameProc;374 375 PVOID pOldWndProc;376 363 377 364 Win32BaseWindow *owner; … … 385 372 ULONG nrUserWindowLong; 386 373 387 RECT rectWindow; //relative to screen 388 RECT rectClient; //relative to parent 374 RECT rectWindow; //relative to parent 375 RECT rectClient; //relative to frame 376 WINDOWPLACEMENT windowpos; 389 377 390 378 PROPERTY *propertyList; … … 405 393 #ifndef OS2_INCLUDED 406 394 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack ); 395 UINT MinMaximize(UINT cmd, LPRECT lpRect); 407 396 LONG HandleWindowPosChanging(WINDOWPOS *winpos); 408 397 LONG HandleNCActivate(WPARAM wParam); -
trunk/src/user32/win32wbasenonclient.cpp
r3625 r3662 1 /* $Id: win32wbasenonclient.cpp,v 1.2 3 2000-05-28 16:43:47sandervl Exp $ */1 /* $Id: win32wbasenonclient.cpp,v 1.24 2000-06-07 14:51:32 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (non-client methods) … … 211 211 } 212 212 213 pt.x -= rectWindow.left; 214 pt.y -= rectWindow.top; 215 SCROLL_HandleScrollEvent(Win32Hwnd,0,MAKELONG(pt.x,pt.y),scrollbar,WM_LBUTTONDOWN); 213 ScreenToClient(getWindowHandle(), &pt); 214 pt.x += rectClient.left; 215 pt.y += rectClient.top; 216 217 SCROLL_HandleScrollEvent(getWindowHandle(),0,MAKELONG(pt.x,pt.y),scrollbar,WM_LBUTTONDOWN); 216 218 if (GetCapture() != Win32Hwnd) return; 217 219 do … … 224 226 case WM_LBUTTONUP: 225 227 case WM_MOUSEMOVE: 226 pt.x = msg.pt.x-rectWindow.left; 227 pt.y = msg.pt.y-rectWindow.top; 228 pt.x = msg.pt.x; 229 pt.y = msg.pt.y; 230 ScreenToClient(getWindowHandle(), &pt); 231 pt.x += rectClient.left; 232 pt.y += rectClient.top; 228 233 msg.lParam = MAKELONG(pt.x,pt.y); 229 234 … … 262 267 { 263 268 //SvL: Calling topparent->SetActiveWindow() causes focus problems 264 OSLibWinSetFocus(topparent->getOS2FrameWindowHandle()); 269 // topparent->SetActiveWindow(); 270 OSLibWinSetFocus(topparent->getOS2WindowHandle()); 265 271 } 266 272 267 273 if (GetActiveWindow() == topparent->getWindowHandle()) 268 274 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam); 275 else dprintf(("ACtive window (%x) != toplevel wnd %x", OSLibWinQueryActiveWindow(), topparent->getWindowHandle())); 269 276 break; 270 277 } … … 425 432 LONG Win32BaseWindow::HandleNCHitTest(POINT pt) 426 433 { 427 RECT rect = rectWindow;434 RECT rect; 428 435 429 436 if (dwStyle & WS_MINIMIZE) return HTCAPTION; 437 438 GetWindowRect(getWindowHandle(), &rect); 430 439 431 440 if (!PtInRect(&rect,pt)) return HTNOWHERE; … … 1007 1016 //only redraw caption 1008 1017 GetRgnBox(clip,&rectClip); 1018 #if 1 1009 1019 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx 1010 1020 // with a region that covers the entire window (RealPlayer 7 Update 1) … … 1016 1026 rectClip = rect; 1017 1027 } 1028 #endif 1018 1029 } 1019 1030 else … … 1122 1133 } 1123 1134 1124 ReleaseDC( Win32Hwnd,hdc);1135 ReleaseDC(getWindowHandle(),hdc); 1125 1136 IncreaseLogCount(); 1126 1137 dprintf(("**DoNCPaint %x DONE", getWindowHandle())); … … 1305 1316 1306 1317 case SC_TASKLIST: 1307 OSLibWinShowTaskList(getOS2 FrameWindowHandle());1318 OSLibWinShowTaskList(getOS2WindowHandle()); 1308 1319 break; 1309 1320 -
trunk/src/user32/win32wbasepos.cpp
r3625 r3662 1 /* $Id: win32wbasepos.cpp,v 1.1 4 2000-05-28 16:43:47sandervl Exp $ */1 /* $Id: win32wbasepos.cpp,v 1.15 2000-06-07 14:51:32 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (nonclient/position methods) … … 37 37 #include "pmframe.h" 38 38 #include "win32wdesktop.h" 39 #include <win\hook.h> 39 40 40 41 #define DBG_LOCALLOG DBG_win32wbasepos … … 130 131 LONG result; 131 132 132 params.rgrc[0] = *newWindowRect; 133 if (calcValidRect) 134 { 135 winposCopy = *winpos; 136 params.rgrc[1] = *oldWindowRect; 137 if(getParent()) {//in parent coordinates 138 MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), (POINT *)oldClientRect, 2); 139 } 140 else {//in screen coordinates (just add window rectangle origin (already in screen coordinates)) 141 OffsetRect(oldClientRect, rectWindow.left, rectWindow.top); 142 } 143 params.rgrc[2] = *oldClientRect; 144 params.lppos = &winposCopy; 145 } 146 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)¶ms ); 147 148 /* If the application send back garbage, ignore it */ 149 if (params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom) 150 { 151 *newClientRect = params.rgrc[0]; 152 //client rectangle now in screen coordinates; convert to 'frame' coordinates 153 OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top); 154 } 155 133 /* Send WM_NCCALCSIZE message to get new client area */ 134 // if((winpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE ) 135 // { 136 params.rgrc[0] = *newWindowRect; 137 if(calcValidRect) 138 { 139 winposCopy = *winpos; 140 params.rgrc[1] = *oldWindowRect; 141 //client rectangel must be in parent coordinates 142 OffsetRect(oldClientRect, rectWindow.left, rectWindow.top); 143 144 params.rgrc[2] = *oldClientRect; 145 params.lppos = &winposCopy; 146 } 147 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)¶ms ); 148 149 /* If the application send back garbage, ignore it */ 150 if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom) 151 { 152 *newClientRect = params.rgrc[0]; 153 //client rectangle now in parent coordinates; convert to 'frame' coordinates 154 OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top); 155 } 156 157 /* FIXME: WVR_ALIGNxxx */ 158 if(newClientRect->left != rectClient.left || newClientRect->top != rectClient.top) 159 winpos->flags &= ~SWP_NOCLIENTMOVE; 160 161 if((newClientRect->right - newClientRect->left != rectClient.right - rectClient.left) || 162 (newClientRect->bottom - newClientRect->top != rectClient.bottom - rectClient.top)) 163 winpos->flags &= ~SWP_NOCLIENTSIZE; 164 165 // } 166 // else 167 // if(!(winpos->flags & SWP_NOMOVE) && 168 // (newClientRect->left != rectClient.left || newClientRect->top != rectClient.top)) { 169 // winpos->flags &= ~SWP_NOCLIENTMOVE; 170 // } 156 171 return result; 157 172 } … … 175 190 return 0; 176 191 } 192 /****************************************************************************** 193 * WINPOS_MinMaximize 194 * 195 * Fill in lpRect and return additional flags to be used with SetWindowPos(). 196 * This function assumes that 'cmd' is different from the current window 197 * state. 198 */ 199 UINT Win32BaseWindow::MinMaximize(UINT cmd, LPRECT lpRect) 200 { 201 UINT swpFlags = 0; 202 POINT size; 203 204 size.x = rectWindow.left; 205 size.y = rectWindow.top; 206 207 if(IsRectEmpty(&windowpos.rcNormalPosition)) { 208 CopyRect(&windowpos.rcNormalPosition, &rectWindow); 209 } 210 if(!HOOK_CallHooksA(WH_CBT, HCBT_MINMAX, getWindowHandle(), cmd)) 211 { 212 if(getStyle() & WS_MINIMIZE ) 213 { 214 if(!SendInternalMessageA(WM_QUERYOPEN, 0, 0L)) 215 return (SWP_NOSIZE | SWP_NOMOVE); 216 } 217 switch( cmd ) 218 { 219 case SW_MINIMIZE: 220 if( getStyle() & WS_MAXIMIZE) 221 { 222 setFlags(getFlags() | WIN_RESTORE_MAX); 223 setStyle(getStyle() & ~WS_MAXIMIZE); 224 } 225 else setFlags(getFlags() & ~WIN_RESTORE_MAX); 226 227 setStyle(getStyle() | WS_MINIMIZE); 228 229 SetRect(lpRect, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y, 230 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 231 break; 232 233 case SW_MAXIMIZE: 234 GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL ); 235 236 if(getStyle() & WS_MINIMIZE ) 237 { 238 setStyle(getStyle() & ~WS_MINIMIZE); 239 } 240 setStyle(getStyle() | WS_MAXIMIZE); 241 242 SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y, 243 size.x, size.y ); 244 break; 245 246 case SW_RESTORE: 247 if(getStyle() & WS_MINIMIZE) 248 { 249 setStyle(getStyle() & ~WS_MINIMIZE); 250 251 if( getFlags() & WIN_RESTORE_MAX) 252 { 253 /* Restore to maximized position */ 254 GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL); 255 setStyle(getStyle() | WS_MAXIMIZE); 256 SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y, size.x, size.y); 257 break; 258 } 259 } 260 else 261 if( !(getStyle() & WS_MAXIMIZE) ) 262 return 0; 263 else setStyle(getStyle() & ~WS_MAXIMIZE); 264 265 /* Restore to normal position */ 266 267 *lpRect = windowpos.rcNormalPosition; 268 lpRect->right -= lpRect->left; 269 lpRect->bottom -= lpRect->top; 270 break; 271 } 272 } 273 else swpFlags |= SWP_NOSIZE | SWP_NOMOVE; 274 275 return swpFlags; 276 } 177 277 //****************************************************************************** 178 278 //****************************************************************************** 179 -
trunk/src/user32/win32wdesktop.cpp
r2803 r3662 1 /* $Id: win32wdesktop.cpp,v 1.1 2 2000-02-16 14:28:24sandervl Exp $ */1 /* $Id: win32wdesktop.cpp,v 1.13 2000-06-07 14:51:33 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Desktop Window for OS/2 … … 46 46 Win32Desktop::Win32Desktop() : Win32BaseWindow(OBJTYPE_WINDOW) 47 47 { 48 OSLibWinQueryWindowRect(OSLIB_HWND_DESKTOP, &rectWindow, RELATIVE_TO_SCREEN); 48 rectWindow.left = 0; 49 rectWindow.top = 0; 50 rectWindow.right = OSLibQueryScreenWidth(); 51 rectWindow.bottom = OSLibQueryScreenHeight(); 52 49 53 OS2Hwnd = OSLIB_HWND_DESKTOP; 50 OS2HwndFrame = OSLIB_HWND_DESKTOP;51 54 rectClient = rectWindow; 52 55 -
trunk/src/user32/win32wmdiclient.cpp
r3625 r3662 1 /* $Id: win32wmdiclient.cpp,v 1.2 8 2000-05-28 16:43:47sandervl Exp $ */1 /* $Id: win32wmdiclient.cpp,v 1.29 2000-06-07 14:51:33 sandervl Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 985 985 SetRectEmpty( &childRect ); 986 986 987 //TODO: Check if this goes correctly 987 988 for (win32wnd = (Win32BaseWindow*)win32wnd->getFirstChild();win32wnd;win32wnd = (Win32BaseWindow*)win32wnd->getNextChild()) 988 989 { -
trunk/src/user32/window.cpp
r3513 r3662 1 /* $Id: window.cpp,v 1.6 7 2000-05-10 13:14:44sandervl Exp $ */1 /* $Id: window.cpp,v 1.68 2000-06-07 14:51:33 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 7 7 * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch) 8 8 * 9 * Parts based on Wine Windows code (windows\win.c, windows\property.c )9 * Parts based on Wine Windows code (windows\win.c, windows\property.c, windows\winpos.c) 10 10 * 11 * Copyright 1993, 1994 Alexandre Julliard 11 * Copyright 1993, 1994, 1995 Alexandre Julliard 12 * 1995, 1996, 1999 Alex Korobka 12 13 * 13 14 * Project Odin Software License can be found in LICENSE.TXT … … 445 446 { 446 447 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE ); 448 } 449 /*********************************************************************** 450 * SetInternalWindowPos (USER32.483) 451 */ 452 void WIN32API SetInternalWindowPos(HWND hwnd, 453 UINT showCmd, 454 LPRECT lpRect, 455 LPPOINT lpPoint ) 456 { 457 dprintf(("USER32: SetInternalWindowPos(%08xh,%08xh,%08xh,%08xh)", 458 hwnd, showCmd, lpRect, lpPoint)); 459 460 if( IsWindow(hwnd) ) 461 { 462 WINDOWPLACEMENT wndpl; 463 UINT flags; 464 465 GetWindowPlacement(hwnd, &wndpl); 466 wndpl.length = sizeof(wndpl); 467 wndpl.showCmd = showCmd; 468 wndpl.flags = 0; 469 470 if(lpPoint) 471 { 472 wndpl.flags |= WPF_SETMINPOSITION; 473 wndpl.ptMinPosition = *lpPoint; 474 } 475 if(lpRect) 476 { 477 wndpl.rcNormalPosition = *lpRect; 478 } 479 SetWindowPlacement( hwnd, &wndpl); 480 } 481 482 } 483 /*********************************************************************** 484 * GetInternalWindowPos (USER32.245) 485 */ 486 UINT WIN32API GetInternalWindowPos(HWND hwnd, 487 LPRECT rectWnd, 488 LPPOINT ptIcon ) 489 { 490 WINDOWPLACEMENT wndpl; 491 492 dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n", 493 hwnd, 494 rectWnd, 495 ptIcon)); 496 497 if(GetWindowPlacement( hwnd, &wndpl )) 498 { 499 if (rectWnd) *rectWnd = wndpl.rcNormalPosition; 500 if (ptIcon) *ptIcon = wndpl.ptMinPosition; 501 return wndpl.showCmd; 502 } 503 return 0; 447 504 } 448 505 //****************************************************************************** … … 519 576 dprintf(("SetWindowPlacement, window %x not found", hwnd)); 520 577 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 521 return 0; 522 } 578 return FALSE; 579 } 580 if(!winpos) { 581 dprintf(("SetWindowPlacement %x invalid parameter", hwnd)); 582 SetLastError(ERROR_INVALID_PARAMETER); 583 return FALSE; 584 } 585 dprintf(("USER32: SetWindowPlacement %x %x", hwnd, winpos)); 523 586 return window->SetWindowPlacement((WINDOWPLACEMENT *)winpos); 524 587 } 525 588 //****************************************************************************** 526 589 //****************************************************************************** 527 BOOL WIN32API GetWindowPlacement(HWND hwnd, LPWINDOWPLACEMENT arg2) 528 { 529 dprintf(("USER32: GetWindowPlacement\n")); 530 return O32_GetWindowPlacement(Win32BaseWindow::Win32ToOS2FrameHandle(hwnd), arg2); 590 BOOL WIN32API GetWindowPlacement(HWND hwnd, LPWINDOWPLACEMENT winpos) 591 { 592 Win32BaseWindow *window; 593 594 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 595 if(!window) { 596 dprintf(("GetWindowPlacement, window %x not found", hwnd)); 597 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 598 return FALSE; 599 } 600 if(!winpos) { 601 dprintf(("GetWindowPlacement %x invalid parameter", hwnd)); 602 SetLastError(ERROR_INVALID_PARAMETER); 603 return FALSE; 604 } 605 dprintf(("USER32: GetWindowPlacement %x %x", hwnd, winpos)); 606 return window->GetWindowPlacement(winpos); 531 607 } 532 608 //****************************************************************************** … … 609 685 //****************************************************************************** 610 686 //****************************************************************************** 611 /***********************************************************************612 * GetInternalWindowPos (USER32.245)613 */614 UINT WIN32API GetInternalWindowPos(HWND hwnd,615 LPRECT rectWnd,616 LPPOINT ptIcon )617 {618 WINDOWPLACEMENT wndpl;619 620 dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",621 hwnd,622 rectWnd,623 ptIcon));624 625 if (GetWindowPlacement( hwnd, &wndpl ))626 {627 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;628 if (ptIcon) *ptIcon = wndpl.ptMinPosition;629 return wndpl.showCmd;630 }631 return 0;632 }633 //******************************************************************************634 //******************************************************************************635 687 BOOL WIN32API IsZoomed(HWND hwnd) 636 688 { 637 689 dprintf(("USER32: IsZoomed\n")); 638 return O32_IsZoomed(Win32BaseWindow::Win32ToOS2 FrameHandle(hwnd));690 return O32_IsZoomed(Win32BaseWindow::Win32ToOS2Handle(hwnd)); 639 691 } 640 692 //****************************************************************************** … … 643 695 { 644 696 dprintf(("USER32: LockWindowUpdate\n")); 645 return O32_LockWindowUpdate(Win32BaseWindow::Win32ToOS2 FrameHandle(hwnd));697 return O32_LockWindowUpdate(Win32BaseWindow::Win32ToOS2Handle(hwnd)); 646 698 } 647 699 //****************************************************************************** … … 665 717 return FALSE; 666 718 } 667 *pRect = *window->getWindowRect(); //always in screen coordinates 719 *pRect = *window->getWindowRect(); 720 721 //convert from parent coordinates to screen (if necessary) 722 if(window->getParent()) { 723 MapWindowPoints(window->getParent()->getWindowHandle(), 0, (PPOINT)pRect, 2); 724 } 668 725 669 726 dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom)); … … 862 919 /* Coordinate Space and Transformation Functions */ 863 920 //****************************************************************************** 921 /******************************************************************* 922 * WINPOS_GetWinOffset 923 * 924 * Calculate the offset between the origin of the two windows. Used 925 * to implement MapWindowPoints. 926 */ 927 static void WINPOS_GetWinOffset( Win32BaseWindow *wndFrom, Win32BaseWindow *wndTo, 928 POINT *offset ) 929 { 930 Win32BaseWindow *window; 931 932 offset->x = offset->y = 0; 933 934 /* Translate source window origin to screen coords */ 935 if(wndFrom != windowDesktop) 936 { 937 window = wndFrom; 938 while(window) 939 { 940 offset->x += window->getClientRectPtr()->left + window->getWindowRect()->left; 941 offset->y += window->getClientRectPtr()->top + window->getWindowRect()->top; 942 window = window->getParent(); 943 } 944 } 945 946 /* Translate origin to destination window coords */ 947 if(wndTo != windowDesktop) 948 { 949 window = wndTo; 950 while(window) 951 { 952 offset->x -= window->getClientRectPtr()->left + window->getWindowRect()->left; 953 offset->y -= window->getClientRectPtr()->top + window->getWindowRect()->top; 954 window = window->getParent(); 955 } 956 } 957 } 958 //****************************************************************************** 959 //****************************************************************************** 864 960 int WIN32API MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints, 865 961 UINT cPoints) … … 867 963 Win32BaseWindow *wndfrom, *wndto; 868 964 int retval = 0; 869 OSLIBPOINT point;965 POINT offset; 870 966 871 967 SetLastError(0); … … 899 995 return 0; //nothing to do 900 996 901 dprintf(("USER32: MapWindowPoints %x to %x (%d,%d) (%d)", hwndFrom, hwndTo, lpPoints->x, lpPoints->y, cPoints)); 902 point.x = lpPoints->x; 903 point.y = lpPoints->y; 904 if (!mapWin32Point(wndfrom,wndto,&point)) 905 { 906 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 907 return 0; 908 } 909 910 short int xinc = point.x - lpPoints->x; 911 short int yinc = point.y - lpPoints->y; 997 dprintf2(("USER32: MapWindowPoints %x to %x (%d,%d) (%d)", hwndFrom, hwndTo, lpPoints->x, lpPoints->y, cPoints)); 998 WINPOS_GetWinOffset(wndfrom, wndto, &offset); 912 999 913 1000 for(int i=0;i<cPoints;i++) 914 1001 { 915 lpPoints[i].x += xinc;916 lpPoints[i].y += yinc;917 } 918 retval = ((LONG) yinc << 16) | xinc;1002 lpPoints[i].x += offset.x; 1003 lpPoints[i].y += offset.y; 1004 } 1005 retval = ((LONG)offset.y << 16) | offset.x; 919 1006 return retval; 920 1007 } … … 927 1014 BOOL rc; 928 1015 929 if (!hwnd) return (TRUE); 1016 if(!hwnd) { 1017 return (TRUE); 1018 } 930 1019 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 931 1020 if (!wnd) { … … 938 1027 POINT tmp = *pt; 939 1028 #endif 940 rc = mapWin32Point(OSLIB_HWND_DESKTOP, wnd->getOS2WindowHandle(), (OSLIBPOINT*)pt);941 dprintf (("ScreenToClient %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y));942 return rc;1029 MapWindowPoints(0, hwnd, pt, 1); 1030 dprintf2(("ScreenToClient %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y)); 1031 return TRUE; 943 1032 } 944 1033 //****************************************************************************** … … 1049 1138 Win32BaseWindow *wnd; 1050 1139 PRECT rcl; 1051 BOOL rc;1052 1140 1053 1141 if (!hwnd) { … … 1064 1152 POINT tmp = *pt; 1065 1153 #endif 1066 rc = mapWin32Point(wnd->getOS2WindowHandle(),OSLIB_HWND_DESKTOP,(OSLIBPOINT*)pt);1067 dprintf (("ClientToScreen %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y));1068 1069 return rc;1154 MapWindowPoints(hwnd, 0, pt, 1); 1155 dprintf2(("ClientToScreen %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y)); 1156 1157 return TRUE; 1070 1158 } 1071 1159 //****************************************************************************** … … 1397 1485 { 1398 1486 dprintf(("USER32: ArrangeIconicWindows %x", hwnd)); 1399 return O32_ArrangeIconicWindows(Win32BaseWindow::Win32ToOS2 FrameHandle(hwnd));1487 return O32_ArrangeIconicWindows(Win32BaseWindow::Win32ToOS2Handle(hwnd)); 1400 1488 } 1401 1489 //****************************************************************************** … … 1416 1504 { 1417 1505 dprintf(("USER32: ShowOwnedPopups (OPEN32: todo) %x", hwnd)); 1418 return O32_ShowOwnedPopups(Win32BaseWindow::Win32ToOS2 FrameHandle(hwnd), arg2);1506 return O32_ShowOwnedPopups(Win32BaseWindow::Win32ToOS2Handle(hwnd), arg2); 1419 1507 } 1420 1508 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.