Changeset 3662 for trunk/src/user32/oslibwin.cpp
- Timestamp:
- Jun 7, 2000, 4:51:33 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.