Changeset 3662 for trunk/src/user32/window.cpp
- Timestamp:
- Jun 7, 2000, 4:51:33 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.