- Timestamp:
- Oct 18, 2000, 7:10:50 PM (25 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r4485 r4497 1 /* $Id: win32wbase.cpp,v 1.21 7 2000-10-16 11:02:50sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.218 2000-10-18 17:10:49 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 157 157 158 158 memset(&windowpos, 0, sizeof(windowpos)); 159 //min and max position are initially -1 (verified in NT4, SP6) 160 windowpos.ptMinPosition.x = -1; 161 windowpos.ptMinPosition.y = -1; 162 windowpos.ptMaxPosition.x = -1; 163 windowpos.ptMaxPosition.y = -1; 159 164 } 160 165 //****************************************************************************** … … 164 169 { 165 170 if(hTaskList) { 166 171 OSLibWinRemoveFromTasklist(hTaskList); 167 172 } 168 173 … … 380 385 SetParent(cs->hwndParent); 381 386 // owner = GetWindowFromHandle(cs->hwndParent); 382 387 owner = 0; 383 388 /* if(owner == NULL) 384 389 { … … 652 657 653 658 if(fTaskList) { 654 659 hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0); 655 660 } 656 661 … … 700 705 if(getParent() && getParent()->IsWindowDestroyed() == FALSE) 701 706 { 702 703 707 getParent()->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle()); 708 } 704 709 if(!::IsWindow(getWindowHandle())) 705 710 { … … 710 715 711 716 if(cs->style & WS_VISIBLE) { 712 713 717 dwStyle &= ~WS_VISIBLE; 718 ShowWindow(sw); 714 719 } 715 720 … … 870 875 if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate) 871 876 { 872 877 dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing")); 873 878 return 0; 874 879 } … … 1082 1087 if(lpWndPos) 1083 1088 { 1084 1085 1089 //set new window rectangle 1090 setWindowRect(lpWndPos->x, lpWndPos->y, lpWndPos->x+lpWndPos->cx, 1086 1091 lpWndPos->y+lpWndPos->cy); 1087 1092 newWindowRect = rectWindow; 1088 1093 } 1089 1094 else { 1090 1091 1092 1093 1094 1095 1096 1097 1098 1095 wndPos.hwnd = getWindowHandle(); 1096 wndPos.hwndInsertAfter = 0; 1097 newWindowRect= rectWindow; 1098 wndPos.x = newWindowRect.left; 1099 wndPos.y = newWindowRect.top; 1100 wndPos.cx = newWindowRect.right - newWindowRect.left; 1101 wndPos.cy = newWindowRect.bottom - newWindowRect.top; 1102 wndPos.flags = SWP_FRAMECHANGED; 1103 lpWndPos = &wndPos; 1099 1104 } 1100 1105 … … 1105 1110 1106 1111 #if 1 1107 //this doesn't always work 1108 // if(!fNoSizeMsg && (client.left != rectClient.left || client.top != rectClient.top)) 1109 if(!fNoSizeMsg && ((oldWindowRect.right - oldWindowRect.left < rectClient.left 1112 //this doesn't always work 1113 // if(!fNoSizeMsg && (client.left != rectClient.left || client.top != rectClient.top)) 1114 if(!fNoSizeMsg && ((oldWindowRect.right - oldWindowRect.left < rectClient.left 1110 1115 || oldWindowRect.bottom - oldWindowRect.top < rectClient.top) || 1111 1116 (EqualRect(&oldWindowRect, &rectWindow) && (client.left != rectClient.left || client.top != rectClient.top)))) … … 1113 1118 Win32BaseWindow *child = (Win32BaseWindow *)getFirstChild(); 1114 1119 1115 1116 1117 1118 ::SetWindowPos(child->getWindowHandle(), 1119 HWND_TOP, child->getWindowRect()->left, 1120 child->getWindowRect()->top, 0, 0, 1120 //client rectangle has moved -> inform children 1121 dprintf(("MsgFormatFrame -> client rectangle has changed, move children")); 1122 while(child) { 1123 ::SetWindowPos(child->getWindowHandle(), 1124 HWND_TOP, child->getWindowRect()->left, 1125 child->getWindowRect()->top, 0, 0, 1121 1126 SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER); 1122 1123 1127 child = (Win32BaseWindow *)child->getNextChild(); 1128 } 1124 1129 } 1125 1130 #endif … … 1347 1352 HandleNCPaint((HRGN)1); 1348 1353 if(hTaskList) { 1349 1350 1354 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 1355 } 1351 1356 } 1352 1357 … … 1405 1410 1406 1411 case WM_ACTIVATE: 1407 1408 1409 1410 1411 1412 1413 1412 /* The default action in Windows is to set the keyboard focus to 1413 * the window, if it's being activated and not minimized */ 1414 if (LOWORD(wParam) != WA_INACTIVE) { 1415 if(!(getStyle() & WS_MINIMIZE)) 1416 SetFocus(getWindowHandle()); 1417 } 1418 return 0; 1414 1419 1415 1420 case WM_SETCURSOR: … … 1810 1815 HandleNCPaint((HRGN)1); 1811 1816 if(hTaskList) { 1812 1813 1817 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 1818 } 1814 1819 } 1815 1820 … … 1881 1886 if (getParent()) 1882 1887 { 1883 1884 1885 1886 1887 1888 1889 1888 POINTS pt = MAKEPOINTS(lParam); 1889 POINT point; 1890 1891 point.x = pt.x; 1892 point.y = pt.y; 1893 MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1); 1894 NotifyParent(Msg,wParam,MAKELPARAM(point.x,point.y)); 1890 1895 } 1891 1896 rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam); … … 1987 1992 if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION)) 1988 1993 { 1989 1990 1994 if(type == BROADCAST_SEND) { 1991 1995 ::SendMessageA(window->getWindowHandle(), msg, wParam, lParam); … … 2012 2016 if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION)) 2013 2017 { 2014 2015 2018 if(type == BROADCAST_SEND) { 2016 2019 ::SendMessageW(window->getWindowHandle(), msg, wParam, lParam); … … 2054 2057 if (fType == ICON_BIG) 2055 2058 { 2056 if (hIcon) hWndIcon = hIcon; 2057 else if (windowClass && windowClass->getIcon()) hWndIcon = windowClass->getIcon(); 2058 else if (!(dwStyle & DS_MODALFRAME)) 2059 hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR); 2059 if (hIcon) 2060 hWndIcon = hIcon; 2061 else 2062 if (windowClass && windowClass->getIcon()) 2063 hWndIcon = windowClass->getIcon(); 2064 else 2065 if (!(dwStyle & DS_MODALFRAME)) 2066 hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR); 2060 2067 else hWndIcon = 0; 2061 } else 2068 } 2069 else 2062 2070 { 2063 if (hIconSm) hWndIcon = hIconSm; 2064 else if (hIcon) hWndIcon = hIcon; 2065 else if (windowClass && windowClass->getIconSm()) hWndIcon = windowClass->getIconSm(); 2066 else if (windowClass && windowClass->getIcon()) hWndIcon = windowClass->getIcon(); 2067 else if (!(dwStyle & DS_MODALFRAME)) 2068 hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR); 2071 if (hIconSm) 2072 hWndIcon = hIconSm; 2073 else 2074 if (hIcon) 2075 hWndIcon = hIcon; 2076 else 2077 if (windowClass && windowClass->getIconSm()) 2078 hWndIcon = windowClass->getIconSm(); 2079 else 2080 if (windowClass && windowClass->getIcon()) 2081 hWndIcon = windowClass->getIcon(); 2082 else 2083 if (!(dwStyle & DS_MODALFRAME)) 2084 hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR); 2069 2085 else hWndIcon = 0; 2070 2086 } … … 2086 2102 switch(nCmdShow) 2087 2103 { 2088 case SW_HIDE: 2089 if (!wasVisible) goto END; 2090 swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | 2091 SWP_NOACTIVATE | SWP_NOZORDER; 2092 break; 2093 2094 case SW_SHOWMINNOACTIVE: 2104 case SW_HIDE: 2105 if (!wasVisible) goto END; 2106 swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | 2107 SWP_NOACTIVATE | SWP_NOZORDER; 2108 break; 2109 2110 case SW_SHOWMINNOACTIVE: 2111 swp |= SWP_NOACTIVATE | SWP_NOZORDER; 2112 /* fall through */ 2113 case SW_SHOWMINIMIZED: 2114 swp |= SWP_SHOWWINDOW; 2115 /* fall through */ 2116 case SW_MINIMIZE: 2117 swp |= SWP_FRAMECHANGED; 2118 if( !(getStyle() & WS_MINIMIZE) ) 2119 swp |= MinMaximize(SW_MINIMIZE, &newPos ); 2120 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2121 break; 2122 2123 case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */ 2124 swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; 2125 if( !(getStyle() & WS_MAXIMIZE) ) 2126 swp |= MinMaximize(SW_MAXIMIZE, &newPos ); 2127 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2128 break; 2129 2130 case SW_SHOWNA: 2095 2131 swp |= SWP_NOACTIVATE | SWP_NOZORDER; 2096 2132 /* fall through */ 2097 case SW_SHOWMINIMIZED: 2098 swp |= SWP_SHOWWINDOW; 2099 /* fall through */ 2100 case SW_MINIMIZE: 2101 swp |= SWP_FRAMECHANGED; 2102 if( !(getStyle() & WS_MINIMIZE) ) 2103 swp |= MinMaximize(SW_MINIMIZE, &newPos ); 2104 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2105 break; 2106 2107 case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */ 2108 swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; 2109 if( !(getStyle() & WS_MAXIMIZE) ) 2110 swp |= MinMaximize(SW_MAXIMIZE, &newPos ); 2111 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2112 break; 2113 2114 case SW_SHOWNA: 2115 swp |= SWP_NOACTIVATE | SWP_NOZORDER; 2116 /* fall through */ 2117 case SW_SHOW: 2118 swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE; 2119 2120 /* 2121 * ShowWindow has a little peculiar behavior that if the 2122 * window is already the topmost window, it will not 2123 * activate it. 2124 */ 2125 if (::GetTopWindow((HWND)0)==getWindowHandle() && (wasVisible || GetActiveWindow() == getWindowHandle())) 2126 swp |= SWP_NOACTIVATE; 2127 2128 break; 2129 2130 case SW_SHOWNOACTIVATE: 2131 swp |= SWP_NOZORDER; 2132 if (GetActiveWindow()) swp |= SWP_NOACTIVATE; 2133 /* fall through */ 2134 case SW_SHOWNORMAL: /* same as SW_NORMAL: */ 2135 case SW_SHOWDEFAULT: /* FIXME: should have its own handler */ 2136 case SW_RESTORE: 2137 //TODO: WIN_RESTORE_MAX flag!!!!!!!!!!!!!! 2138 swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; 2139 2140 if( getStyle() & (WS_MINIMIZE | WS_MAXIMIZE) ) 2141 swp |= MinMaximize(SW_RESTORE, &newPos ); 2142 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2143 break; 2133 case SW_SHOW: 2134 swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE; 2135 2136 /* 2137 * ShowWindow has a little peculiar behavior that if the 2138 * window is already the topmost window, it will not 2139 * activate it. 2140 */ 2141 if (::GetTopWindow((HWND)0)==getWindowHandle() && (wasVisible || GetActiveWindow() == getWindowHandle())) 2142 swp |= SWP_NOACTIVATE; 2143 2144 break; 2145 2146 case SW_SHOWNOACTIVATE: 2147 swp |= SWP_NOZORDER; 2148 if (GetActiveWindow()) 2149 swp |= SWP_NOACTIVATE; 2150 /* fall through */ 2151 case SW_SHOWNORMAL: /* same as SW_NORMAL: */ 2152 case SW_SHOWDEFAULT: /* FIXME: should have its own handler */ 2153 case SW_RESTORE: 2154 //TODO: WIN_RESTORE_MAX flag!!!!!!!!!!!!!! 2155 swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; 2156 2157 if( getStyle() & (WS_MINIMIZE | WS_MAXIMIZE) ) 2158 swp |= MinMaximize(SW_RESTORE, &newPos ); 2159 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2160 break; 2144 2161 } 2145 2162 … … 2158 2175 2159 2176 if(!(swp & SWP_NOACTIVATE)) { 2160 2177 OSLibWinSetActiveWindow(OS2Hwnd); 2161 2178 } 2162 2179 … … 2256 2273 { 2257 2274 if(!getParent()) { 2258 2275 dprintf(("WARNING: Win32BaseWindow::SetWindowPos window %x is child but has no parent!!", getWindowHandle())); 2259 2276 } 2260 2277 } … … 2267 2284 getParent()->getClientRectPtr()->top, 2268 2285 OS2Hwnd); 2269 } 2286 } 2270 2287 else OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, OSLibQueryScreenHeight(), 0, 0, OS2Hwnd); 2271 2288 if (swp.fl == 0) { 2272 2289 if(fuFlags & SWP_FRAMECHANGED) 2273 { 2274 2275 2276 2277 2290 { 2291 MsgFormatFrame(NULL); 2292 UnionRect(&oldClientRect, &oldClientRect, &rectClient); 2293 OffsetRect(&oldClientRect, -rectClient.left, -rectClient.top); 2294 InvalidateRect(getWindowHandle(), &oldClientRect, TRUE); 2278 2295 } 2279 2296 return TRUE; … … 2296 2313 if(fuFlags & SWP_SHOWWINDOW && !IsWindowVisible()) { 2297 2314 setStyle(getStyle() | WS_VISIBLE); 2298 2299 2300 2301 2315 if(hTaskList) { 2316 dprintf(("Adding window %x to tasklist", getWindowHandle())); 2317 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 2318 } 2302 2319 } 2303 2320 else 2304 2321 if(fuFlags & SWP_HIDEWINDOW && IsWindowVisible()) { 2305 2322 setStyle(getStyle() & ~WS_VISIBLE); 2306 2307 2308 2309 2323 if(hTaskList) { 2324 dprintf(("Removing window %x from tasklist", getWindowHandle())); 2325 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0); 2326 } 2310 2327 } 2311 2328 dprintf (("WinSetWindowPos %x %x (%d,%d)(%d,%d) %x", swp.hwnd, swp.hwndInsertBehind, swp.x, swp.y, swp.cx, swp.cy, swp.fl)); … … 2315 2332 { 2316 2333 dprintf(("OSLibWinSetMultWindowPos failed! Error %x",OSLibWinGetLastError())); 2317 2334 return 0; 2318 2335 } 2319 2336 2320 2337 if((fuFlags & SWP_FRAMECHANGED) && (fuFlags & (SWP_NOMOVE | SWP_NOSIZE) == (SWP_NOMOVE | SWP_NOSIZE))) 2321 2338 { 2322 2339 UnionRect(&oldClientRect, &oldClientRect, &rectClient); 2323 2340 OffsetRect(&oldClientRect, -rectClient.left, -rectClient.top); 2324 2341 InvalidateRect(getWindowHandle(), &oldClientRect, TRUE); 2325 2342 } 2326 2343 return (rc); … … 2328 2345 //****************************************************************************** 2329 2346 //TODO: Check how this api really works in NT 2330 // This implemention doesn't make a lot of sense to me (compared to the2331 // description in the SDK docs)2332 2347 //****************************************************************************** 2333 2348 BOOL Win32BaseWindow::SetWindowPlacement(WINDOWPLACEMENT *wndpl) … … 2339 2354 if(getStyle() & WS_MINIMIZE ) 2340 2355 { 2341 2342 2343 2344 2345 } 2356 //TODO: Why can't this be (0,0)? 2357 if(wndpl->flags & WPF_SETMINPOSITION && !(!windowpos.ptMinPosition.x && !windowpos.ptMinPosition.y)) { 2358 SetWindowPos(0, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y, 2359 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 2360 } 2346 2361 } 2347 2362 else 2348 2363 if(getStyle() & WS_MAXIMIZE ) 2349 2364 { 2350 2351 2352 2353 2365 //TODO: Why can't this be (0,0)? 2366 if(windowpos.ptMaxPosition.x != 0 || windowpos.ptMaxPosition.y != 0 ) 2367 SetWindowPos(0, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y, 2368 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 2354 2369 } 2355 2370 else { 2356 //Papyrus calls this api with rcNormalPosition set to 02357 //So the rcNormalPosition should probably not affect the current position2358 #if 02359 2371 SetWindowPos(0, windowpos.rcNormalPosition.left, windowpos.rcNormalPosition.top, 2360 windowpos.rcNormalPosition.right - windowpos.rcNormalPosition.left, 2361 windowpos.rcNormalPosition.bottom - windowpos.rcNormalPosition.top, 2362 SWP_NOZORDER | SWP_NOACTIVATE ); 2363 #endif 2372 windowpos.rcNormalPosition.right - windowpos.rcNormalPosition.left, 2373 windowpos.rcNormalPosition.bottom - windowpos.rcNormalPosition.top, 2374 SWP_NOZORDER | SWP_NOACTIVATE ); 2364 2375 } 2365 2376 ShowWindow(wndpl->showCmd); 2366 2377 if( ::IsWindow(getWindowHandle()) && getStyle() & WS_MINIMIZE ) 2367 2378 { 2368 2369 if(wndpl->flags & WPF_RESTORETOMAXIMIZED)2370 2379 /* SDK: ...valid only the next time... */ 2380 if(wndpl->flags & WPF_RESTORETOMAXIMIZED) 2381 setFlags(getFlags() | WIN_RESTORE_MAX); 2371 2382 } 2372 2383 return TRUE; … … 2376 2387 BOOL Win32BaseWindow::GetWindowPlacement(LPWINDOWPLACEMENT wndpl) 2377 2388 { 2378 wndpl->length 2389 wndpl->length = sizeof(*wndpl); 2379 2390 if(getStyle() & WS_MINIMIZE ) 2380 2391 wndpl->showCmd = SW_SHOWMINIMIZED; 2381 2392 else wndpl->showCmd = (getStyle() & WS_MAXIMIZE) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL; 2382 2393 2394 //TODO: Verify if this is correct -> SDK docs claim this flag must always be set to 0 2383 2395 if(getFlags() & WIN_RESTORE_MAX ) 2384 2396 wndpl->flags = WPF_RESTORETOMAXIMIZED; … … 2387 2399 wndpl->ptMinPosition = windowpos.ptMinPosition; 2388 2400 wndpl->ptMaxPosition = windowpos.ptMaxPosition; 2389 wndpl->rcNormalPosition = windowpos.rcNormalPosition; 2401 //Must be in parent coordinates (or screen if no parent); verified in NT4, SP6 2402 wndpl->rcNormalPosition = rectWindow; 2390 2403 2391 2404 return TRUE; … … 2452 2465 { 2453 2466 if((!(getStyle() & (WS_POPUP|WS_CHILD)))) { 2454 2467 return 0; 2455 2468 } 2456 2469 … … 2458 2471 2459 2472 if(getStyle() & WS_CHILD) { 2460 2461 2462 2463 2464 2465 2466 } 2467 else 2473 if(wndparent) { 2474 return wndparent->getWindowHandle(); 2475 } 2476 dprintf(("WARNING: GetParent: WS_CHILD but no parent!!")); 2477 DebugInt3(); 2478 return 0; 2479 } 2480 else return (getOwner()) ? getOwner()->getWindowHandle() : 0; 2468 2481 } 2469 2482 //****************************************************************************** … … 2485 2498 * including the WM_SHOWWINDOW messages and all */ 2486 2499 if(fCreated && (getStyle() & WS_VISIBLE)) { 2487 2488 2500 ShowWindow(SW_HIDE); 2501 fShow = TRUE; 2489 2502 } 2490 2503 … … 2497 2510 if(!(getStyle() & WS_CHILD)) 2498 2511 { 2499 2500 2501 2512 //TODO: Send WM_STYLECHANGED msg? 2513 setStyle(getStyle() | WS_CHILD); 2514 if(getWindowId()) 2502 2515 { 2503 2516 DestroyMenu( (HMENU) getWindowId() ); … … 2510 2523 windowDesktop->addChild(this); 2511 2524 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP); 2512 2513 2514 2525 2526 //TODO: Send WM_STYLECHANGED msg? 2527 setStyle(getStyle() & ~WS_CHILD); 2515 2528 setWindowId(0); 2516 2529 } 2517 2530 /* SetParent additionally needs to make hwndChild the topmost window 2518 2531 in the x-order and send the expected WM_WINDOWPOSCHANGING and 2519 WM_WINDOWPOSCHANGED notification messages. 2532 WM_WINDOWPOSCHANGED notification messages. 2520 2533 */ 2521 2534 if(fCreated) { 2522 2523 2535 SetWindowPos(HWND_TOPMOST, 0, 0, 0, 0, 2536 SWP_NOMOVE|SWP_NOSIZE|(fShow? SWP_SHOWWINDOW : 0)); 2524 2537 2525 2538 /* FIXME: a WM_MOVE is also generated (in the DefWindowProc handler … … 2546 2559 hwndTop = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP); 2547 2560 if(!isDesktopWindow()) { 2548 2549 2550 2551 2552 return 0; 2561 topwindow = GetWindowFromOS2Handle(hwndTop); 2562 if(topwindow) { 2563 return topwindow->getWindowHandle(); 2564 } 2565 return 0; 2553 2566 } 2554 2567 while(hwndTop) { 2555 2556 2557 2558 2559 2568 topwindow = GetWindowFromOS2Handle(hwndTop); 2569 if(topwindow) { 2570 return topwindow->getWindowHandle(); 2571 } 2572 hwndTop = OSLibWinQueryWindow(hwndTop, QWOS_NEXT); 2560 2573 } 2561 2574 … … 2769 2782 window = (Win32BaseWindow *)getParent(); 2770 2783 hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP); 2771 2772 2784 window = GetWindowFromOS2Handle(hwndRelated); 2785 if(window) { 2773 2786 hwndRelated = window->getWindowHandle(); 2774 2787 } 2775 2788 else hwndRelated = 0; 2776 2789 } 2777 2790 else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop 2778 2791 break; 2779 2792 2780 2793 case GW_HWNDLAST: 2781 2782 2783 2794 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_BOTTOM); 2795 window = GetWindowFromOS2Handle(hwndRelated); 2796 if(window) { 2784 2797 hwndRelated = window->getWindowHandle(); 2785 2798 } 2786 2799 else hwndRelated = 0; 2787 2800 break; 2788 2801 2789 2802 case GW_HWNDNEXT: 2790 2791 2792 2803 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_NEXT); 2804 window = GetWindowFromOS2Handle(hwndRelated); 2805 if(window) { 2793 2806 hwndRelated = window->getWindowHandle(); 2794 2807 } 2795 2808 else hwndRelated = 0; 2796 2809 break; 2797 2810 2798 2811 case GW_HWNDPREV: 2799 2800 2801 2812 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_PREV); 2813 window = GetWindowFromOS2Handle(hwndRelated); 2814 if(window) { 2802 2815 hwndRelated = window->getWindowHandle(); 2803 2816 } 2804 2817 else hwndRelated = 0; 2805 2818 break; 2806 2819 … … 2812 2825 2813 2826 case GW_CHILD: 2814 2815 2816 2827 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP); 2828 window = GetWindowFromOS2Handle(hwndRelated); 2829 if(window) { 2817 2830 hwndRelated = window->getWindowHandle(); 2818 2831 } 2819 2832 else hwndRelated = 0; 2820 2833 break; 2821 2834 } … … 3083 3096 3084 3097 if(dwExStyle == value) { 3085 3086 3087 3098 oldval = value; 3099 break; 3100 } 3088 3101 ss.styleOld = dwExStyle; 3089 3102 ss.styleNew = value; … … 3093 3106 SendInternalMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss); 3094 3107 oldval = ss.styleOld; 3095 3108 break; 3096 3109 } 3097 3110 case GWL_STYLE: … … 3102 3115 3103 3116 if(dwStyle == value) { 3104 3105 3117 oldval = value; 3118 break; 3106 3119 } 3107 3120 value &= ~(WS_CHILD|WS_VISIBLE); /* Some bits can't be changed this way (WINE) */ … … 3122 3135 case GWL_WNDPROC: 3123 3136 { 3124 3137 //Note: Type of SetWindowLong determines new window proc type 3125 3138 // UNLESS the new window proc has already been registered 3126 3139 // (use the old type in that case) 3127 3140 // (VERIFIED in NT 4, SP6) 3128 3141 WINDOWPROCTYPE type = WINPROC_GetProcType((HWINDOWPROC)value); 3129 3130 3131 3132 3142 if(type == WIN_PROC_INVALID) { 3143 type = (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A; 3144 } 3145 oldval = (LONG)WINPROC_GetProc(win32wndproc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A); 3133 3146 WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, (WNDPROC)value, type, WIN_PROC_WINDOW); 3134 3147 break; … … 3158 3171 oldval = userWindowLong[index/4]; 3159 3172 userWindowLong[index/4] = value; 3160 3173 break; 3161 3174 } 3162 3175 dprintf(("WARNING: SetWindowLong%c %x %d %x returned %x INVALID index!", (fUnicode) ? 'W' : 'A', getWindowHandle(), index, value)); 3163 3176 SetLastError(ERROR_INVALID_PARAMETER); 3164 3177 return 0; … … 3188 3201 break; 3189 3202 case GWL_HWNDPARENT: 3190 3203 value = GetParent(); 3191 3204 break; 3192 3205 case GWL_ID: -
trunk/src/user32/window.cpp
r4463 r4497 1 /* $Id: window.cpp,v 1.8 0 2000-10-09 17:26:55sandervl Exp $ */1 /* $Id: window.cpp,v 1.81 2000-10-18 17:10:50 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 486 486 if( IsWindow(hwnd) ) 487 487 { 488 WINDOWPLACEMENT wndpl;489 UINT flags;488 WINDOWPLACEMENT wndpl; 489 UINT flags; 490 490 491 491 GetWindowPlacement(hwnd, &wndpl); 492 wndpl.length = sizeof(wndpl);493 wndpl.showCmd = showCmd;494 wndpl.flags = 0;495 496 if(lpPoint)497 {492 wndpl.length = sizeof(wndpl); 493 wndpl.showCmd = showCmd; 494 wndpl.flags = 0; 495 496 if(lpPoint) 497 { 498 498 wndpl.flags |= WPF_SETMINPOSITION; 499 wndpl.ptMinPosition = *lpPoint;500 }501 if(lpRect)502 {499 wndpl.ptMinPosition = *lpPoint; 500 } 501 if(lpRect) 502 { 503 503 wndpl.rcNormalPosition = *lpRect; 504 }504 } 505 505 SetWindowPlacement( hwnd, &wndpl); 506 506 } … … 593 593 } 594 594 //****************************************************************************** 595 //NOTE: length must equal structure size or else api fails (verified in NT4, SP6) 595 596 //****************************************************************************** 596 597 BOOL WIN32API SetWindowPlacement(HWND hwnd, const WINDOWPLACEMENT *winpos) … … 604 605 return FALSE; 605 606 } 606 if(!winpos ) {607 if(!winpos || winpos->length != sizeof(WINDOWPLACEMENT)) { 607 608 dprintf(("SetWindowPlacement %x invalid parameter", hwnd)); 608 609 SetLastError(ERROR_INVALID_PARAMETER); … … 613 614 } 614 615 //****************************************************************************** 616 //NOTE: Length does not need to be correct (even though the SDK docs claim otherwise) 617 // (Verified in NT4, SP6) 615 618 //****************************************************************************** 616 619 BOOL WIN32API GetWindowPlacement(HWND hwnd, LPWINDOWPLACEMENT winpos) … … 1630 1633 HWND hwnd; 1631 1634 1632 hWnd = Win32BaseWindow::Win32ToOS2Handle(hWnd); 1633 1634 hwnd = Win32BaseWindow::OS2ToWin32Handle(O32_GetLastActivePopup(hWnd)); 1635 hwnd = Win32BaseWindow::Win32ToOS2Handle(hWnd); 1636 hwnd = Win32BaseWindow::OS2ToWin32Handle(O32_GetLastActivePopup(hwnd)); 1635 1637 1636 1638 dprintf(("GetLastActivePopup %x returned %x NOT CORRECTLY IMPLEMENTED", hWnd, hwnd));
Note:
See TracChangeset
for help on using the changeset viewer.