Changeset 6169 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- Jul 4, 2001, 7:46:05 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r6168 r6169 1 /* $Id: win32wbase.cpp,v 1.27 3 2001-07-04 09:55:18sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.274 2001-07-04 17:46:04 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 25 25 * Window rectangle in parent coordinates (relative to parent's client window) 26 26 * (screen coord. if no parent) 27 * 28 * NOTE: Status of window: 29 * Before a window has processed WM_NCCREATE: 30 * - GetTopWindow can't return that window handle 31 * - GetWindow(parent, GW_CHILD) can't return that window handle 32 * - IsChild works 33 * TODO: Does this affect more functions?? (other GetWindow ops) 34 * (verified in NT4, SP6) 27 35 * 28 36 * Project Odin Software License can be found in LICENSE.TXT … … 105 113 OS2HwndModalDialog = 0; 106 114 fInternalMsg = FALSE; 107 fNoSizeMsg = FALSE;108 115 fParentChange = FALSE; 109 fIsDestroyed = FALSE;110 116 fDestroyWindowCalled = FALSE; 111 fCreated = FALSE;112 117 fTaskList = FALSE; 113 118 fParentDC = FALSE; 114 119 fComingToTop = FALSE; 115 fCreateSetWindowPos = FALSE;116 fCreationFinished= FALSE;117 120 fMinMaxChange = FALSE; 118 121 fVisibleRegionChanged = FALSE; 119 122 fEraseBkgndFlag = TRUE; 120 123 124 state = STATE_INIT; 121 125 windowNameA = NULL; 122 126 windowNameW = NULL; … … 502 506 } 503 507 OSLibWinSetVisibleRegionNotify(OS2Hwnd, TRUE); 504 fCreationFinished = TRUE; //creation done with success508 state = STATE_CREATED; 505 509 SetLastError(0); 506 510 return TRUE; … … 516 520 517 521 OS2Hwnd = hwndOS2; 518 519 fNoSizeMsg = TRUE;520 522 521 523 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, getWindowHandle()) == FALSE) { … … 718 720 maxPos.x = rectWindow.left; maxPos.y = rectWindow.top; 719 721 720 //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE721 fCreated = TRUE;722 723 722 if(fTaskList) { 724 723 hTaskList = OSLibWinAddToTaskList(OS2HwndFrame, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0); … … 727 726 localSend32 = (isUnicode) ? ::SendMessageW : ::SendMessageA; 728 727 728 state = STATE_PRE_WMNCCREATE; 729 729 if(localSend32(getWindowHandle(), WM_NCCREATE,0,(LPARAM)cs)) 730 730 { … … 744 744 } 745 745 tmpRect = rectWindow; 746 747 fCreateSetWindowPos = TRUE; 746 state = STATE_POST_WMNCCREATE; 748 747 749 748 //set the window size and update the client 750 749 SetWindowPos(hwndLinkAfter, tmpRect.left, tmpRect.top, tmpRect.right-tmpRect.left, tmpRect.bottom-tmpRect.top,SWP_NOACTIVATE | SWP_NOREDRAW | SWP_FRAMECHANGED); 751 fNoSizeMsg = FALSE; 750 751 state = STATE_PRE_WMCREATE; 752 752 if (cs->style & WS_VISIBLE) dwStyle |= WS_VISIBLE; //program could change position in WM_CREATE 753 753 if( (localSend32(getWindowHandle(), WM_CREATE, 0, (LPARAM)cs )) != -1 ) 754 754 { 755 state = STATE_POST_WMCREATE; 756 755 757 if(!(flags & WIN_NEED_SIZE)) 756 758 { … … 839 841 HWND hwnd = getWindowHandle(); 840 842 841 fIsDestroyed = TRUE;843 state = STATE_DESTROYED; 842 844 843 845 if(fDestroyWindowCalled == FALSE) … … 863 865 TIMER_KillTimerFromWindow(getWindowHandle()); 864 866 865 if(getRefCount() == 0 && getFirstChild() == NULL && fCreationFinished) {867 if(getRefCount() == 0 && getFirstChild() == NULL && state == STATE_CREATED) { 866 868 delete this; 867 869 } … … 895 897 ULONG Win32BaseWindow::MsgShow(BOOL fShow) 896 898 { 897 if( fNoSizeMsg|| fDestroyWindowCalled) {899 if(!CanReceiveSizeMsgs() || fDestroyWindowCalled) { 898 900 return 1; 899 901 } … … 917 919 //SvL: Notes crashes when switching views (calls DestroyWindow -> PM sends 918 920 // a WM_WINDOWPOSCHANGED msg -> crash) 919 if( fNoSizeMsg|| fDestroyWindowCalled)921 if(!CanReceiveSizeMsgs() || fDestroyWindowCalled) 920 922 return 0; 921 923 … … 928 930 //SvL: Notes crashes when switching views (calls DestroyWindow -> PM sends 929 931 // a WM_WINDOWPOSCHANGED msg -> crash) 930 if( fNoSizeMsg|| fDestroyWindowCalled)932 if(CanReceiveSizeMsgs() || fDestroyWindowCalled) 931 933 return 1; 932 934 … … 1202 1204 dprintf(("MsgFormatFrame: old window rect (%d,%d)(%d,%d), new window (%d,%d)(%d,%d)", oldWindowRect.left, oldWindowRect.top, oldWindowRect.right, oldWindowRect.bottom, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom)); 1203 1205 1204 if( fNoSizeMsg|| !EqualRect(&client, &rectClient)) {1206 if(!CanReceiveSizeMsgs() || !EqualRect(&client, &rectClient)) { 1205 1207 OSLibWinSetClientPos(getOS2WindowHandle(), rectClient.left, rectClient.top, getClientWidth(), getClientHeight(), getWindowHeight()); 1206 1208 } … … 1208 1210 #if 1 1209 1211 //this doesn't always work 1210 // if( !fNoSizeMsg&& (client.left != rectClient.left || client.top != rectClient.top))1211 if( !fNoSizeMsg&& ((oldWindowRect.right - oldWindowRect.left < rectClient.left1212 // if(CanReceiveSizeMsgs() && (client.left != rectClient.left || client.top != rectClient.top)) 1213 if(CanReceiveSizeMsgs() && ((oldWindowRect.right - oldWindowRect.left < rectClient.left 1212 1214 || oldWindowRect.bottom - oldWindowRect.top < rectClient.top) || 1213 1215 (EqualRect(&oldWindowRect, &rectWindow) && (client.left != rectClient.left || client.top != rectClient.top)))) … … 2447 2449 #endif 2448 2450 2449 if(!fCreateSetWindowPos) 2451 //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE 2452 if(state < STATE_POST_WMNCCREATE) 2450 2453 {//don't change size; modify internal structures only 2451 2454 //TODO: not 100% correct yet (activate) … … 2783 2786 /* Windows hides the window first, then shows it again 2784 2787 * including the WM_SHOWWINDOW messages and all */ 2785 if( fCreated&& (getStyle() & WS_VISIBLE)) {2788 if(IsWindowCreated() && (getStyle() & WS_VISIBLE)) { 2786 2789 ShowWindow(SW_HIDE); 2787 2790 fShow = TRUE; … … 2832 2835 WM_WINDOWPOSCHANGED notification messages. 2833 2836 */ 2834 if( fCreated) {2837 if(state >= STATE_PRE_WMNCCREATE) { 2835 2838 SetWindowPos(HWND_TOPMOST, 0, 0, 0, 0, 2836 2839 SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|(fShow? SWP_SHOWWINDOW : 0)); … … 2864 2867 { 2865 2868 topwindow = GetWindowFromOS2FrameHandle(hwndTop); 2866 if(topwindow) { 2869 //Note: GetTopWindow can't return a window that hasn't processed 2870 // WM_NCCREATE yet (verified in NT4, SP6) 2871 if(topwindow && topwindow->state >= STATE_POST_WMNCCREATE) { 2867 2872 hwndTop = topwindow->getWindowHandle(); 2868 2873 RELEASE_WNDOBJ(topwindow); 2869 2874 return hwndTop; 2870 2875 } 2876 if(topwindow) RELEASE_WNDOBJ(topwindow); 2871 2877 return 0; 2872 2878 } 2873 2879 while(hwndTop) { 2874 2880 topwindow = GetWindowFromOS2FrameHandle(hwndTop); 2875 if(topwindow) { 2881 //Note: GetTopWindow can't return a window that hasn't processed 2882 // WM_NCCREATE yet (verified in NT4, SP6) 2883 if(topwindow && topwindow->state >= STATE_POST_WMNCCREATE) { 2876 2884 hwndTop = topwindow->getWindowHandle(); 2877 2885 RELEASE_WNDOBJ(topwindow); 2878 2886 return hwndTop; 2879 2887 } 2888 if(topwindow) RELEASE_WNDOBJ(topwindow); 2880 2889 hwndTop = OSLibWinQueryWindow(hwndTop, QWOS_NEXT); 2881 2890 } … … 3201 3210 hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP); 3202 3211 window = GetWindowFromOS2FrameHandle(hwndRelated); 3212 3213 //Before a window has processed WM_NCCREATE: 3214 //- GetWindow(parent, GW_CHILD) can't return that window handle 3215 //(verified in NT4, SP6) 3203 3216 if(window) { 3204 hwndRelated = window->getWindowHandle(); 3205 RELEASE_WNDOBJ(window); 3217 if(window->state >= STATE_POST_WMNCCREATE) { 3218 hwndRelated = window->getWindowHandle(); 3219 RELEASE_WNDOBJ(window); 3220 } 3221 else { 3222 hwndRelated = window->GetWindow(GW_HWNDNEXT); 3223 RELEASE_WNDOBJ(window); 3224 } 3206 3225 } 3207 3226 else hwndRelated = 0; 3227 3208 3228 break; 3209 3229 }
Note:
See TracChangeset
for help on using the changeset viewer.