Changeset 2084 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- Dec 16, 1999, 1:11:49 AM (26 years ago)
- File:
-
- 1 edited
-
trunk/src/user32/win32wbase.cpp (modified) (43 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r2076 r2084 1 /* $Id: win32wbase.cpp,v 1.11 0 1999-12-14 19:13:19sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.111 1999-12-16 00:11:46 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 11 11 * 12 12 * TODO: Not thread/process safe 13 * TODO: Calling window handler directly from SendMessageA/W can cause problems14 * for GetMessageTime/Pos & InSendMessage15 13 * 16 14 * Project Odin Software License can be found in LICENSE.TXT … … 28 26 #include <winres.h> 29 27 #include "wndmsg.h" 30 #include "hooks.h"31 28 #include "oslibwin.h" 32 29 #include "oslibutil.h" … … 44 41 #include <wprocess.h> 45 42 #include "winmouse.h" 43 #include <win\hook.h> 46 44 47 45 #define HAS_DLGFRAME(style,exStyle) \ … … 81 79 82 80 static fDestroyAll = FALSE; 81 //For quick lookup of current process id 82 static ULONG currentProcessId = -1; 83 83 84 84 //****************************************************************************** … … 145 145 fNoSizeMsg = FALSE; 146 146 fIsDestroyed = FALSE; 147 fDestroyWindowCalled = FALSE; 147 148 fCreated = FALSE; 148 149 fTaskList = FALSE; … … 203 204 204 205 ownDC = 0; 206 207 if(currentProcessId == -1) 208 { 209 currentProcessId = GetCurrentProcessId(); 210 } 211 dwThreadId = GetCurrentThreadId(); 212 dwProcessId = currentProcessId; 205 213 } 206 214 //****************************************************************************** … … 461 469 windowClass->IncreaseWindowCount(); 462 470 471 if (HOOK_IsHooked( WH_CBT )) 472 { 473 CBT_CREATEWNDA cbtc; 474 LRESULT ret; 475 476 cbtc.lpcs = cs; 477 cbtc.hwndInsertAfter = hwndLinkAfter; 478 ret = HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc); 479 if(ret) 480 { 481 dprintf(("CBT-hook returned 0!!")); 482 SetLastError(ERROR_CAN_NOT_COMPLETE); //todo: wrong error 483 return FALSE; 484 } 485 } 486 463 487 /* Correct the window style */ 464 488 if (!(cs->style & WS_CHILD)) … … 510 534 } 511 535 512 if(((cs->style & 0xC0000000) == WS_OVERLAPPED) && ((cs->style & WS_CAPTION) == WS_CAPTION) && owner == NULL) 536 if(((dwStyle & 0xC0000000) == WS_OVERLAPPED) && ((dwStyle & WS_CAPTION) == WS_CAPTION) && owner == NULL 537 && dwStyle & WS_SYSMENU) 513 538 { 514 fTaskList = TRUE;539 fTaskList = TRUE; 515 540 } 516 541 … … 697 722 fNoSizeMsg = FALSE; 698 723 699 if(Send MessageA(WM_NCCREATE, 0, (LPARAM)cs) )724 if(SendInternalMessageA(WM_NCCREATE, 0, (LPARAM)cs) ) 700 725 { 701 726 fCreated = TRUE; … … 704 729 705 730 // OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top); 706 if( (Send MessageA(WM_CREATE, 0, (LPARAM)cs )) != -1 )731 if( (SendInternalMessageA(WM_CREATE, 0, (LPARAM)cs )) != -1 ) 707 732 { 708 733 if(!(flags & WIN_NEED_SIZE)) { 709 Send MessageA(WM_SIZE, SIZE_RESTORED,734 SendInternalMessageA(WM_SIZE, SIZE_RESTORED, 710 735 MAKELONG(rectClient.right-rectClient.left, 711 736 rectClient.bottom-rectClient.top)); 712 Send MessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );737 SendInternalMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 713 738 } 714 739 740 if( getStyle() & WS_CHILD && !(getExStyle() & WS_EX_NOPARENTNOTIFY) ) 741 { 742 /* Notify the parent window only */ 743 SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle()); 744 if(!::IsWindow(getWindowHandle())) 745 { 746 dprintf(("Createwindow: WM_PARENTNOTIFY destroyed window")); 747 goto end; 748 } 749 } 750 715 751 if (cs->style & WS_VISIBLE) ShowWindow( sw ); 716 752 717 #if 0718 753 /* Call WH_SHELL hook */ 719 720 if (!(dwStyle & WS_CHILD) && !owner) 721 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); 722 #endif 754 if (!(getStyle() & WS_CHILD) && !owner) 755 HOOK_CallHooksA(WH_SHELL, HSHELL_WINDOWCREATED, getWindowHandle(), 0 ); 756 723 757 SetLastError(0); 724 758 return TRUE; … … 727 761 dprintf(("Window creation FAILED (NCCREATE cancelled creation)")); 728 762 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 763 end: 729 764 return FALSE; 730 765 } … … 755 790 756 791 fIsDestroyed = TRUE; 757 //According to the SDK, WM_PARENTNOTIFY messages are sent to the parent (this window) 758 //before any window destruction has begun 759 child = (Win32BaseWindow *)getFirstChild(); 760 while(child) { 761 child->NotifyParent(WM_DESTROY, 0, 0); 762 763 child = (Win32BaseWindow *)child->getNextChild(); 792 793 if(fDestroyWindowCalled == FALSE) 794 {//this window was destroyed because DestroyWindow was called for it's parent 795 //so: send a WM_PARENTNOTIFY now as that hasn't happened yet 796 if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_NOPARENTNOTIFY)) 797 { 798 if(getParent()) 799 { 800 /* Notify the parent window only */ 801 getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle()); 802 } 803 else DebugInt3(); 804 } 764 805 } 765 806 SendInternalMessageA(WM_DESTROY, 0, 0); 807 SendInternalMessageA(WM_NCDESTROY, 0, 0); 766 808 767 809 if (hwndHorzScroll && OSLibWinQueryWindow(hwndHorzScroll,QWOS_PARENT) == OSLibWinQueryObjectWindow()) OSLibWinDestroyWindow(hwndHorzScroll); … … 828 870 return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y)); 829 871 } 872 //****************************************************************************** 873 //****************************************************************************** 874 #if 0 875 ULONG Win32BaseWindow::MsgMinMax() 876 { 877 878 } 879 #endif 830 880 //****************************************************************************** 831 881 //****************************************************************************** … … 901 951 { 902 952 ULONG rc, curprocid, procidhwnd = -1, threadidhwnd = 0; 953 903 954 904 955 //According to SDK docs, if app returns FALSE & window is being deactivated, … … 1151 1202 1152 1203 /* Activate the window if needed */ 1153 if(isSubclassedOS2Wnd()) {1154 Win32BaseWindow *parentwnd = GetWindowFromOS2FrameHandle(OSLibWinQueryWindow(OS2Hwnd, QWOS_PARENT));1155 if(parentwnd) {1156 hwndTop = (parentwnd->GetTopParent()) ? parentwnd->GetTopParent()->getWindowHandle() : 0;1157 }1158 else hwndTop = 0;1159 }1160 else hwndTop = (GetTopParent()) ? GetTopParent()->getWindowHandle() : 0;1204 if(isSubclassedOS2Wnd()) { 1205 Win32BaseWindow *parentwnd = GetWindowFromOS2FrameHandle(OSLibWinQueryWindow(OS2Hwnd, QWOS_PARENT)); 1206 if(parentwnd) { 1207 hwndTop = (parentwnd->GetTopParent()) ? parentwnd->GetTopParent()->getWindowHandle() : 0; 1208 } 1209 else hwndTop = 0; 1210 } 1211 else hwndTop = (GetTopParent()) ? GetTopParent()->getWindowHandle() : 0; 1161 1212 1162 1213 if (hwndTop && getWindowHandle() != GetActiveWindow()) 1163 1214 { 1164 LONG ret = Send MessageA(WM_MOUSEACTIVATE, hwndTop,1165 MAKELONG( HTCLIENT, win32msg ) );1215 LONG ret = SendInternalMessageA(WM_MOUSEACTIVATE, hwndTop, 1216 MAKELONG( HTCLIENT, win32msg ) ); 1166 1217 1167 1218 #if 0 … … 1447 1498 1448 1499 case SC_CLOSE: 1449 return Send MessageA(WM_CLOSE, 0, 0);1500 return SendInternalMessageA(WM_CLOSE, 0, 0); 1450 1501 1451 1502 #if 0 … … 1627 1678 { 1628 1679 if(getParent()) { 1629 LRESULT rc = getParent()->Send MessageA(WM_MOUSEACTIVATE, wParam, lParam );1680 LRESULT rc = getParent()->SendInternalMessageA(WM_MOUSEACTIVATE, wParam, lParam ); 1630 1681 if(rc) return rc; 1631 1682 } … … 1639 1690 { 1640 1691 if(getParent()) { 1641 LRESULT rc = getParent()->Send MessageA(WM_SETCURSOR, wParam, lParam);1692 LRESULT rc = getParent()->SendInternalMessageA(WM_SETCURSOR, wParam, lParam); 1642 1693 if(rc) return rc; 1643 1694 } … … 1665 1716 1666 1717 if (!(wpos->flags & SWP_NOMOVE) && !(wpos->flags & SWP_NOCLIENTMOVE)) 1667 Send MessageA(WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));1718 SendInternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top)); 1668 1719 1669 1720 if (!(wpos->flags & SWP_NOSIZE) && !(wpos->flags & SWP_NOCLIENTSIZE)) … … 1672 1723 else if (dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED; 1673 1724 1674 Send MessageA(WM_SIZE, wp, MAKELONG(rectClient.right - rectClient.left,1725 SendInternalMessageA(WM_SIZE, wp, MAKELONG(rectClient.right - rectClient.left, 1675 1726 rectClient.bottom - rectClient.top)); 1676 1727 } … … 1779 1830 // key matches siblings mnemonic, send mouseclick 1780 1831 if (mnemonic == (char) wParam) { 1781 siblingWindow->Send MessageA (BM_CLICK, 0, 0);1832 siblingWindow->SendInternalMessageA (BM_CLICK, 0, 0); 1782 1833 } 1783 1834 … … 1873 1924 LRESULT Win32BaseWindow::SendMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam) 1874 1925 { 1926 POSTMSG_PACKET *packet; 1927 1928 //if the destination window is created by this process & thread, call window proc directly 1929 if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) { 1930 return SendInternalMessageA(Msg, wParam, lParam); 1931 } 1932 //otherwise use WinSendMsg to send it to the right process/thread 1933 packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET)); 1934 packet->Msg = Msg; 1935 packet->wParam = wParam; 1936 packet->lParam = lParam; 1937 packet->fUnicode = FALSE; 1938 return OSLibSendMessage(getOS2WindowHandle(), WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet); 1939 } 1940 //****************************************************************************** 1941 //****************************************************************************** 1942 LRESULT Win32BaseWindow::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam) 1943 { 1944 POSTMSG_PACKET *packet; 1945 1946 //if the destination window is created by this process & thread, call window proc directly 1947 if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) { 1948 return SendInternalMessageA(Msg, wParam, lParam); 1949 } 1950 //otherwise use WinSendMsg to send it to the right process/thread 1951 packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET)); 1952 packet->Msg = Msg; 1953 packet->wParam = wParam; 1954 packet->lParam = lParam; 1955 packet->fUnicode = TRUE; 1956 return OSLibSendMessage(getOS2WindowHandle(), WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet); 1957 } 1958 //****************************************************************************** 1959 //Called as a result of an OS/2 message or called from a class method 1960 //****************************************************************************** 1961 LRESULT Win32BaseWindow::SendInternalMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam) 1962 { 1875 1963 LRESULT rc; 1876 1964 BOOL fInternalMsgBackup = fInternalMsg; 1877 1965 1878 //SvL: Some Wine controls send WM_COMMAND messages when they receive the focus -> apps don't like to 1879 // receive those before they get their WM_CREATE message 1880 //NOTE: May need to refuse more messages 1881 if(fCreated == FALSE && Msg == WM_COMMAND) { 1882 dprintf(("SendMessageA BEFORE creation! %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 1883 return 0; 1884 } 1885 1886 DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, FALSE, FALSE); 1887 1888 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg 1889 return(0); 1890 } 1891 fInternalMsg = FALSE; 1966 DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, FALSE, TRUE); 1967 1968 CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, FALSE); 1969 1970 fInternalMsg = TRUE; 1892 1971 switch(Msg) 1893 1972 { … … 1899 1978 break; 1900 1979 } 1901 NotifyParent(Msg, wParam, lParam);1902 1903 1980 rc = 0; 1904 1981 break; 1905 1982 } 1906 case WM_SETTEXT:1907 rc = CallWindowProcA(win32wndproc, getWindowHandle(), WM_SETTEXT, wParam, lParam);1908 break;1909 1910 1983 case WM_LBUTTONDOWN: 1911 1984 case WM_MBUTTONDOWN: … … 1916 1989 1917 1990 case WM_DESTROY: 1918 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);1919 1991 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0); 1920 1992 break; … … 1928 2000 } 1929 2001 //****************************************************************************** 1930 //****************************************************************************** 1931 LRESULT Win32BaseWindow::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam) 2002 //Called as a result of an OS/2 message or called from a class method 2003 //****************************************************************************** 2004 LRESULT Win32BaseWindow::SendInternalMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam) 1932 2005 { 1933 2006 LRESULT rc; 1934 2007 BOOL fInternalMsgBackup = fInternalMsg; 1935 2008 1936 //SvL: Some Wine controls send WM_COMMAND messages when they receive the focus -> apps don't like to 1937 // receive those before they get their WM_CREATE message 1938 //NOTE: May need to refuse more messages 1939 if(fCreated == FALSE && Msg == WM_COMMAND) { 1940 dprintf(("SendMessageA BEFORE creation! %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 1941 return 0; 1942 } 1943 1944 DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, TRUE, FALSE); 1945 1946 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg 1947 return(0); 1948 } 1949 fInternalMsg = FALSE; 2009 DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, TRUE, TRUE); 2010 2011 CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, TRUE); 2012 2013 fInternalMsg = TRUE; 1950 2014 switch(Msg) 1951 2015 { … … 1957 2021 break; 1958 2022 } 1959 NotifyParent(Msg, wParam, lParam);1960 1961 2023 rc = 0; 1962 2024 break; 1963 2025 } 1964 case WM_SETTEXT:1965 rc = CallWindowProcW(win32wndproc, getWindowHandle(), WM_SETTEXT, wParam, lParam);1966 break;1967 1968 2026 case WM_LBUTTONDOWN: 1969 2027 case WM_MBUTTONDOWN: … … 1974 2032 1975 2033 case WM_DESTROY: 1976 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);1977 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);1978 break;1979 1980 default:1981 rc = CallWindowProcW(win32wndproc, getWindowHandle(), Msg, wParam, lParam);1982 break;1983 }1984 fInternalMsg = fInternalMsgBackup;1985 return rc;1986 }1987 //******************************************************************************1988 //Called as a result of an OS/2 message1989 //******************************************************************************1990 LRESULT Win32BaseWindow::SendInternalMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)1991 {1992 LRESULT rc;1993 BOOL fInternalMsgBackup = fInternalMsg;1994 1995 DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, FALSE, TRUE);1996 1997 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg1998 return(0);1999 }2000 fInternalMsg = TRUE;2001 switch(Msg)2002 {2003 case WM_CREATE:2004 {2005 if(CallWindowProcA(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {2006 dprintf(("WM_CREATE returned -1\n"));2007 rc = -1; //don't create window2008 break;2009 }2010 NotifyParent(Msg, wParam, lParam);2011 rc = 0;2012 break;2013 }2014 case WM_LBUTTONDOWN:2015 case WM_MBUTTONDOWN:2016 case WM_RBUTTONDOWN:2017 NotifyParent(Msg, wParam, lParam);2018 rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);2019 break;2020 2021 case WM_DESTROY:2022 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);2023 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);2024 break;2025 2026 default:2027 rc = CallWindowProcA(win32wndproc, getWindowHandle(), Msg, wParam, lParam);2028 break;2029 }2030 fInternalMsg = fInternalMsgBackup;2031 return rc;2032 }2033 //******************************************************************************2034 //Called as a result of an OS/2 message2035 //todo, unicode msgs (WM_SETTEXT etc)2036 //******************************************************************************2037 LRESULT Win32BaseWindow::SendInternalMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)2038 {2039 LRESULT rc;2040 BOOL fInternalMsgBackup = fInternalMsg;2041 2042 DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, TRUE, TRUE);2043 2044 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg2045 return(0);2046 }2047 fInternalMsg = TRUE;2048 switch(Msg)2049 {2050 case WM_CREATE:2051 {2052 if(CallWindowProcW(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {2053 dprintf(("WM_CREATE returned -1\n"));2054 rc = -1; //don't create window2055 break;2056 }2057 NotifyParent(Msg, wParam, lParam);2058 rc = 0;2059 break;2060 }2061 case WM_LBUTTONDOWN:2062 case WM_MBUTTONDOWN:2063 case WM_RBUTTONDOWN:2064 NotifyParent(Msg, wParam, lParam);2065 rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);2066 break;2067 2068 case WM_DESTROY:2069 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);2070 2034 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0); 2071 2035 break; … … 2079 2043 //****************************************************************************** 2080 2044 //****************************************************************************** 2045 void Win32BaseWindow::CallWindowHookProc(ULONG hooktype, ULONG Msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode) 2046 { 2047 CWPSTRUCT cwp; 2048 2049 cwp.lParam = lParam; 2050 cwp.wParam = wParam; 2051 cwp.message = Msg; 2052 cwp.hwnd = getWindowHandle(); 2053 2054 switch(hooktype) { 2055 case WH_CALLWNDPROC: 2056 if(fUnicode) { 2057 HOOK_CallHooksW(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp); 2058 } 2059 else HOOK_CallHooksA(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp); 2060 break; 2061 } 2062 } 2063 //****************************************************************************** 2064 //****************************************************************************** 2081 2065 BOOL Win32BaseWindow::PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam) 2082 2066 { … … 2127 2111 //****************************************************************************** 2128 2112 //****************************************************************************** 2129 void Win32BaseWindow::PostMessage(POSTMSG_PACKET *packet) 2130 { 2113 ULONG Win32BaseWindow::PostMessage(POSTMSG_PACKET *packet) 2114 { 2115 ULONG rc; 2116 2131 2117 if(packet == NULL) 2132 return ;2118 return 0; 2133 2119 2134 2120 if(packet->fUnicode) { 2135 SendMessageW(packet->Msg, packet->wParam, packet->lParam);2136 } 2137 else SendMessageA(packet->Msg, packet->wParam, packet->lParam);2121 rc = SendInternalMessageW(packet->Msg, packet->wParam, packet->lParam); 2122 } 2123 else rc = SendInternalMessageA(packet->Msg, packet->wParam, packet->lParam); 2138 2124 2139 2125 free(packet); 2140 } 2141 //****************************************************************************** 2142 //Send message to window of another process 2143 //****************************************************************************** 2144 LRESULT Win32BaseWindow::SendMessageToProcess(UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode) 2145 { 2146 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET)); 2147 2148 dprintf(("SendMessageToProcess %x %x %x %x", getOS2WindowHandle(), msg, wParam, lParam)); 2149 packet->Msg = msg; 2150 packet->wParam = wParam; 2151 packet->lParam = lParam; 2152 packet->fUnicode = fUnicode; 2153 return OSLibSendMessage(getOS2WindowHandle(), WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet); 2126 return rc; 2154 2127 } 2155 2128 //****************************************************************************** … … 2160 2133 Win32BaseWindow *window; 2161 2134 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD; 2162 DWORD processid, myprocessid;2163 2135 2164 2136 dprintf(("BroadCastMessageA %x %x %x", msg, wParam, lParam, GetFS())); 2165 myprocessid = GetCurrentProcessId();2166 2137 2167 2138 for(int i=0;i<MAX_WINDOW_HANDLES;i++) { … … 2172 2143 2173 2144 if(type == BROADCAST_SEND) { 2174 GetWindowThreadProcessId(hwnd, &processid); 2175 if(processid == myprocessid) { 2176 window->SendMessageA(msg, wParam, lParam); 2177 } 2178 else { 2179 window->SendMessageToProcess(msg, wParam, lParam, FALSE); 2180 } 2145 window->SendInternalMessageA(msg, wParam, lParam); 2181 2146 } 2182 2147 else window->PostMessageA(msg, wParam, lParam); … … 2193 2158 Win32BaseWindow *window; 2194 2159 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD; 2195 DWORD processid, myprocessid;2196 2160 2197 2161 2198 2162 dprintf(("BroadCastMessageW %x %x %x", msg, wParam, lParam)); 2199 myprocessid = GetCurrentProcessId();2200 2163 2201 2164 for(int i=0;i<MAX_WINDOW_HANDLES;i++) { … … 2206 2169 2207 2170 if(type == BROADCAST_SEND) { 2208 GetWindowThreadProcessId(hwnd, &processid); 2209 if(processid == myprocessid) { 2210 window->SendMessageW(msg, wParam, lParam); 2211 } 2212 else { 2213 window->SendMessageToProcess(msg, wParam, lParam, TRUE); 2214 } 2171 window->SendInternalMessageW(msg, wParam, lParam); 2215 2172 } 2216 2173 else window->PostMessageW(msg, wParam, lParam); … … 2221 2178 } 2222 2179 //****************************************************************************** 2223 //TODO: do we need to inform the parent of the parent (etc) of the child window?2224 2180 //****************************************************************************** 2225 2181 void Win32BaseWindow::NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam) … … 2235 2191 parentwindow = window->getParent(); 2236 2192 if(parentwindow) { 2237 if(Msg == WM_CREATE || Msg == WM_DESTROY) { 2238 parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), (LPARAM)getWindowHandle()); 2239 } 2240 else parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam ); 2193 parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam ); 2241 2194 } 2242 2195 } … … 2283 2236 if(OSLibWinSetIcon(OS2HwndFrame, hIcon) == TRUE) { 2284 2237 //TODO: Wine does't send these. Correct? 2285 // Send MessageA(WM_SETICON, ICON_BIG, hIcon);2238 // SendInternalMessageA(WM_SETICON, ICON_BIG, hIcon); 2286 2239 return TRUE; 2287 2240 } … … 2309 2262 wParam = SIZE_MINIMIZED; 2310 2263 2311 Send MessageA(WM_SIZE, wParam,2264 SendInternalMessageA(WM_SIZE, wParam, 2312 2265 MAKELONG(rectClient.right-rectClient.left, 2313 2266 rectClient.bottom-rectClient.top)); 2314 Send MessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );2267 SendInternalMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 2315 2268 } 2316 2269 #else 2317 2270 if(fFirstShow) { 2318 2271 if(isFrameWindow() && IS_OVERLAPPED(getStyle()) && !isChild()) { 2319 Send MessageA(WM_SIZE, SIZE_RESTORED,2272 SendInternalMessageA(WM_SIZE, SIZE_RESTORED, 2320 2273 MAKELONG(rectClient.right-rectClient.left, 2321 2274 rectClient.bottom-rectClient.top)); 2322 Send MessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );2275 SendInternalMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 2323 2276 2324 2277 } … … 2491 2444 } 2492 2445 //****************************************************************************** 2493 //Also destroys all the child windows (destroy parent, destroy children)2446 //Also destroys all the child windows (destroy children first, parent last) 2494 2447 //****************************************************************************** 2495 2448 BOOL Win32BaseWindow::DestroyWindow() 2496 2449 { 2450 /* Call hooks */ 2451 if(HOOK_CallHooksA( WH_CBT, HCBT_DESTROYWND, getWindowHandle(), 0L)) 2452 { 2453 return FALSE; 2454 } 2455 2456 if(!(getStyle() & WS_CHILD) && getOwner() == NULL) 2457 { 2458 HOOK_CallHooksA(WH_SHELL, HSHELL_WINDOWDESTROYED, getWindowHandle(), 0L); 2459 /* FIXME: clean up palette - see "Internals" p.352 */ 2460 } 2461 2462 if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_NOPARENTNOTIFY)) 2463 { 2464 if(getParent()) 2465 { 2466 /* Notify the parent window only */ 2467 getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle()); 2468 if( !::IsWindow(getWindowHandle()) ) 2469 { 2470 return TRUE; 2471 } 2472 } 2473 else DebugInt3(); 2474 } 2475 fDestroyWindowCalled = TRUE; 2497 2476 return OSLibWinDestroyWindow(OS2HwndFrame); 2498 2477 } … … 2590 2569 if (isIcon) 2591 2570 { 2592 SendMessageA(WM_ICONERASEBKGND, (WPARAM)hdc, 0); 2593 SendMessageA(WM_PAINTICON, 0, 0); 2594 } else 2595 { 2596 SendMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0); 2597 SendMessageA(WM_PAINT, 0, 0); 2571 SendInternalMessageA(WM_ICONERASEBKGND, (WPARAM)hdc, 0); 2572 SendInternalMessageA(WM_PAINTICON, 0, 0); 2573 } 2574 else 2575 { 2576 SendInternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0); 2577 SendInternalMessageA(WM_PAINT, 0, 0); 2598 2578 } 2599 2579 O32_ReleaseDC(OS2Hwnd, hdc); … … 2999 2979 ss.styleNew = value; 3000 2980 dprintf(("SetWindowLong GWL_EXSTYLE %x old %x new style %x", getWindowHandle(), dwExStyle, value)); 3001 Send MessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);2981 SendInternalMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss); 3002 2982 setExStyle(ss.styleNew); 3003 2983 updateWindowStyle(ss.styleOld,getStyle()); 3004 Send MessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);2984 SendInternalMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss); 3005 2985 return ss.styleOld; 3006 2986 } … … 3016 2996 ss.styleNew = value | (ss.styleOld & (WS_VISIBLE | WS_CHILD)); 3017 2997 dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x", getWindowHandle(), getStyle(), value)); 3018 Send MessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);2998 SendInternalMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss); 3019 2999 setStyle(ss.styleNew); 3020 3000 updateWindowStyle(dwExStyle,ss.styleOld); 3021 Send MessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);3001 SendInternalMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss); 3022 3002 #ifdef DEBUG 3023 3003 PrintWindowStyle(ss.styleNew, 0); … … 3027 3007 case GWL_WNDPROC: 3028 3008 oldval = (LONG)WINPROC_GetProc(win32wndproc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A); 3029 WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, (WNDPROC)value, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A, WIN_PROC_WINDOW); 3009 //WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, (WNDPROC)value, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A, WIN_PROC_WINDOW); 3010 WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, (WNDPROC)value, WINPROC_GetProcType(win32wndproc), WIN_PROC_WINDOW); 3030 3011 return oldval; 3031 3012 case GWL_HINSTANCE:
Note:
See TracChangeset
for help on using the changeset viewer.
