Changeset 4463 for trunk/src/user32/window.cpp
- Timestamp:
- Oct 9, 2000, 7:26:55 PM (25 years ago)
- File:
-
- 1 edited
-
trunk/src/user32/window.cpp (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/window.cpp
r4460 r4463 1 /* $Id: window.cpp,v 1. 79 2000-10-08 20:05:29sandervl Exp $ */1 /* $Id: window.cpp,v 1.80 2000-10-09 17:26:55 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 16 16 * 17 17 * TODO: Decide what to do about commands for OS/2 windows (non-Win32 apps) 18 * TODO: ShowOwnedPopups needs to be tested 19 * GetLastActivePopup needs to be rewritten 20 * ArrangeIconicWindows probably also 18 21 * 19 22 */ … … 32 35 #include "winicon.h" 33 36 #include <win\winpos.h> 37 #include <win\win.h> 34 38 #include <heapstring.h> 35 39 … … 289 293 if(!window) { 290 294 dprintf(("CreateMDIWindowW, window %x not found", hwndParent)); 291 SetLastError(ERROR_INVALID_WINDOW_HANDLE);295 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 292 296 return 0; 293 297 } … … 319 323 } 320 324 if(window->isDesktopWindow()) { 321 dprintf(("WARNING: Trying to destroy desktop window!"));322 return FALSE;325 dprintf(("WARNING: Trying to destroy desktop window!")); 326 return FALSE; 323 327 } 324 328 return window->DestroyWindow(); … … 366 370 } 367 371 if(hwndNewParent == HWND_DESKTOP) { 368 hwndNewParent = GetDesktopWindow();372 hwndNewParent = GetDesktopWindow(); 369 373 } 370 374 else { 371 parent = Win32BaseWindow::GetWindowFromHandle(hwndNewParent);372 if(!window) {373 dprintf(("SetParent, parent %x not found", hwndNewParent));374 SetLastError(ERROR_INVALID_WINDOW_HANDLE);375 return 0;376 }375 parent = Win32BaseWindow::GetWindowFromHandle(hwndNewParent); 376 if(!window) { 377 dprintf(("SetParent, parent %x not found", hwndNewParent)); 378 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 379 return 0; 380 } 377 381 } 378 382 dprintf(("SetParent %x %x", hwndChild, hwndNewParent)); … … 402 406 403 407 if(hwnd == HWND_DESKTOP) { 404 window = windowDesktop;408 window = windowDesktop; 405 409 } 406 410 else { 407 window = Win32BaseWindow::GetWindowFromHandle(hwnd);408 if(!window) {409 dprintf(("GetTopWindow, window %x not found", hwnd));410 SetLastError(ERROR_INVALID_WINDOW_HANDLE);411 return 0;412 }411 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 412 if(!window) { 413 dprintf(("GetTopWindow, window %x not found", hwnd)); 414 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 415 return 0; 416 } 413 417 } 414 418 hwndTop = window->GetTopWindow(); … … 482 486 if( IsWindow(hwnd) ) 483 487 { 484 WINDOWPLACEMENT wndpl;485 UINT flags;488 WINDOWPLACEMENT wndpl; 489 UINT flags; 486 490 487 491 GetWindowPlacement(hwnd, &wndpl); 488 wndpl.length = sizeof(wndpl);489 wndpl.showCmd = showCmd;490 wndpl.flags = 0;491 492 if(lpPoint)493 {492 wndpl.length = sizeof(wndpl); 493 wndpl.showCmd = showCmd; 494 wndpl.flags = 0; 495 496 if(lpPoint) 497 { 494 498 wndpl.flags |= WPF_SETMINPOSITION; 495 wndpl.ptMinPosition = *lpPoint;496 }497 if(lpRect)498 {499 wndpl.ptMinPosition = *lpPoint; 500 } 501 if(lpRect) 502 { 499 503 wndpl.rcNormalPosition = *lpRect; 500 }504 } 501 505 SetWindowPlacement( hwnd, &wndpl); 502 506 } … … 747 751 //convert from parent coordinates to screen (if necessary) 748 752 if(window->getParent()) { 749 MapWindowPoints(window->getParent()->getWindowHandle(), 0, (PPOINT)pRect, 2);753 MapWindowPoints(window->getParent()->getWindowHandle(), 0, (PPOINT)pRect, 2); 750 754 } 751 755 … … 807 811 int rc = window->GetWindowTextW(lpsz, cch); 808 812 if(rc) { 809 LPSTR astring = UnicodeToAsciiString(lpsz);810 dprintf(("GetWindowTextW %x %s", hwnd, lpsz));811 free(astring);813 LPSTR astring = UnicodeToAsciiString(lpsz); 814 dprintf(("GetWindowTextW %x %s", hwnd, lpsz)); 815 free(astring); 812 816 } 813 817 else dprintf(("GetWindowTextW %x returned %d", hwnd, rc)); … … 848 852 dprintf(("SetWindowTextW %x %s", hwnd, astring)); 849 853 free(astring); 850 if(hwnd == 0x68000008) {851 int i;852 i = 5;853 }854 854 #endif 855 855 return window->SetWindowTextW((LPWSTR)lpsz); … … 913 913 if(style == 0 && menu == FALSE && exStyle == 0) { 914 914 dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d) -> no change required", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom)); 915 return TRUE;//nothing needs to be changed (VERIFIED in NT 4)915 return TRUE; //nothing needs to be changed (VERIFIED in NT 4) 916 916 } 917 917 dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d)\n", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom)); 918 918 /* Correct the window style */ 919 919 if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */ 920 style |= WS_CAPTION;920 style |= WS_CAPTION; 921 921 922 922 //SvL: Include WS_POPUP -> otherwise HAS_THINFRAME is true for popup windows … … 949 949 //Adjust rect inner (Win32BaseWindow::AdjustRectInner) 950 950 if(!(style & WS_ICONIC)) { 951 if (exStyle & WS_EX_CLIENTEDGE)952 InflateRect (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));953 954 if (exStyle & WS_EX_STATICEDGE)955 InflateRect (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));956 957 //SvL: scrollbars aren't checked *UNLESS* the style includes a border (any border)951 if (exStyle & WS_EX_CLIENTEDGE) 952 InflateRect (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); 953 954 if (exStyle & WS_EX_STATICEDGE) 955 InflateRect (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); 956 957 //SvL: scrollbars aren't checked *UNLESS* the style includes a border (any border) 958 958 // --> VERIFIED IN NT4, SP6 (fixes MFC apps with scrollbars + bar controls) 959 if(style & (WS_THICKFRAME|WS_BORDER|WS_DLGFRAME)) {960 if (style & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL);961 if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);962 }959 if(style & (WS_THICKFRAME|WS_BORDER|WS_DLGFRAME)) { 960 if (style & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL); 961 if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL); 962 } 963 963 } 964 964 … … 986 986 if(wndFrom != windowDesktop) 987 987 { 988 window = wndFrom;988 window = wndFrom; 989 989 while(window) 990 990 { … … 998 998 if(wndTo != windowDesktop) 999 999 { 1000 window = wndTo;1000 window = wndTo; 1001 1001 while(window) 1002 1002 { … … 1066 1066 1067 1067 if(!hwnd) { 1068 return (TRUE);1068 return (TRUE); 1069 1069 } 1070 1070 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); … … 1552 1552 BOOL WIN32API OpenIcon(HWND hwnd) 1553 1553 { 1554 dprintf(("USER32: OpenIcon"));1554 dprintf(("USER32: OpenIcon %x", hwnd)); 1555 1555 1556 1556 if(!IsIconic(hwnd)) … … 1560 1560 } 1561 1561 //****************************************************************************** 1562 //****************************************************************************** 1563 BOOL WIN32API ShowOwnedPopups( HWND hwnd, BOOL arg2) 1564 { 1565 dprintf(("USER32: ShowOwnedPopups (OPEN32: todo) %x", hwnd)); 1566 return O32_ShowOwnedPopups(Win32BaseWindow::Win32ToOS2Handle(hwnd), arg2); 1562 //SDK: Windows can only be shown with ShowOwnedPopups if they were previously 1563 // hidden with the same api 1564 //TODO: -> needs testing 1565 //****************************************************************************** 1566 BOOL WIN32API ShowOwnedPopups(HWND hwndOwner, BOOL fShow) 1567 { 1568 Win32BaseWindow *window, *owner; 1569 HWND hwnd; 1570 1571 owner = Win32BaseWindow::GetWindowFromHandle(hwndOwner); 1572 if(!owner) { 1573 dprintf(("ShowOwnedPopups, window %x not found", hwndOwner)); 1574 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 1575 return FALSE; 1576 } 1577 dprintf(("USER32: ShowOwnedPopups %x %d", hwnd, fShow)); 1578 1579 hwnd = GetWindow(GetDesktopWindow(), GW_CHILD); 1580 while(hwnd) { 1581 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 1582 if(window) { 1583 if(window == owner && (window->getStyle() & WS_POPUP)) 1584 { 1585 if(fShow) { 1586 if(window->getFlags() & WIN_NEEDS_SHOW_OWNEDPOPUP) 1587 { 1588 /* 1589 * In Windows, ShowOwnedPopups(TRUE) generates WM_SHOWWINDOW messages with SW_PARENTOPENING, 1590 * regardless of the state of the owner 1591 */ 1592 SendMessageA(hwnd, WM_SHOWWINDOW, SW_SHOW, SW_PARENTOPENING); 1593 window->setFlags(window->getFlags() & ~WIN_NEEDS_SHOW_OWNEDPOPUP); 1594 } 1595 } 1596 else 1597 { 1598 if(IsWindowVisible(hwnd)) 1599 { 1600 /* 1601 * In Windows, ShowOwnedPopups(FALSE) generates WM_SHOWWINDOW messages with SW_PARENTCLOSING, 1602 * regardless of the state of the owner 1603 */ 1604 SendMessageA(hwnd, WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING); 1605 window->setFlags(window->getFlags() | WIN_NEEDS_SHOW_OWNEDPOPUP); 1606 } 1607 } 1608 } 1609 } 1610 else dprintf(("WARNING: window %x is not valid", hwnd)); 1611 1612 hwnd = GetWindow(hwnd, GW_HWNDNEXT); 1613 } 1614 return TRUE; 1567 1615 } 1568 1616 //****************************************************************************** … … 1586 1634 hwnd = Win32BaseWindow::OS2ToWin32Handle(O32_GetLastActivePopup(hWnd)); 1587 1635 1588 dprintf(("GetLastActivePopup %x returned %x ", hWnd, hwnd));1636 dprintf(("GetLastActivePopup %x returned %x NOT CORRECTLY IMPLEMENTED", hWnd, hwnd)); 1589 1637 return hwnd; 1590 1638 }
Note:
See TracChangeset
for help on using the changeset viewer.
