Changeset 5935 for trunk/src/user32/pmwindow.cpp
- Timestamp:
- Jun 9, 2001, 4:50:26 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/pmwindow.cpp
r5805 r5935 1 /* $Id: pmwindow.cpp,v 1.13 2 2001-05-25 19:59:29 sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.133 2001-06-09 14:50:19 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 214 214 rc = (MRESULT)win32wnd->DispatchMsgA(pWinMsg); 215 215 } 216 RELEASE_WNDOBJ(win32wnd); 216 217 RestoreOS2TIB(); 217 218 return rc; … … 229 230 dprintf(("OS2: WM_CREATE %x", hwnd)); 230 231 win32wnd = (Win32BaseWindow *)teb->o.odin.newWindow; 232 win32wnd->addRef(); 231 233 teb->o.odin.newWindow = 0; 232 234 if(win32wnd->MsgCreate(hwnd) == FALSE) … … 302 304 WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 303 305 } 306 if(topwindow) RELEASE_WNDOBJ(topwindow); 304 307 305 308 win32wnd->setComingToTop(FALSE); … … 319 322 dprintf(("USER32: Delayed SetFocus %x %x %x call!", teb->o.odin.hwndFocus, mp1, mp2)); 320 323 if(teb->o.odin.hwndFocus) { 324 RELEASE_WNDOBJ(win32wnd); 321 325 win32wnd = Win32BaseWindow::GetWindowFromHandle(teb->o.odin.hwndFocus); 322 326 if(win32wnd) { … … 373 377 case WM_BUTTON3DBLCLK: 374 378 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 379 RELEASE_WNDOBJ(win32wnd); 375 380 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 376 381 } … … 396 401 { 397 402 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 403 RELEASE_WNDOBJ(win32wnd); 398 404 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 399 405 } … … 525 531 goto RunDefWndProc; 526 532 } 533 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 527 534 RestoreOS2TIB(); 528 535 return (MRESULT)rc; … … 530 537 RunDefWndProc: 531 538 // dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 539 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 532 540 RestoreOS2TIB(); 533 541 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); … … 622 630 { 623 631 dprintf(("PMFRAME:WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle())); 624 RestoreOS2TIB();625 return (MRESULT)FALSE;632 rc = (MRESULT)FALSE; 633 break; 626 634 } 627 635 … … 640 648 case WM_BUTTON3DBLCLK: 641 649 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 650 RELEASE_WNDOBJ(win32wnd); 642 651 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 643 652 } … … 663 672 { 664 673 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 674 RELEASE_WNDOBJ(win32wnd); 665 675 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 666 676 } … … 724 734 if(wndAfter) { 725 735 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 736 RELEASE_WNDOBJ(wndAfter); 726 737 } 727 738 else wp.hwndInsertAfter = HWND_TOP_W; … … 760 771 pswp->hwnd = hwnd; 761 772 762 RestoreOS2TIB();763 return (MRESULT)0xf;764 } 765 RestoreOS2TIB();766 return (MRESULT)0;773 rc = (MRESULT)0xf; 774 break; 775 } 776 rc = 0; 777 break; 767 778 } 768 779 … … 835 846 if(wndAfter) { 836 847 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 848 RELEASE_WNDOBJ(wndAfter); 837 849 } 838 850 else wp.hwndInsertAfter = HWND_TOP_W; … … 959 971 960 972 PosChangedEnd: 961 RestoreOS2TIB();962 return (MRESULT)FALSE;973 rc = (MRESULT)FALSE; 974 break; 963 975 } 964 976 … … 994 1006 if(wndAfter) { 995 1007 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 1008 RELEASE_WNDOBJ(wndAfter); 996 1009 } 997 1010 else wp.hwndInsertAfter = HWND_TOP_W; … … 1046 1059 newRect->yBottom += newClientRect.yBottom; 1047 1060 } 1048 RestoreOS2TIB();1049 return (MRESULT)res;1061 rc = res; 1062 break; 1050 1063 } 1051 1064 #else 1052 1065 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 1053 RestoreOS2TIB();1054 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP);1066 rc = (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 1067 break; 1055 1068 #endif 1056 1069 … … 1078 1091 #endif 1079 1092 1080 #if 01081 //is sent to both windows gaining and loosing the focus1082 case WM_FOCUSCHANGE:1083 {1084 HWND hwndFocus = (HWND)mp1;1085 HWND hwndLoseFocus, hwndGainFocus;1086 USHORT usSetFocus = SHORT1FROMMP(mp2);1087 USHORT fsFocusChange = SHORT2FROMMP(mp2);1088 1089 rc = 0;1090 dprintf(("PMFRAME:WM_FOCUSCHANGE (start) %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange));1091 if(usSetFocus) {1092 hwndGainFocus = hwnd;1093 hwndLoseFocus = hwndFocus;1094 }1095 else {1096 hwndGainFocus = hwndFocus;1097 hwndLoseFocus = hwnd;1098 }1099 1100 if(usSetFocus)1101 {1102 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndLoseFocus);1103 if(!(fsFocusChange & FC_NOSETACTIVE))1104 {1105 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent()))1106 {1107 if(winfocus)1108 WinSendMsg(winfocus->GetTopParent()->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);1109 else1110 WinSendMsg(hwndLoseFocus, WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);1111 }1112 }1113 //SvL: Check if window is still valid1114 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);1115 if(win32wnd == NULL) {1116 RestoreOS2TIB();1117 return (MRESULT)rc;1118 }1119 if(!(fsFocusChange & FC_NOSETACTIVE))1120 {1121 Win32BaseWindow *topparent = win32wnd->GetTopParent();1122 if(!winfocus || (winfocus->GetTopParent() != topparent))1123 {1124 if(!(fsFocusChange & FC_NOBRINGTOTOP))1125 {1126 if(topparent) {1127 //put window at the top of z order1128 WinSetWindowPos(topparent->getOS2WindowHandle(), HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);1129 }1130 }1131 1132 // PH 2000/09/01 Netscape 4.71133 // check if topparent is valid1134 if (topparent)1135 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);1136 }1137 }1138 //SvL: Check if window is still valid1139 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);1140 if(win32wnd == NULL) {1141 break;1142 }1143 1144 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection1145 if(!(fsFocusChange & FC_NOSETSELECTION)) {1146 WinSendMsg(hwndGainFocus, WM_SETSELECTION, (MPARAM)1, (MPARAM)0);1147 }1148 1149 if(!(fsFocusChange & FC_NOSETFOCUS)) {1150 WinSendMsg(hwndGainFocus, WM_SETFOCUS, (MPARAM)hwndLoseFocus, (MPARAM)1);1151 }1152 }1153 else /* no usSetFocus */1154 {1155 if(!(fsFocusChange & FC_NOLOSEFOCUS)) {1156 WinSendMsg(hwndLoseFocus, WM_SETFOCUS, (MPARAM)hwndGainFocus, (MPARAM)0);1157 }1158 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection1159 if(!(fsFocusChange & FC_NOLOSESELECTION)) {1160 WinSendMsg(hwndLoseFocus, WM_SETSELECTION, (MPARAM)0, (MPARAM)0);1161 }1162 //SvL: Check if window is still valid1163 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);1164 if(win32wnd == NULL) {1165 break;1166 }1167 1168 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndGainFocus);1169 if(!(fsFocusChange & FC_NOLOSEACTIVE))1170 {1171 Win32BaseWindow *topparent = win32wnd->GetTopParent();1172 1173 if(!winfocus || (winfocus->GetTopParent() != topparent))1174 {1175 // PH 2000/09/01 Netscape 4.71176 // check if topparent is valid1177 if (topparent)1178 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);1179 }1180 }1181 //SvL: Check if window is still valid1182 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);1183 if(win32wnd == NULL)1184 break;1185 1186 if(!(fsFocusChange & FC_NOSETACTIVE))1187 {1188 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent()))1189 {1190 if(winfocus)1191 {1192 // PH 2000/09/01 Netscape 4.71193 // check if topparent is valid1194 Win32BaseWindow *topparent = winfocus->GetTopParent();1195 if (topparent)1196 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);1197 }1198 else1199 WinSendMsg(hwndGainFocus, WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);1200 }1201 }1202 }1203 1204 1205 #ifdef DEBUG1206 dprintf(("PMFRAME:WM_FOCUSCHANGE (end) %x %x %x", win32wnd->getWindowHandle(), mp1, mp2));1207 #endif1208 break;1209 }1210 #endif1211 1212 1093 #ifdef DEBUG 1213 1094 case WM_FOCUSCHANGE: … … 1237 1118 if (win32wnd->IsModalDialog()) 1238 1119 { 1239 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 1240 1241 if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 1120 if(win32wnd->getOwner()) { 1121 Win32BaseWindow *topOwner = Win32BaseWindow::GetWindowFromHandle(win32wnd->getOwner()->GetTopParent()); 1122 1123 if (topOwner) { 1124 WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 1125 RELEASE_WNDOBJ(topOwner); 1126 } 1127 } 1242 1128 } 1243 1129 } … … 1356 1242 } 1357 1243 RestoreOS2TIB(); 1244 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 1358 1245 return (MRESULT)rc; 1359 1246 1360 1247 RunDefFrameWndProc: 1248 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 1361 1249 RestoreOS2TIB(); 1362 1250 return pfnFrameWndProc(hwnd, msg, mp1, mp2); 1363 1251 1364 1252 RunDefWndProc: 1253 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 1365 1254 RestoreOS2TIB(); 1366 1255 //calling WinDefWindowProc here breaks Opera hotlist window (WM_ADJUSTWINDOWPOS)
Note:
See TracChangeset
for help on using the changeset viewer.