Changeset 10190 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- Jul 31, 2003, 5:58:58 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r10134 r10190 1 /* $Id: win32wbase.cpp,v 1.37 5 2003-06-03 09:51:05 sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.376 2003-07-31 15:56:45 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 86 86 //****************************************************************************** 87 87 //****************************************************************************** 88 Win32BaseWindow::Win32BaseWindow() 88 Win32BaseWindow::Win32BaseWindow() 89 89 : GenericObject(&windows, &critsect), ChildWindow(&critsect) 90 90 { … … 126 126 windowNameA = NULL; 127 127 windowNameW = NULL; 128 windowNameLength = 0; 129 128 windowNameLengthA = 0; 129 windowNameLengthW = 0; 130 130 131 userWindowBytes = NULL;; 131 132 nrUserWindowBytes= 0; … … 228 229 { 229 230 //if we're the last child that's being destroyed and our 230 //parent window was also destroyed, then we 231 //parent window was also destroyed, then we 231 232 if(getParent()->IsWindowDestroyed()) 232 233 { … … 236 237 } 237 238 } 238 else 239 else 239 240 { 240 241 Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild(); … … 340 341 } 341 342 if (window->getExStyle() & WS_EX_TOPMOST) 342 cs->dwExStyle |= WS_EX_TOPMOST; 343 cs->dwExStyle |= WS_EX_TOPMOST; 343 344 344 345 RELEASE_WNDOBJ(window); … … 389 390 cs->lpszClass = buffer; 390 391 } 391 392 392 /* Fix the coordinates */ 393 393 fXDefault = FALSE; … … 446 446 RELEASE_WNDOBJ(wndparent); 447 447 } 448 else owner = NULL; 448 else owner = NULL; 449 449 450 450 if(owner == NULL) … … 582 582 vertScrollInfo->flags = ESB_ENABLE_BOTH; 583 583 } 584 584 585 585 // initially allocate the window name fields 586 586 if(HIWORD(cs->lpszName)) … … 588 588 if (!isUnicode) 589 589 { 590 windowNameLength = strlen(cs->lpszName);591 windowNameA = (LPSTR)_smalloc(windowNameLength +1);592 memcpy(windowNameA,cs->lpszName,windowNameLength+1);593 windowNameW = (LPWSTR)_smalloc((windowNameLength+1)*sizeof(WCHAR)); 594 lstrcpynAtoW(windowNameW,windowNameA,windowNameLength+1);595 windowName A[windowNameLength] = 0;596 windowNameW[windowNameLength] = 0;590 windowNameLengthA = strlen(cs->lpszName); 591 windowNameA = (LPSTR)_smalloc(windowNameLengthA+1); 592 strcpy(windowNameA,cs->lpszName); 593 594 windowNameLengthW = lstrlenAtoW( windowNameA, -1 ); 595 windowNameW = (LPWSTR)_smalloc(( windowNameLengthW + 1 ) * sizeof( WCHAR ) ); 596 lstrcpyAtoW( windowNameW, windowNameA ); 597 597 } 598 598 else 599 599 { 600 600 // Wide 601 windowNameLength = lstrlenW((LPWSTR)cs->lpszName);602 windowNameW = (LPWSTR)_smalloc( (windowNameLength+1)*sizeof(WCHAR));603 memcpy(windowNameW,(LPWSTR)cs->lpszName, (windowNameLength+1)*sizeof(WCHAR));604 601 windowNameLengthW = lstrlenW((LPWSTR)cs->lpszName); 602 windowNameW = (LPWSTR)_smalloc((windowNameLengthW+1)*sizeof(WCHAR)); 603 strcpyW(windowNameW,(LPWSTR)cs->lpszName); 604 605 605 // windowNameW[lstrlenW((LPWSTR)cs->lpszName)] = 0; // need ? 606 606 607 607 // Ascii 608 windowNameA = (LPSTR)_smalloc(windowNameLength+1); 609 WideCharToMultiByte(CP_ACP, 610 0, 611 windowNameW, 612 windowNameLength, 613 windowNameA, 614 windowNameLength + 1, 615 0, 616 NULL); 617 windowNameA[windowNameLength] = 0; 618 } 619 608 windowNameLengthA = lstrlenWtoA( windowNameW, -1 ); 609 windowNameA = (LPSTR)_smalloc( windowNameLengthA + 1 ); 610 lstrcpyWtoA( windowNameA, windowNameW ); 611 } 612 613 dprintf(("windowNameA 0x%lx to 0x%lx windowNameW : 0x%lx to 0x%lx", 614 windowNameA, windowNameA + windowNameLengthA, 615 windowNameW, windowNameW + windowNameLengthW )); 616 620 617 if(fOS2Look) { 621 618 OSLibWinSetTitleBarText(OS2HwndFrame, windowNameA); … … 752 749 //@@PF Popup children of inactive windows can thus bring inactive window 753 750 //on top, this is not correct, popup windows can be on top only if their owner 754 //is in foreground, otherwise they are linked after owner. 751 //is in foreground, otherwise they are linked after owner. 755 752 if (((dwStyle & (WS_CHILD|WS_POPUP)) == WS_POPUP) && getOwner() && (getOwner()->getWindowHandle() != GetForegroundWindow())) 756 753 { … … 1066 1063 1067 1064 dprintf(("MsgButton %d at (%d,%d)", msg->message, msg->pt.x, msg->pt.y)); 1068 switch(msg->message) 1065 switch(msg->message) 1069 1066 { 1070 1067 case WM_LBUTTONDBLCLK: … … 1132 1129 SendMessageA(getWindowHandle(),WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message)); 1133 1130 1134 switch(msg->message) 1131 switch(msg->message) 1135 1132 { 1136 1133 case WM_LBUTTONDOWN: … … 1155 1152 } 1156 1153 //****************************************************************************** 1157 // 1154 // 1158 1155 // Win32BaseWindow::saveAndValidateUpdateRegion 1159 1156 // 1160 // If an application doesn't validate the update region while processing 1157 // If an application doesn't validate the update region while processing 1161 1158 // WM_PAINT, then we must remember it for the next time. Also validates 1162 1159 // the current update region. … … 1192 1189 } 1193 1190 //****************************************************************************** 1194 // 1191 // 1195 1192 // Win32BaseWindow::checkForDirtyUpdateRegion 1196 1193 // 1197 // If an application doesn't validate the update region while processing 1194 // If an application doesn't validate the update region while processing 1198 1195 // WM_PAINT, then we must remember it for the next time. If the window has 1199 1196 // a dirty update region, then invalidate that region. … … 1250 1247 ULONG Win32BaseWindow::MsgChar(MSG *msg) 1251 1248 { 1252 return DispatchMsgA(msg);1249 return IsWindowUnicode() ? DispatchMsgW( msg ) : DispatchMsgA( msg ); 1253 1250 } 1254 1251 //****************************************************************************** … … 1276 1273 //Send WM_PAINTICON here if minimized, because client window will 1277 1274 //not receive a (valid) WM_PAINT message 1278 if (getStyle() & WS_MINIMIZE) 1275 if (getStyle() & WS_MINIMIZE) 1279 1276 { 1280 1277 rc = SendMessageA(getWindowHandle(),WM_PAINTICON, 1, 0); … … 1347 1344 #endif 1348 1345 //WS_EX_TOOLWINDOW is incompatible with the OS2Look (titlebar thinner + smaller font) 1349 if(fOS2Look && ((dwStyle & WS_CAPTION) == WS_CAPTION) && !(dwExStyle & WS_EX_TOOLWINDOW)) 1346 if(fOS2Look && ((dwStyle & WS_CAPTION) == WS_CAPTION) && !(dwExStyle & WS_EX_TOOLWINDOW)) 1350 1347 { 1351 1348 RECT rect = {0}; … … 1362 1359 rect.top = rect.bottom - rect.top; 1363 1360 rect.right = rectWindow.right - rectWindow.left - rect.right; 1364 1361 1365 1362 rectOS2.xLeft = rect.left; 1366 1363 rectOS2.xRight = rect.right; … … 1368 1365 rectOS2.yTop = height - rect.bottom; 1369 1366 1370 //@@PF Disable close button as well when needed by application 1367 //@@PF Disable close button as well when needed by application 1371 1368 OSLibChangeCloseButtonState(getOS2FrameWindowHandle(), fCloseButton); 1372 1369 OSLibWinPositionFrameControls(getOS2FrameWindowHandle(), &rectOS2, 1373 1370 dwStyle, dwExStyle, IconForWindow(ICON_SMALL), 1374 1371 fCloseButton, windowClass->getIcon() != NULL); 1375 1372 } 1376 1373 return rc; … … 1562 1559 1563 1560 case WM_GETTEXTLENGTH: 1564 return windowNameLength ;1561 return windowNameLengthA; 1565 1562 1566 1563 case WM_GETTEXT: 1567 if (!lParam || !wParam) 1564 if (!lParam || !wParam) 1568 1565 return 0; 1569 if (!windowNameA) 1566 if (!windowNameA) 1570 1567 ((LPSTR)lParam)[0] = 0; 1571 else 1572 memcpy((LPSTR)lParam, windowNameA, min(windowNameLength+1, wParam));1573 return min(windowNameLength, wParam);1568 else 1569 lstrcpynA(( LPSTR )lParam, windowNameA, wParam ); 1570 return strlen(( LPSTR )lParam ); 1574 1571 1575 1572 case WM_SETTEXT: 1576 1573 { 1577 1574 LPCSTR lpsz = (LPCSTR)lParam; 1578 1575 1579 1576 // reallocate if new buffer is larger 1580 1577 if (!lParam) … … 1582 1579 free(windowNameA); 1583 1580 free(windowNameW); 1584 windowNameLength = 0; 1581 windowNameLengthA = 0; 1582 windowNameLengthW = 0; 1585 1583 windowNameA = NULL; 1586 1584 windowNameW = NULL; … … 1590 1588 // determine length of new text 1591 1589 int iTextLength = strlen(lpsz); 1592 1593 if (windowNameLength < iTextLength)1590 1591 if (windowNameLengthA < iTextLength) 1594 1592 { 1595 1593 if (windowNameA) … … 1598 1596 windowNameA = NULL; 1599 1597 } 1600 1598 1601 1599 if (windowNameW) 1602 1600 { … … 1605 1603 } 1606 1604 } 1607 1608 windowNameLength = iTextLength;1605 1606 windowNameLengthA = iTextLength; 1609 1607 if(!windowNameA) 1610 windowNameA = (LPSTR)_smalloc(windowNameLength+1); 1611 memcpy(windowNameA, lpsz, windowNameLength+1); 1608 windowNameA = (LPSTR)_smalloc(windowNameLengthA+1); 1609 strcpy(windowNameA, lpsz); 1610 windowNameLengthW = lstrlenAtoW( windowNameA, -1 ); 1612 1611 if(!windowNameW) 1613 windowNameW = (LPWSTR)_smalloc(( windowNameLength+1)*sizeof(WCHAR));1614 lstrcpy nAtoW(windowNameW, windowNameA, windowNameLength+1);1615 } 1616 1612 windowNameW = (LPWSTR)_smalloc(( windowNameLengthW + 1 )*sizeof(WCHAR)); 1613 lstrcpyAtoW( windowNameW, windowNameA ); 1614 } 1615 1617 1616 dprintf(("WM_SETTEXT of %x to %s\n", Win32Hwnd, lParam)); 1618 1617 if ((dwStyle & WS_CAPTION) == WS_CAPTION) … … 1675 1674 dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam)))); 1676 1675 if (::GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD) 1677 1678 1679 1680 1681 1682 1676 { 1677 LONG ret = ::SendMessageW( ::GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam ); 1678 if (ret) return ret; 1679 } 1680 1681 /* Caption clicks are handled by the NC_HandleNCLButtonDown() */ 1683 1682 return (LOWORD(lParam) >= HTCLIENT) ? MA_ACTIVATE : MA_NOACTIVATE; 1684 1683 } … … 1754 1753 if (::GetWindowLongA( getWindowHandle(), GWL_STYLE ) & WS_CHILD) 1755 1754 return ::SendMessageA( ::GetParent(getWindowHandle()), WM_MOUSEWHEEL, wParam, lParam ); 1756 1755 break; 1757 1756 1758 1757 case WM_WINDOWPOSCHANGED: … … 1789 1788 RECT rect; 1790 1789 int rc; 1791 1792 if (!windowClass || (!windowClass->getBackgroundBrush() 1790 1791 if (!windowClass || (!windowClass->getBackgroundBrush() 1793 1792 && !(getStyle() & WS_MINIMIZE))) return 0; 1794 1793 … … 1804 1803 hBrush = GetSysColorBrush(hBrush-1); 1805 1804 } 1806 1805 1807 1806 1808 1807 rc = GetClipBox( (HDC)wParam, &rect ); … … 1905 1904 1906 1905 case WM_KEYDOWN: 1907 1908 1906 if(wParam == VK_F10) iF10Key = VK_F10; 1907 break; 1909 1908 1910 1909 case WM_SYSKEYDOWN: 1911 1910 { 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 if( wParam == VK_F4 )/* try to close the window */1923 1911 if( HIWORD(lParam) & KEYDATA_ALT ) 1912 { 1913 /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */ 1914 if( wParam == VK_MENU && !iMenuSysKey ) 1915 iMenuSysKey = 1; 1916 else 1917 iMenuSysKey = 0; 1918 1919 iF10Key = 0; 1920 1921 if( wParam == VK_F4 ) /* try to close the window */ 1922 { 1924 1923 HWND top = GetTopParent(); 1925 1924 if (!(GetClassLongW( top, GCL_STYLE ) & CS_NOCLOSE)) 1926 1925 PostMessageW( top, WM_SYSCOMMAND, SC_CLOSE, 0 ); 1927 1926 } 1928 1927 1929 1928 //Default OS/2 app behaviour for system keys 1930 1929 if(fOS2Look) 1931 1930 { 1932 if( wParam == VK_F5 )/* try to restore the window */1933 1934 1931 if( wParam == VK_F5 ) /* try to restore the window */ 1932 { 1933 HWND top = GetTopParent(); 1935 1934 /* No checks needed SC_RESTORE handler does them */ 1936 1937 1938 1939 if( wParam == VK_F7 )/* size the window */1940 1941 1942 1943 1944 1945 if( wParam == VK_F8 )/* move the window */1946 1947 1948 1949 1950 1951 1952 if( wParam == VK_F9 )/* try to minimize the window */1953 1954 1955 1956 1957 1958 1959 if( wParam == VK_F10 )/* try to maximize the window */1960 1961 1962 1963 1964 1965 } 1966 1967 } 1968 1969 1970 1971 1935 PostMessageW( top, WM_SYSCOMMAND, SC_RESTORE, 0 ); 1936 } 1937 1938 if( wParam == VK_F7 ) /* size the window */ 1939 { 1940 HWND top = GetTopParent(); 1941 PostMessageW( top, WM_SYSCOMMAND, SC_MOVE, 0 ); 1942 } 1943 1944 if( wParam == VK_F8 ) /* move the window */ 1945 { 1946 HWND top = GetTopParent(); 1947 if ( GetWindowLongA(top, GWL_STYLE) & WS_SIZEBOX) 1948 PostMessageW( top, WM_SYSCOMMAND, SC_SIZE, 0 ); 1949 } 1950 1951 if( wParam == VK_F9 ) /* try to minimize the window */ 1952 { 1953 HWND top = GetTopParent(); 1954 if ( GetWindowLongA(top, GWL_STYLE) & WS_MINIMIZEBOX) 1955 PostMessageW( top, WM_SYSCOMMAND, SC_MINIMIZE, 0 ); 1956 } 1957 1958 if( wParam == VK_F10 ) /* try to maximize the window */ 1959 { 1960 HWND top = GetTopParent(); 1961 if ( GetWindowLongA(top, GWL_STYLE) & WS_MAXIMIZEBOX) 1962 PostMessageW( top, WM_SYSCOMMAND, SC_MAXIMIZE, 0 ); 1963 } 1964 } 1965 1966 } 1967 else if( wParam == VK_F10 ) 1968 iF10Key = 1; 1969 else 1970 if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000)) 1972 1971 SendMessageW(getWindowHandle(), WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE ); 1973 1972 return 0; … … 1979 1978 // no break; 1980 1979 case WM_SYSKEYUP: 1981 1982 1980 /* Press and release F10 or ALT */ 1981 if (((wParam == VK_MENU) && iMenuSysKey) || 1983 1982 ((wParam == VK_F10) && iF10Key)) 1984 1983 ::SendMessageW( GetTopParent(), WM_SYSCOMMAND, SC_KEYMENU, 0L ); 1985 1984 iMenuSysKey = iF10Key = 0; 1986 1985 break; 1987 1986 … … 2020 2019 case WM_RBUTTONUP: 2021 2020 { 2022 2023 2024 2025 2021 POINT pt; 2022 pt.x = SLOWORD(lParam); 2023 pt.y = SHIWORD(lParam); 2024 ClientToScreen(getWindowHandle(), &pt); 2026 2025 SendMessageA( getWindowHandle(), WM_CONTEXTMENU, getWindowHandle(),MAKELPARAM(pt.x, pt.y) ); 2027 2026 } … … 2136 2135 { 2137 2136 case WM_GETTEXTLENGTH: 2138 return windowNameLength ;2137 return windowNameLengthW; 2139 2138 2140 2139 case WM_GETTEXT: 2141 if (!lParam || !wParam) 2140 if (!lParam || !wParam) 2142 2141 return 0; 2143 2142 if (!windowNameW) 2144 2143 ((LPWSTR)lParam)[0] = 0; 2145 else 2146 memcpy((LPSTR)lParam, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), wParam) ); 2147 return min(windowNameLength, wParam); 2144 else 2145 lstrcpynW(( LPWSTR )lParam, windowNameW, wParam ); 2146 2147 return strlenW(( LPWSTR )lParam ); 2148 2148 2149 2149 case WM_SETTEXT: 2150 2150 { 2151 2151 LPWSTR lpsz = (LPWSTR)lParam; 2152 2152 2153 2153 // reallocate if new buffer is larger 2154 2154 if (!lParam) … … 2156 2156 free(windowNameA); 2157 2157 free(windowNameW); 2158 windowNameLength = 0; 2158 windowNameLengthA = 0; 2159 windowNameLengthW = 0; 2159 2160 windowNameA = NULL; 2160 2161 windowNameW = NULL; … … 2164 2165 // determine length of new text 2165 2166 int iTextLength = lstrlenW(lpsz); 2166 2167 if (windowNameLength < iTextLength)2167 2168 if (windowNameLengthW < iTextLength) 2168 2169 { 2169 2170 if (windowNameA) … … 2172 2173 windowNameA = NULL; 2173 2174 } 2174 2175 2175 2176 if (windowNameW) 2176 2177 { … … 2179 2180 } 2180 2181 } 2181 2182 windowNameLength = iTextLength;2182 2183 windowNameLengthW = iTextLength; 2183 2184 if(!windowNameW) 2184 windowNameW = (LPWSTR)_smalloc((windowNameLength+1)*sizeof(WCHAR)); 2185 memcpy(windowNameW, lpsz, (windowNameLength+1) * sizeof(WCHAR)); 2185 windowNameW = (LPWSTR)_smalloc((windowNameLengthW+1)*sizeof(WCHAR)); 2186 strcpyW(windowNameW, lpsz); 2187 windowNameLengthA = lstrlenWtoA( windowNameW, -1 ); 2186 2188 if(!windowNameA) 2187 windowNameA = (LPSTR)_smalloc( windowNameLength+1);2188 lstrcpy nWtoA(windowNameA, windowNameW, windowNameLength+1);2189 } 2190 2191 dprintf(("WM_SETTEXT of %x \n",Win32Hwnd));2189 windowNameA = (LPSTR)_smalloc( windowNameLengthA + 1 ); 2190 lstrcpyWtoA( windowNameA, windowNameW ); 2191 } 2192 2193 dprintf(("WM_SETTEXT of %x to %s\n", Win32Hwnd, windowNameA)); 2192 2194 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 2193 2195 { … … 2259 2261 hWndIcon = windowClass->getIcon(); 2260 2262 else 2261 if (!(dwStyle & DS_MODALFRAME)) 2263 if (!(dwStyle & DS_MODALFRAME)) 2262 2264 {//SvL: load it as shared or else we'll leak icons 2263 2265 hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR|LR_SHARED); … … 2279 2281 hWndIcon = windowClass->getIcon(); 2280 2282 else 2281 if (!(dwStyle & DS_MODALFRAME)) 2283 if (!(dwStyle & DS_MODALFRAME)) 2282 2284 {//SvL: load it as shared or else we'll leak icons 2283 2285 hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR|LR_SHARED); … … 2310 2312 dprintf(("ShowWindow: GetProcessDword(0, GPD_STARTF_SHOWWINDOW) -> %x", nCmdShow)); 2311 2313 } 2312 2314 2313 2315 2314 2316 switch(nCmdShow) … … 2433 2435 //****************************************************************************** 2434 2436 //****************************************************************************** 2435 BOOL Win32BaseWindow::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, 2437 BOOL Win32BaseWindow::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, 2436 2438 int cy, UINT fuFlags, BOOL fShowWindow) 2437 2439 { … … 2538 2540 OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld); 2539 2541 } 2540 if((dwOldStyle & WS_MINIMIZE) && (getStyle() & WS_MINIMIZE)) 2542 if((dwOldStyle & WS_MINIMIZE) && (getStyle() & WS_MINIMIZE)) 2541 2543 {//don't allow size changes if the window is minimized 2542 2544 //we will update the restore position at the end of this method … … 2589 2591 //SvL: Must also deactivate the window when hiding it or else focus won't 2590 2592 // change. (NOTE: make sure this doesn't cause regressions (01-02-2003) 2591 if((swp.fl & (SWPOS_HIDE|SWPOS_DEACTIVATE)) == (SWPOS_HIDE|SWPOS_DEACTIVATE)) 2593 if((swp.fl & (SWPOS_HIDE|SWPOS_DEACTIVATE)) == (SWPOS_HIDE|SWPOS_DEACTIVATE)) 2592 2594 { 2593 2595 //we must make sure the owner is not disabled or else the focus will … … 2687 2689 wpos->y = rectWindow.top; 2688 2690 } 2689 2691 2690 2692 WINDOWPOS wpOld = *wpos; 2691 2693 if(!(wpos->flags & SWP_NOSENDCHANGING)) … … 2823 2825 return FALSE; 2824 2826 } 2825 2827 2826 2828 if(!(getStyle() & WS_CHILD) && getOwner() == NULL) 2827 2829 { … … 2854 2856 } 2855 2857 dprintf(("DestroyWindow %x -> HIDDEN", hwnd)); 2856 2858 2857 2859 // check the handle for the last active popup window 2858 2860 Win32BaseWindow* owner = getOwner(); … … 2870 2872 // (MFC created modeless dialog) 2871 2873 //TODO: This might be the wrong place to do it. EndDialog is called, 2872 // so perhaps it should be done there. (although Wine only 2874 // so perhaps it should be done there. (although Wine only 2873 2875 // enables the owner if the dialog is modal) 2874 2876 ::EnableWindow(owner->getWindowHandle(), 1); 2875 2877 } 2876 2878 2877 2879 fDestroyWindowCalled = TRUE; 2878 2880 … … 2929 2931 Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild(); 2930 2932 2931 if(getStyle() & WS_CHILD) 2933 if(getStyle() & WS_CHILD) 2932 2934 { 2933 2935 if(wndparent) { … … 2938 2940 return 0; 2939 2941 } 2940 else 2942 else 2941 2943 if(getStyle() & WS_POPUP) 2942 2944 return (getOwner()) ? getOwner()->getWindowHandle() : 0; … … 3027 3029 // in release build. 3028 3030 Win32BaseWindow *_parent = getParent(); 3029 3030 if(_parent) 3031 3032 if(_parent) 3031 3033 { 3032 3034 if(_parent->getWindowHandle() == hwndParent) 3033 3035 return TRUE; 3034 3036 3035 3037 return _parent->IsChild(hwndParent); 3036 3038 } 3037 else 3039 else 3038 3040 return 0; 3039 3041 } … … 3208 3210 dprintf(("EnumWindows %x %x", lpfn, lParam)); 3209 3211 3210 for(int i=0;i<MAX_WINDOW_HANDLES;i++) 3212 for(int i=0;i<MAX_WINDOW_HANDLES;i++) 3211 3213 { 3212 3214 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 3440 3442 if(window->state >= STATE_POST_WMNCCREATE) { 3441 3443 hwndRelated = window->getWindowHandle(); 3442 RELEASE_WNDOBJ(window); 3444 RELEASE_WNDOBJ(window); 3443 3445 } 3444 3446 else { 3445 3447 hwndRelated = window->GetWindow(GW_HWNDNEXT); 3446 RELEASE_WNDOBJ(window); 3448 RELEASE_WNDOBJ(window); 3447 3449 } 3448 3450 } … … 3497 3499 //****************************************************************************** 3498 3500 PRECT Win32BaseWindow::getWindowRect() 3499 { 3500 return &rectWindow; 3501 { 3502 return &rectWindow; 3501 3503 } 3502 3504 //****************************************************************************** … … 3668 3670 { 3669 3671 //if the destination window is created by this process, send message 3670 if(dwProcessId == currentProcessId) 3672 if(dwProcessId == currentProcessId) 3671 3673 { 3672 3674 if(fUnicode) { … … 3677 3679 //else get data directory from window structure 3678 3680 //TODO: must lock window structure.... (TODO) 3679 return windowNameLength;3681 return fUnicode ? windowNameLengthW : windowNameLengthA; 3680 3682 } 3681 3683 //****************************************************************************** … … 3689 3691 return SendMessageA(getWindowHandle(),WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz); 3690 3692 } 3691 3693 3692 3694 //else get data directory from window structure 3693 3695 if (!lpsz || !cch) return 0; 3694 3696 if (!windowNameA) lpsz[0] = 0; 3695 else memcpy(lpsz, windowNameA, min(windowNameLength + 1, cch));3696 return min(windowNameLength, cch);3697 else lstrcpynA( lpsz, windowNameA, cch ); 3698 return strlen( lpsz ); 3697 3699 } 3698 3700 //****************************************************************************** … … 3707 3709 } 3708 3710 //else get data directory from window structure 3709 if (!lpsz || !cch) 3711 if (!lpsz || !cch) 3710 3712 return 0; 3711 if (!windowNameW) 3713 if (!windowNameW) 3712 3714 lpsz[0] = 0; 3713 else 3714 memcpy(lpsz, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), cch));3715 3716 return min(windowNameLength, cch);3715 else 3716 lstrcpynW( lpsz, windowNameW, cch ); 3717 3718 return strlenW( lpsz ); 3717 3719 } 3718 3720 //****************************************************************************** … … 3751 3753 SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss); 3752 3754 3753 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), 3755 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), 3754 3756 getStyle(), getExStyle(),ss.styleOld); 3755 3757 … … 3760 3762 { 3761 3763 STYLESTRUCT ss; 3762 3764 3763 3765 //SvL: TODO: Can you change minimize or maximize status here too? 3764 3766 … … 3768 3770 } 3769 3771 dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x (%x)", getWindowHandle(), dwStyle, value)); 3770 3772 3771 3773 //Changing WS_CHILD style is allowed 3772 3774 ss.styleOld = getStyle(); … … 3776 3778 SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss); 3777 3779 3778 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), 3780 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), 3779 3781 getStyle(), getExStyle(),ss.styleOld); 3780 3782 … … 3941 3943 switch(index) 3942 3944 { 3943 case GWW_ID: 3944 3945 case GWW_ID: 3946 if(HIWORD(getWindowId())) 3945 3947 dprintf(("WARNING: GWW_ID: discards high bits of 0x%08x!\n", getWindowId())); 3946 3948 return (WORD)getWindowId(); 3947 3949 3948 case GWW_HWNDPARENT: 3950 case GWW_HWNDPARENT: 3949 3951 dprintf(("WARNING: GWW_HWNDPARENT: discards high bits of 0x%08x!\n", GetParent())); 3950 3951 3952 case GWW_HINSTANCE: 3953 3952 return (WORD) GetParent(); 3953 3954 case GWW_HINSTANCE: 3955 if (HIWORD(hInstance)) 3954 3956 dprintf(("WARNING: GWW_HINSTANCE: discards high bits of 0x%08x!\n", hInstance)); 3955 3957 return (WORD)hInstance; … … 3969 3971 // VISRGN_NOTIFY_PROC lpNotifyProc - notification handler 3970 3972 // DWORD dwUserData - caller supplied parameter for handler invocations 3971 // 3973 // 3972 3974 // Returns: 3973 3975 // TRUE - Success … … 3989 3991 // Parameters: 3990 3992 // BOOL fDrawingAllowed - drawing is allowed or not 3991 // 3993 // 3992 3994 // Returns: 3993 3995 // TRUE - Success … … 3995 3997 // 3996 3998 //****************************************************************************** 3997 void Win32BaseWindow::callVisibleRgnNotifyProc(BOOL fDrawingAllowed) 3999 void Win32BaseWindow::callVisibleRgnNotifyProc(BOOL fDrawingAllowed) 3998 4000 { 3999 4001 if(fDrawingAllowed) { … … 4016 4018 // int chdcWindow - size of HDC array (IN) 4017 4019 // int *pnrdcs - number of HDCs returned (OUT) 4018 // 4020 // 4019 4021 // Returns: 4020 4022 // TRUE - Success … … 4050 4052 // Parameters: 4051 4053 // HDC hdc - HDC to be added to our list of open DCs 4052 // 4054 // 4053 4055 // Returns: 4054 4056 // … … 4083 4085 // Parameters: 4084 4086 // HDC hdc - HDC to be removed from our list of open DCs 4085 // 4087 // 4086 4088 // Returns: 4087 4089 // … … 4141 4143 { 4142 4144 DWORD magic; 4143 HWND hwnd; 4145 HWND hwnd; 4144 4146 4145 4147 if(hwndOS2 == OSLIB_HWND_DESKTOP) … … 4157 4159 // dprintf2(("Win32BaseWindow::GetWindowFromOS2Handle: not an Odin os2 window %x", hwndOS2)); 4158 4160 4159 //Now check if it's a fake window 4161 //Now check if it's a fake window 4160 4162 Win32FakeWindow *window = Win32FakeWindow::GetWindowFromOS2Handle(hwndOS2); 4161 4163 if(window) {
Note:
See TracChangeset
for help on using the changeset viewer.