- Timestamp:
- Jun 9, 2001, 4:50:26 PM (24 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/HOOK.CPP
r5863 r5935 1 /* $Id: HOOK.CPP,v 1. 19 2001-06-01 10:28:17sandervl Exp $ */1 /* $Id: HOOK.CPP,v 1.20 2001-06-09 14:50:15 sandervl Exp $ */ 2 2 3 3 /* … … 767 767 hi.dwContextId = wnd->getWindowContextHelpId(); 768 768 hi.MousePos = msg->pt; 769 RELEASE_WNDOBJ(wnd); 769 770 SendMessageA(msg->hwnd, WM_HELP, 0, (LPARAM)&hi); 770 771 } -
trunk/src/user32/Makefile
r5899 r5935 1 # $Id: Makefile,v 1.8 4 2001-06-03 12:02:25 sandervl Exp $1 # $Id: Makefile,v 1.85 2001-06-09 14:50:15 sandervl Exp $ 2 2 3 3 # … … 32 32 $(OBJDIR)\dcscroll.obj \ 33 33 $(OBJDIR)\user32.obj \ 34 $(OBJDIR)\loadres.obj \35 34 $(OBJDIR)\dde.obj \ 36 $(OBJDIR)\win32wndhandle.obj \37 35 $(OBJDIR)\wsprintf.obj \ 36 $(OBJDIR)\winkeyboard.obj \ 38 37 $(OBJDIR)\winmouse.obj \ 39 $(OBJDIR)\icon.obj \40 $(OBJDIR)\hook.obj \41 $(OBJDIR)\winkeyboard.obj \42 38 $(OBJDIR)\defwndproc.obj \ 43 39 $(OBJDIR)\syscolor.obj \ … … 50 46 $(OBJDIR)\display.obj \ 51 47 $(OBJDIR)\pmwindow.obj \ 52 $(OBJDIR)\win32class.obj \ 53 $(OBJDIR)\win32wnd.obj \ 54 $(OBJDIR)\win32dlg.obj \ 48 $(OBJDIR)\oslibmsgtranslate.obj \ 55 49 $(OBJDIR)\msgbox.obj \ 56 50 $(OBJDIR)\window.obj \ 51 $(OBJDIR)\gen_object.obj \ 52 $(OBJDIR)\win32wndchild.obj \ 53 $(OBJDIR)\win32wbase.obj \ 54 $(OBJDIR)\win32wbasenonclient.obj \ 55 $(OBJDIR)\win32wnd.obj \ 56 $(OBJDIR)\win32wbasepos.obj \ 57 $(OBJDIR)\win32wbaseprop.obj \ 58 $(OBJDIR)\win32wndhandle.obj \ 59 $(OBJDIR)\windowword.obj \ 57 60 $(OBJDIR)\windowmsg.obj \ 61 $(OBJDIR)\winproc.obj \ 62 $(OBJDIR)\oslibmsg.obj \ 63 $(OBJDIR)\hook.obj \ 64 $(OBJDIR)\win32wmdichild.obj \ 65 $(OBJDIR)\win32wmdiclient.obj \ 66 $(OBJDIR)\win32wdesktop.obj \ 67 $(OBJDIR)\win32dlg.obj \ 68 $(OBJDIR)\windlgmsg.obj \ 69 $(OBJDIR)\windlg.obj \ 70 $(OBJDIR)\win32class.obj \ 58 71 $(OBJDIR)\windowclass.obj \ 59 $(OBJDIR)\win32wbase.obj \60 $(OBJDIR)\windowword.obj \61 $(OBJDIR)\gen_object.obj \62 72 $(OBJDIR)\oslibwin.obj \ 63 $(OBJDIR)\win32wndchild.obj \64 73 $(OBJDIR)\controls.obj \ 65 74 $(OBJDIR)\button.obj \ … … 73 82 $(OBJDIR)\icontitle.obj \ 74 83 $(OBJDIR)\clipboard.obj \ 75 $(OBJDIR)\winicon.obj \76 $(OBJDIR)\win32wmdiclient.obj \77 84 $(OBJDIR)\oslibutil.obj \ 78 $(OBJDIR)\oslibmsg.obj \79 85 $(OBJDIR)\dib.obj \ 80 86 $(OBJDIR)\oslibdos.obj \ 81 $(OBJDIR)\win32wmdichild.obj \82 87 $(OBJDIR)\oslibgdi.obj \ 88 $(OBJDIR)\oslibres.obj \ 89 $(OBJDIR)\loadres.obj \ 83 90 $(OBJDIR)\winaccel.obj \ 84 $(OBJDIR)\win32wbasepos.obj \ 85 $(OBJDIR)\win32wbaseprop.obj \ 86 $(OBJDIR)\oslibres.obj \ 91 $(OBJDIR)\icon.obj \ 92 $(OBJDIR)\winicon.obj \ 87 93 $(OBJDIR)\timer.obj \ 88 94 $(OBJDIR)\dbglocal.obj \ 89 95 $(OBJDIR)\caret.obj \ 90 $(OBJDIR)\winproc.obj \91 96 $(OBJDIR)\text.obj \ 92 $(OBJDIR)\oslibmsgtranslate.obj \93 $(OBJDIR)\windlgmsg.obj \94 $(OBJDIR)\windlg.obj \95 $(OBJDIR)\win32wdesktop.obj \96 $(OBJDIR)\win32wbasenonclient.obj \97 97 $(OBJDIR)\oldnls32.obj \ 98 98 $(OBJDIR)\user32rsrc.obj -
trunk/src/user32/caret.cpp
r5685 r5935 1 /* $Id: caret.cpp,v 1.1 7 2001-05-11 08:39:41sandervl Exp $ */1 /* $Id: caret.cpp,v 1.18 2001-06-09 14:50:16 sandervl Exp $ */ 2 2 3 3 /* … … 79 79 80 80 wnd->RemoveFakeOpen32(); 81 RELEASE_WNDOBJ(wnd); 81 82 return (rc); 82 83 } … … 144 145 if (!pHps) 145 146 { 147 RELEASE_WNDOBJ(wnd); 146 148 SetLastError(ERROR_INTERNAL_ERROR); 147 149 return FALSE; … … 166 168 CaretPosX = x; 167 169 CaretPosY = y; 170 RELEASE_WNDOBJ(wnd); 168 171 169 172 rc = WinCreateCursor (cursorInfo.hwnd, xNew, yNew, 0, 0, CURSOR_SETPOS, NULL); … … 212 215 cursorInfo.y = height - caretPos.y; 213 216 } 217 RELEASE_WNDOBJ(wnd); 214 218 } 215 219 pPoint->x = cursorInfo.x; -
trunk/src/user32/clipboard.cpp
r5606 r5935 1 /* $Id: clipboard.cpp,v 1.1 1 2001-04-27 17:36:36 sandervl Exp $ */1 /* $Id: clipboard.cpp,v 1.12 2001-06-09 14:50:16 sandervl Exp $ */ 2 2 3 3 /* … … 27 27 { 28 28 Win32BaseWindow *wndRemove, *wndNext; 29 HWND hwndOS2Remove, hwndOS2Next; 29 30 30 31 wndRemove = Win32BaseWindow::GetWindowFromHandle(hwndRemove); … … 34 35 return 0; 35 36 } 37 hwndOS2Remove = wndRemove->getOS2WindowHandle(); 38 RELEASE_WNDOBJ(wndRemove); 39 36 40 wndNext = Win32BaseWindow::GetWindowFromHandle(hwndNext); 37 41 if(!wndNext) { … … 40 44 return 0; 41 45 } 46 hwndOS2Next = wndNext->getOS2WindowHandle(); 47 RELEASE_WNDOBJ(wndNext); 48 42 49 dprintf(("USER32: ChangeClipboardChain\n")); 43 return O32_ChangeClipboardChain(wndRemove->getOS2WindowHandle(), 44 wndNext->getOS2WindowHandle()); 50 return O32_ChangeClipboardChain(hwndOS2Remove, hwndOS2Next); 45 51 } 46 52 //****************************************************************************** … … 114 120 return NULL; 115 121 } 116 return window->getWindowHandle(); 122 hwndOwner = window->getWindowHandle(); 123 RELEASE_WNDOBJ(window); 124 return hwndOwner; 117 125 } 118 126 //****************************************************************************** … … 131 139 return NULL; 132 140 } 133 return window->getWindowHandle(); 141 hwndViewer = window->getWindowHandle(); 142 RELEASE_WNDOBJ(window); 143 return hwndViewer; 134 144 } 135 145 //****************************************************************************** … … 148 158 return NULL; 149 159 } 150 return window->getWindowHandle(); 160 hwnd = window->getWindowHandle(); 161 RELEASE_WNDOBJ(window); 162 return hwnd; 151 163 } 152 164 //****************************************************************************** … … 177 189 return 0; 178 190 } 191 hwnd = window->getOS2WindowHandle(); 192 RELEASE_WNDOBJ(window); 179 193 } 180 194 dprintf(("USER32: OpenClipboard %x", hwnd)); 181 return O32_OpenClipboard(hwnd ? window->getOS2WindowHandle() : NULL);195 return O32_OpenClipboard(hwnd); 182 196 } 183 197 //****************************************************************************** … … 214 228 Win32BaseWindow *wndnew, *wndold; 215 229 HWND hwndOld; 230 HWND hwndOS2New; 216 231 217 232 wndnew = Win32BaseWindow::GetWindowFromHandle(hwndNew); 218 233 if(!wndnew) { 219 dprintf((" OpenClipboard, window %x not found", hwndNew));234 dprintf(("SetClipboardViewer, window %x not found", hwndNew)); 220 235 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 221 236 return 0; 222 237 } 223 dprintf(("USER32: SetClipboardViewer\n")); 224 hwndOld = O32_SetClipboardViewer(wndnew->getOS2WindowHandle()); 238 dprintf(("USER32: SetClipboardViewer %x", hwndNew)); 239 hwndOS2New = wndnew->getOS2WindowHandle(); 240 RELEASE_WNDOBJ(wndnew); 241 242 hwndOld = O32_SetClipboardViewer(hwndOS2New); 225 243 226 244 wndold = Win32BaseWindow::GetWindowFromOS2Handle(hwndOld); … … 229 247 return 0; 230 248 } 231 return wndold->getWindowHandle(); 232 } 233 //****************************************************************************** 234 //****************************************************************************** 249 hwndOld = wndold->getWindowHandle(); 250 RELEASE_WNDOBJ(wndold); 251 return hwndOld; 252 } 253 //****************************************************************************** 254 //****************************************************************************** -
trunk/src/user32/dc.cpp
r5899 r5935 1 /* $Id: dc.cpp,v 1.10 8 2001-06-03 12:02:26 sandervl Exp $ */1 /* $Id: dc.cpp,v 1.109 2001-06-09 14:50:16 sandervl Exp $ */ 2 2 3 3 /* … … 450 450 } 451 451 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 452 return changePageXForm(wnd, pHps, pValue, x, y, pPrev); 452 BOOL ret = changePageXForm(wnd, pHps, pValue, x, y, pPrev); 453 if(wnd) RELEASE_WNDOBJ(wnd); 454 return ret; 453 455 } 454 456 //****************************************************************************** … … 462 464 } 463 465 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 464 return setPageXForm(wnd, pHps); 466 BOOL ret = setPageXForm(wnd, pHps); 467 if(wnd) RELEASE_WNDOBJ(wnd); 468 return ret; 465 469 } 466 470 //****************************************************************************** … … 476 480 if(wnd) { 477 481 removeClientArea(wnd, pHps); 482 RELEASE_WNDOBJ(wnd); 478 483 } 479 484 } … … 490 495 if(wnd) { 491 496 selectClientArea(wnd, pHps); 497 RELEASE_WNDOBJ(wnd); 492 498 } 493 499 } … … 505 511 if(pHps->isClient) 506 512 selectClientArea(wnd, pHps); 513 RELEASE_WNDOBJ(wnd); 507 514 } 508 515 } … … 521 528 } 522 529 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 523 return clientHeight(wnd, hwnd, pHps); 530 LONG ret = clientHeight(wnd, hwnd, pHps); 531 if(wnd) RELEASE_WNDOBJ(wnd); 532 return ret; 524 533 } 525 534 //****************************************************************************** … … 533 542 } 534 543 else wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(pHps->hwnd); 535 return setMapMode(wnd, pHps, mode); 544 int ret = setMapMode(wnd, pHps, mode); 545 if(wnd) RELEASE_WNDOBJ(wnd); 546 return ret; 536 547 } 537 548 //****************************************************************************** … … 673 684 { 674 685 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 686 RELEASE_WNDOBJ(wnd); 675 687 SetLastError(ERROR_INVALID_PARAMETER_W); 676 688 return (HDC)NULLHANDLE; … … 685 697 { 686 698 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 699 RELEASE_WNDOBJ(wnd); 687 700 SetLastError(ERROR_INVALID_PARAMETER_W); 688 701 return (HDC)NULLHANDLE; … … 773 786 lpps->rcPaint.right = lpps->rcPaint.left = 0; 774 787 } 788 RELEASE_WNDOBJ(wnd); 775 789 776 790 SetLastError(0); … … 814 828 815 829 exit: 830 if(wnd) RELEASE_WNDOBJ(wnd); 816 831 SetLastError(0); 817 832 return TRUE; … … 850 865 dprintf2(("ReleaseDC: CS_OWNDC, not released")); 851 866 } 867 RELEASE_WNDOBJ(wnd); 852 868 } 853 869 … … 928 944 //TODO: intersect/exclude clip region? 929 945 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps)); 946 947 RELEASE_WNDOBJ(wnd); 930 948 return (HDC)hps; 931 949 } … … 1058 1076 1059 1077 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> hdc %x", hwnd, hrgn, flags, pHps->hps)); 1078 RELEASE_WNDOBJ(wnd); 1079 1060 1080 return (HDC)pHps->hps; 1061 1081 … … 1080 1100 O32_DeleteObject (pHps->nullBitmapHandle); 1081 1101 } 1102 if(wnd) RELEASE_WNDOBJ(wnd); 1082 1103 SetLastError(ERROR_INVALID_PARAMETER_W); 1083 1104 return NULL; … … 1323 1344 SetLastError(ERROR_INVALID_PARAMETER_W); 1324 1345 } 1346 if(wnd) RELEASE_WNDOBJ(wnd); 1325 1347 return (success); 1326 1348 } … … 1358 1380 // if(!WinIsWindowShowing(wnd->getOS2FrameWindowHandle()) || !WinIsWindowShowing(wnd->getOS2WindowHandle())) { 1359 1381 // dprintf(("UpdateWindow: window not showing %d/%d", WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle()) )); 1382 // RELEASE_WNDOBJ(wnd); 1360 1383 // return FALSE; 1361 1384 // } … … 1371 1394 } 1372 1395 #endif 1396 RELEASE_WNDOBJ(wnd); 1373 1397 return rc; 1374 1398 } … … 1551 1575 if (lComplexity == RGN_ERROR) 1552 1576 { 1577 RELEASE_WNDOBJ(window); 1553 1578 return ERROR_W; 1554 1579 } … … 1576 1601 if(!child) { 1577 1602 dprintf(("ERROR: ScrollWindowEx, child %x not found", hwnd)); 1603 RELEASE_WNDOBJ(window); 1578 1604 return 0; 1579 1605 } … … 1584 1610 child->ScrollWindow(dx, orgdy); 1585 1611 } 1586 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT_W); 1612 RELEASE_WNDOBJ(child); 1613 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT_W); 1587 1614 } 1588 1615 dprintf(("***ScrollWindowEx: Scroll child windows DONE")); … … 1616 1643 if (rc == FALSE) 1617 1644 { 1645 RELEASE_WNDOBJ(window); 1618 1646 return (0); 1619 1647 } … … 1637 1665 } 1638 1666 1667 RELEASE_WNDOBJ(window); 1639 1668 return (regionType); 1640 1669 } … … 1643 1672 BOOL WIN32API ScrollWindow(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip) 1644 1673 { 1645 Win32BaseWindow *window;1646 1647 window = Win32BaseWindow::GetWindowFromHandle(hwnd);1648 if(!window) {1649 dprintf(("ScrollWindow, window %x not found", hwnd));1650 return 0;1651 }1652 1674 dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip)); 1653 1675 return (ERROR_W != ScrollWindowEx(hwnd, dx, dy, pScroll, pClip, 0, NULL, -
trunk/src/user32/dcrgn.cpp
r5687 r5935 1 /* $Id: dcrgn.cpp,v 1. 5 2001-05-11 13:31:54sandervl Exp $ */1 /* $Id: dcrgn.cpp,v 1.6 2001-06-09 14:50:17 sandervl Exp $ */ 2 2 3 3 /* … … 68 68 if (!pRect) { 69 69 dprintf(("GetUpdateRect returned %d", updateRegionExists)); 70 RELEASE_WNDOBJ(wnd); 70 71 return (updateRegionExists); 71 72 } … … 78 79 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 79 80 } 81 RELEASE_WNDOBJ(wnd); 80 82 return FALSE; 81 83 } … … 97 99 98 100 dprintf(("GetUpdateRect returned (%d,%d)(%d,%d)", pRect->left, pRect->top, pRect->right, pRect->bottom)); 101 RELEASE_WNDOBJ(wnd); 99 102 return updateRegionExists; 100 103 } … … 112 115 dprintf(("WARNING: GetUpdateRgn %x %x %d; invalid handle", hwnd, hrgn, erase)); 113 116 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 117 if(wnd) RELEASE_WNDOBJ(wnd); 114 118 return ERROR_W; 115 119 } … … 118 122 dprintf(("WARNING: GetUpdateRgn %x %x %d; RGN_ERROR", hwnd, hrgn, erase)); 119 123 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 124 RELEASE_WNDOBJ(wnd); 120 125 return ERROR_W; 121 126 } … … 127 132 dprintf(("WARNING: GetUpdateRgn %x %x %d; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn, erase)); 128 133 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 134 RELEASE_WNDOBJ(wnd); 129 135 return ERROR_W; 130 136 } 131 137 if(erase) sendEraseBkgnd(wnd); 132 138 } 139 RELEASE_WNDOBJ(wnd); 133 140 return lComplexity; 134 141 } … … 146 153 dprintf(("WARNING: ExcludeUpdateRgn %x %x; invalid handle", hdc, hwnd)); 147 154 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 155 if(wnd) RELEASE_WNDOBJ(wnd); 148 156 return ERROR_W; 149 157 } … … 155 163 } 156 164 else SetLastError(ERROR_SUCCESS_W); 165 166 RELEASE_WNDOBJ(wnd); 157 167 return lComplexity; // windows and PM values are identical 158 168 } … … 183 193 dprintf(("USER32:GetWindowRgn (%x,%x)", hwnd, hRgn)); 184 194 hWindowRegion = window->GetWindowRegion(); 185 195 RELEASE_WNDOBJ(window); 186 196 return CombineRgn(hRgn, hWindowRegion, 0, RGN_COPY_W); 187 197 } … … 228 238 RedrawWindow(hwnd, 0, 0, RDW_UPDATENOW_W); 229 239 } 240 RELEASE_WNDOBJ(window); 230 241 //TODO: 231 242 // When this function is called, the system sends the WM_WINDOWPOSCHANGING and -
trunk/src/user32/defwndproc.cpp
r4194 r5935 1 /* $Id: defwndproc.cpp,v 1.1 4 2000-09-05 19:20:33sandervl Exp $ */1 /* $Id: defwndproc.cpp,v 1.15 2001-06-09 14:50:17 sandervl Exp $ */ 2 2 3 3 /* … … 31 31 { 32 32 Win32BaseWindow *window; 33 LRESULT result; 33 34 34 35 dprintf2(("DefWindowProcA %x %x %x %x", hwnd, Msg, wParam, lParam)); … … 38 39 return 0; 39 40 } 40 return window->DefWindowProcA(Msg, wParam, lParam); 41 result = window->DefWindowProcA(Msg, wParam, lParam); 42 RELEASE_WNDOBJ(window); 43 return result; 41 44 } 42 45 //****************************************************************************** … … 45 48 { 46 49 Win32BaseWindow *window; 50 LRESULT result; 47 51 48 52 dprintf2(("DefWindowProcW %x %x %x %x", hwnd, Msg, wParam, lParam)); … … 52 56 return 0; 53 57 } 54 return window->DefWindowProcW(Msg, wParam, lParam); 58 result = window->DefWindowProcW(Msg, wParam, lParam); 59 RELEASE_WNDOBJ(window); 60 return result; 55 61 } 56 62 //****************************************************************************** … … 59 65 { 60 66 Win32Dialog *dialog; 67 LRESULT result; 61 68 62 69 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 68 75 } 69 76 if(dialog->IsDialog()) 70 return dialog->DefDlgProcA(Msg, wParam, lParam); 71 else return dialog->DefWindowProcA(Msg, wParam, lParam); 77 result = dialog->DefDlgProcA(Msg, wParam, lParam); 78 else result = dialog->DefWindowProcA(Msg, wParam, lParam); 79 RELEASE_WNDOBJ(dialog); 80 return result; 72 81 } 73 82 //****************************************************************************** … … 76 85 { 77 86 Win32Dialog *dialog; 87 LRESULT result; 78 88 79 89 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 85 95 } 86 96 if(dialog->IsDialog()) 87 return dialog->DefDlgProcW(Msg, wParam, lParam); 88 else return dialog->DefWindowProcW(Msg, wParam, lParam); 97 result = dialog->DefDlgProcW(Msg, wParam, lParam); 98 else result = dialog->DefWindowProcW(Msg, wParam, lParam); 99 RELEASE_WNDOBJ(dialog); 100 return result; 89 101 } 90 102 //****************************************************************************** … … 93 105 { 94 106 Win32Window *window; 107 LRESULT result; 95 108 96 109 window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame); … … 99 112 return 0; 100 113 } 101 return window->DefFrameProcA(hwndMDIClient, Msg, wParam, lParam); 114 result = window->DefFrameProcA(hwndMDIClient, Msg, wParam, lParam); 115 RELEASE_WNDOBJ(window); 116 return result; 102 117 } 103 118 //****************************************************************************** … … 106 121 { 107 122 Win32Window *window; 123 LRESULT result; 108 124 109 125 window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame); … … 112 128 return 0; 113 129 } 114 return window->DefFrameProcW(hwndMDIClient, Msg, wParam, lParam); 130 result = window->DefFrameProcW(hwndMDIClient, Msg, wParam, lParam); 131 RELEASE_WNDOBJ(window); 132 return result; 115 133 } 116 134 //****************************************************************************** … … 119 137 { 120 138 Win32MDIChildWindow *window; 139 LRESULT result; 121 140 122 141 window = (Win32MDIChildWindow *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 127 146 if(!window->isMDIChild()) { 128 147 dprintf(("App called DefMDIChildProcA for non-MDI window %x", hwnd)); 129 re turnwindow->DefWindowProcA(Msg, wParam, lParam);148 result = window->DefWindowProcA(Msg, wParam, lParam); 130 149 } 131 else return window->DefMDIChildProcA(Msg, wParam, lParam); 132 150 else result = window->DefMDIChildProcA(Msg, wParam, lParam); 151 RELEASE_WNDOBJ(window); 152 return result; 133 153 } 134 154 //****************************************************************************** … … 137 157 { 138 158 Win32MDIChildWindow *window; 159 LRESULT result; 139 160 140 161 window = (Win32MDIChildWindow *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 145 166 if(!window->isMDIChild()) { 146 167 dprintf(("App called DefMDIChildProcA for non-MDI window %x", hwnd)); 147 re turnwindow->DefWindowProcW(Msg, wParam, lParam);168 result = window->DefWindowProcW(Msg, wParam, lParam); 148 169 } 149 else return window->DefMDIChildProcW(Msg, wParam, lParam); 170 else result = window->DefMDIChildProcW(Msg, wParam, lParam); 171 RELEASE_WNDOBJ(window); 172 return result; 150 173 } 151 174 //****************************************************************************** -
trunk/src/user32/gen_object.cpp
r5083 r5935 1 /* $Id: gen_object.cpp,v 1. 7 2001-02-10 10:31:31sandervl Exp $ */1 /* $Id: gen_object.cpp,v 1.8 2001-06-09 14:50:17 sandervl Exp $ */ 2 2 /* 3 3 * Generic Object Class for OS/2 … … 16 16 #include <win32type.h> 17 17 #include <gen_object.h> 18 #include <vmutex.h>19 18 20 19 #define DBG_LOCALLOG DBG_gen_object 21 20 #include "dbglocal.h" 22 21 23 VMutex genMutex[OBJTYPE_MAX];24 25 22 //****************************************************************************** 26 23 //****************************************************************************** 27 GenericObject::GenericObject(GenericObject **head, DWORD objType)24 GenericObject::GenericObject(GenericObject **head, CRITICAL_SECTION *pLock) 28 25 { 29 this->objType = objType; 30 this->head = head; 31 this->next = NULL; 26 this->pLock = pLock; 27 this->head = head; 28 this->next = NULL; 29 refCount = 1; 30 31 fLinked = FALSE; 32 fDeletePending = FALSE; 32 33 33 genMutex[objType].enter(); 34 link(); 35 } 36 //****************************************************************************** 37 //****************************************************************************** 38 GenericObject::~GenericObject() 39 { 40 unlink(); 41 } 42 //****************************************************************************** 43 //****************************************************************************** 44 void GenericObject::link() 45 { 46 lock(); 34 47 if(*head == NULL) { 35 48 *head = this; … … 43 56 cur->next = this; 44 57 } 45 genMutex[objType].leave(); 58 fLinked = TRUE; 59 unlock(); 46 60 } 47 61 //****************************************************************************** 48 62 //****************************************************************************** 49 GenericObject::~GenericObject()63 void GenericObject::unlink() 50 64 { 65 if(!fLinked) return; 66 51 67 //remove from linked list 52 genMutex[objType].enter();68 lock(); 53 69 if(*head == this) { 54 70 *head = next; … … 61 77 if(cur == NULL) { 62 78 dprintf(("GenericObject dtor: cur == NULL!!")); 79 unlock(); 63 80 DebugInt3(); 81 return; 64 82 } 65 83 } 66 84 cur->next = next; 67 85 } 68 genMutex[objType].leave(); 86 unlock(); 87 } 88 //****************************************************************************** 89 //****************************************************************************** 90 LONG GenericObject::release() 91 { 92 //// dprintf(("release -> refcount %x", refCount)); 93 #ifdef DEBUG 94 if(refCount-1 < 0) { 95 DebugInt3(); 96 } 97 #endif 98 if(InterlockedDecrement(&refCount) == 0 && fDeletePending) { 99 delete this; 100 return 0; 101 } 102 return refCount; 69 103 } 70 104 //****************************************************************************** … … 77 111 while(cur) { 78 112 next = cur->next; 113 if(cur->getRefCount() != 0) { 114 dprintf(("Refcount %d for object %x", cur->getRefCount(), cur)); 115 } 79 116 delete cur; 80 117 cur = next; … … 83 120 //****************************************************************************** 84 121 //****************************************************************************** 85 void GenericObject::enterMutex()86 {87 genMutex[objType].enter();88 }89 //******************************************************************************90 //******************************************************************************91 void GenericObject::leaveMutex()92 {93 genMutex[objType].leave();94 }95 //******************************************************************************96 //******************************************************************************97 void GenericObject::enterMutex(DWORD objType)98 {99 genMutex[objType].enter();100 }101 //******************************************************************************102 //******************************************************************************103 void GenericObject::leaveMutex(DWORD objType)104 {105 genMutex[objType].leave();106 }107 //******************************************************************************108 //****************************************************************************** -
trunk/src/user32/gen_object.h
r2469 r5935 1 /* $Id: gen_object.h,v 1. 5 2000-01-18 20:08:09sandervl Exp $ */1 /* $Id: gen_object.h,v 1.6 2001-06-09 14:50:17 sandervl Exp $ */ 2 2 /* 3 3 * Generic Object Class for OS/2 … … 10 10 11 11 #include <heapshared.h> 12 13 #define OBJTYPE_WINDOW 0 14 #define OBJTYPE_DIALOG 1 15 #define OBJTYPE_CLASS 2 16 #define OBJTYPE_BITMAP 3 17 #define OBJTYPE_ICON 4 18 #define OBJTYPE_CURSOR 5 19 #define OBJTYPE_MENU 6 20 21 #define OBJTYPE_MAX 7 22 //...... 12 #ifdef OS2_INCLUDED 13 #include <win32api.h> 14 #endif 23 15 24 16 class GenericObject 25 17 { 26 18 public: 27 GenericObject(GenericObject **head, DWORD objType);19 GenericObject(GenericObject **head, CRITICAL_SECTION *pLock); 28 20 virtual ~GenericObject(); 29 30 DWORD getObjectType() { return objType; };31 void setObjectType(DWORD objType) { this->objType = objType; };32 21 33 22 GenericObject *GetHead() { return *head; }; 34 23 GenericObject *GetNext() { return next; }; 35 24 36 void enterMutex();37 void leaveMutex();25 void lock() { EnterCriticalSection(pLock); }; 26 void unlock() { LeaveCriticalSection(pLock); }; 38 27 39 static void enterMutex(DWORD objType); 40 static void leaveMutex(DWORD objType); 28 void link(); 29 void unlink(); 30 31 LONG addRef() { return InterlockedIncrement(&refCount); }; 32 LONG getRefCount() { return refCount; }; 33 LONG release(); 34 35 void markDeleted() { fDeletePending = TRUE; }; 36 37 static void lock(CRITICAL_SECTION *pLock) { EnterCriticalSection(pLock); }; 38 static void unlock(CRITICAL_SECTION *pLock) { LeaveCriticalSection(pLock); }; 41 39 42 40 static void DestroyAll(GenericObject *head); … … 64 62 private: 65 63 66 DWORD objType;67 68 64 protected: 69 65 70 GenericObject **head; 71 GenericObject *next; 66 CRITICAL_SECTION *pLock; 67 LONG refCount; 68 ULONG fLinked : 1, 69 fDeletePending : 1; 70 71 GenericObject **head; 72 GenericObject *next; 72 73 }; 73 74 -
trunk/src/user32/icontitle.cpp
r5496 r5935 1 /* $Id: icontitle.cpp,v 1. 6 2001-04-12 14:04:32sandervl Exp $ */1 /* $Id: icontitle.cpp,v 1.7 2001-06-09 14:50:17 sandervl Exp $ */ 2 2 /* 3 3 * Icontitle window class. … … 52 52 WS_CLIPSIBLINGS, 0, 0, 1, 1, 53 53 parent->getWindowHandle(),0,parent->getInstance(), NULL ); 54 54 55 win32wnd = Win32BaseWindow::GetWindowFromHandle(hWnd); 55 56 if (win32wnd) … … 58 59 win32wnd->setStyle(win32wnd->getStyle() & ~(WS_CAPTION | WS_BORDER)); 59 60 if (parent->getStyle() & WS_DISABLED ) win32wnd->setStyle(win32wnd->getStyle() | WS_DISABLED); 61 RELEASE_WNDOBJ(win32wnd); 60 62 return hWnd; 61 63 } … … 245 247 } 246 248 } 247 248 249 retvalue = DefWindowProcA( hWnd, msg, wParam, lParam ); 249 250 END: 251 if(wnd) RELEASE_WNDOBJ(wnd); 250 252 return retvalue; 251 253 } -
trunk/src/user32/menu.cpp
r5766 r5935 1 /* $Id: menu.cpp,v 1.3 1 2001-05-20 08:49:49sandervl Exp $*/1 /* $Id: menu.cpp,v 1.32 2001-06-09 14:50:18 sandervl Exp $*/ 2 2 /* 3 3 * Menu functions … … 298 298 { 299 299 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 300 301 return win32wnd ? win32wnd->GetMenu():(HMENU)0; 300 301 if(win32wnd) { 302 HMENU hmenu = win32wnd->GetMenu(); 303 RELEASE_WNDOBJ(win32wnd); 304 return hmenu; 305 } 306 return (HMENU)0; 302 307 } 303 308 … … 306 311 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 307 312 308 if (win32wnd) win32wnd->SetMenu(hMenu); 313 if (win32wnd) { 314 win32wnd->SetMenu(hMenu); 315 RELEASE_WNDOBJ(win32wnd); 316 } 309 317 } 310 318 … … 313 321 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 314 322 315 return win32wnd ? win32wnd->GetSysMenu():(HMENU)0; 323 if(win32wnd) { 324 HMENU hmenu = win32wnd->GetSysMenu(); 325 RELEASE_WNDOBJ(win32wnd); 326 return hmenu; 327 } 328 return (HMENU)0; 316 329 } 317 330 … … 320 333 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 321 334 322 win32wnd->SetSysMenu(hMenu); 335 if(win32wnd) { 336 win32wnd->SetSysMenu(hMenu); 337 RELEASE_WNDOBJ(win32wnd); 338 } 323 339 } 324 340 … … 2174 2190 rect.bottom = GetSystemMetrics(SM_CYSIZE); 2175 2191 } 2192 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 2176 2193 } 2177 2194 else … … 2232 2249 2233 2250 ht = win32wnd->HandleNCHitTest(pt); 2251 RELEASE_WNDOBJ(win32wnd); 2234 2252 if( menu->wFlags & MF_POPUP ) 2235 2253 ht = (ht != (UINT)HTNOWHERE && … … 3995 4013 { 3996 4014 HMENU retvalue = 0; 3997 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hWnd); 3998 3999 dprintf(("USER32: GetSystemMenu")); 4000 4001 if (win32wnd) 4015 4016 dprintf(("USER32: GetSystemMenu %x %d", hWnd, bRevert)); 4017 4018 if (IsWindow(hWnd)) 4002 4019 { 4003 4020 HMENU hSysMenu = getSysMenu(hWnd); … … 4063 4080 if (win32wnd->GetSysMenu()) DestroyMenu(win32wnd->GetSysMenu()); 4064 4081 win32wnd->SetSysMenu(MENU_GetSysMenu( hwnd, hMenu )); 4082 RELEASE_WNDOBJ(win32wnd); 4065 4083 return TRUE; 4066 4084 } -
trunk/src/user32/oslibmsgtranslate.cpp
r5805 r5935 1 /* $Id: oslibmsgtranslate.cpp,v 1.5 2 2001-05-25 19:59:29sandervl Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.53 2001-06-09 14:50:18 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 225 225 winMsg->lParam = packet->lParam; 226 226 if(fMsgRemoved == MSG_REMOVE) free(packet); //free the shared memory here 227 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 227 228 return TRUE; 228 229 } … … 231 232 winMsg->wParam = (UINT)os2Msg->mp1; 232 233 winMsg->lParam = (DWORD)os2Msg->mp2; 234 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 233 235 return TRUE; 234 236 } … … 247 249 248 250 win32wnd = (Win32BaseWindow *)teb->o.odin.newWindow; 251 win32wnd->addRef(); 249 252 250 253 winMsg->message = WINWM_CREATE; … … 311 314 { 312 315 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 313 if(wndAfter) 316 if(wndAfter) { 314 317 teb->o.odin.wp.hwndInsertAfter = wndAfter->getWindowHandle(); 318 RELEASE_WNDOBJ(wndAfter); 319 } 315 320 else teb->o.odin.wp.hwndInsertAfter = HWND_TOP_W; 316 321 } … … 388 393 hwnd = WindowFromPoint(winMsg->pt); 389 394 if(win32wnd->getWindowHandle() != hwnd) { 395 RELEASE_WNDOBJ(win32wnd); 390 396 win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 391 397 if(win32wnd == NULL) { … … 401 407 if(!IsWindowEnabled(win32wnd->getWindowHandle())) { 402 408 if(win32wnd->getParent()) { 403 win32wnd = win32wnd->getParent(); 409 Win32BaseWindow *parent = win32wnd->getParent();; 410 if(parent) parent->addRef(); 411 RELEASE_WNDOBJ(win32wnd); 412 win32wnd = parent; 404 413 } 405 414 fWasDisabled = TRUE; … … 463 472 hwnd = WindowFromPoint(winMsg->pt); 464 473 if(win32wnd->getWindowHandle() != hwnd) { 474 RELEASE_WNDOBJ(win32wnd); 465 475 win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 466 476 if(win32wnd == NULL) { … … 476 486 if(!IsWindowEnabled(win32wnd->getWindowHandle())) { 477 487 if(win32wnd->getParent()) { 478 win32wnd = win32wnd->getParent(); 488 Win32BaseWindow *parent = win32wnd->getParent();; 489 if(parent) parent->addRef(); 490 RELEASE_WNDOBJ(win32wnd); 491 win32wnd = parent; 479 492 } 480 493 fWasDisabled = TRUE; … … 793 806 winMsg->wParam = 0; 794 807 winMsg->lParam = 0; 808 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 795 809 return FALSE; 796 810 } 811 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 797 812 return TRUE; 798 813 } -
trunk/src/user32/oslibwin.cpp
r5777 r5935 1 /* $Id: oslibwin.cpp,v 1.9 5 2001-05-22 09:33:10sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.96 2001-06-09 14:50:19 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 19 19 20 20 #include <misc.h> 21 #include "win32type.h"21 #include <win32type.h> 22 22 #include <winconst.h> 23 23 #include "oslibwin.h" -
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) -
trunk/src/user32/pmwindow.h
r3662 r5935 1 /* $Id: pmwindow.h,v 1. 9 2000-06-07 14:51:27sandervl Exp $ */1 /* $Id: pmwindow.h,v 1.10 2001-06-09 14:50:19 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 8 8 #ifndef __PMWINDOW_H__ 9 9 #define __PMWINDOW_H__ 10 11 #include <win32wbase.h> 10 12 11 13 #define WIN32_STDCLASS "Win32WindowClass" … … 21 23 extern ULONG ScreenBitsPerPel; 22 24 25 #define TFOS_LEFT 0x0001 26 #define TFOS_TOP 0x0002 27 #define TFOS_RIGHT 0x0004 28 #define TFOS_BOTTOM 0x0008 29 /* TF_MOVE = TF_LEFT | TF_TOP | TF_RIGHT | TF_BOTTOM */ 30 #define TFOS_MOVE 0x000F 31 32 VOID FrameTrackFrame(Win32BaseWindow *win32wnd,DWORD flags); 33 23 34 #endif -
trunk/src/user32/scroll.cpp
r5769 r5935 1 /* $Id: scroll.cpp,v 1.3 8 2001-05-20 10:44:04sandervl Exp $ */1 /* $Id: scroll.cpp,v 1.39 2001-06-09 14:50:19 sandervl Exp $ */ 2 2 /* 3 3 * Scrollbar control … … 21 21 #include "oslibwin.h" 22 22 #include "initterm.h" 23 #include "pmframe.h"24 23 25 24 #define DBG_LOCALLOG DBG_scroll … … 84 83 case SB_HORZ: 85 84 case SB_VERT: 86 win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 87 if (!win32wnd) return NULL; 88 return win32wnd->getScrollInfo(nBar); 85 { 86 SCROLLBAR_INFO *pInfo; 87 win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 88 89 if (!win32wnd) return NULL; 90 pInfo = win32wnd->getScrollInfo(nBar); 91 RELEASE_WNDOBJ(win32wnd); 92 return pInfo; 93 } 89 94 90 95 case SB_CTL: … … 133 138 lprect->left--; 134 139 lprect->right++; 135 } else if (win32wnd->getStyle() & WS_VSCROLL) 140 } 141 else 142 if (win32wnd->getStyle() & WS_VSCROLL) 136 143 lprect->right++; 144 RELEASE_WNDOBJ(win32wnd); 137 145 vertical = FALSE; 138 146 break; … … 154 162 lprect->top--; 155 163 lprect->bottom++; 156 } else if (win32wnd->getStyle() & WS_HSCROLL) 164 } 165 else 166 if (win32wnd->getStyle() & WS_HSCROLL) 157 167 lprect->bottom++; 168 RELEASE_WNDOBJ(win32wnd); 158 169 vertical = TRUE; 159 170 break; … … 1492 1503 BOOL fShow /* [I] TRUE = show, FALSE = hide */) 1493 1504 { 1494 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);1495 1505 BOOL fShowH = (nBar == SB_HORZ) ? fShow : 0; 1496 1506 BOOL fShowV = (nBar == SB_VERT) ? fShow : 0; 1507 DWORD dwStyle; 1497 1508 1498 1509 dprintf(("ShowScrollBar %04x %d %d\n", hwnd, nBar, fShow)); 1499 if (!win32wnd) return FALSE; 1510 if (!IsWindow(hwnd)) return FALSE; 1511 1512 dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 1500 1513 1501 1514 //CB: does Win32 send a WM_STYLECHANGED message? … … 1510 1523 if (fShow) 1511 1524 { 1512 fShowH = !( win32wnd->getStyle()& WS_HSCROLL);1513 win32wnd->setStyle(win32wnd->getStyle()| WS_HSCROLL);1525 fShowH = !(dwStyle & WS_HSCROLL); 1526 SetWindowLongA(hwnd, GWL_STYLE, dwStyle | WS_HSCROLL); 1514 1527 } 1515 1528 else /* hide it */ 1516 1529 { 1517 fShowH = ( win32wnd->getStyle()& WS_HSCROLL);1518 win32wnd->setStyle(win32wnd->getStyle()& ~WS_HSCROLL);1530 fShowH = (dwStyle & WS_HSCROLL); 1531 SetWindowLongA(hwnd, GWL_STYLE, dwStyle & ~WS_HSCROLL); 1519 1532 } 1520 1533 if( nBar == SB_HORZ ) … … 1528 1541 if (fShow) 1529 1542 { 1530 fShowV = !( win32wnd->getStyle()& WS_VSCROLL);1531 win32wnd->setStyle(win32wnd->getStyle()| WS_VSCROLL);1543 fShowV = !(dwStyle & WS_VSCROLL); 1544 SetWindowLongA(hwnd, GWL_STYLE, dwStyle | WS_VSCROLL); 1532 1545 } 1533 1546 else /* hide it */ 1534 1547 { 1535 fShowV = ( win32wnd->getStyle()& WS_VSCROLL);1536 win32wnd->setStyle(win32wnd->getStyle()& ~WS_VSCROLL);1548 fShowV = (dwStyle & WS_VSCROLL); 1549 SetWindowLongA(hwnd, GWL_STYLE, dwStyle & ~WS_VSCROLL); 1537 1550 } 1538 1551 if ( nBar == SB_VERT ) -
trunk/src/user32/timer.cpp
r3101 r5935 1 /* $Id: timer.cpp,v 1.1 2 2000-03-13 13:10:48sandervl Exp $ */1 /* $Id: timer.cpp,v 1.13 2001-06-09 14:50:20 sandervl Exp $ */ 2 2 3 3 /* … … 113 113 int i; 114 114 TIMER *pTimer; 115 HWND hwndOS2; 115 116 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 116 117 117 if (hwnd && !wnd) return 0; 118 if (hwnd && !wnd) { 119 dprintf(("TIMER_SetTimer invalid window handle %x", hwnd)); 120 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 121 return 0; 122 } 123 124 hwndOS2 = hwnd ? wnd->getOS2WindowHandle() : 0; 125 if(wnd) RELEASE_WNDOBJ(wnd); 126 wnd = NULL; 118 127 119 128 EnterCriticalSection (); … … 147 156 pTimer->id = id; 148 157 pTimer->proc = proc; 149 pTimer->PMhwnd = hwnd ? wnd->getOS2WindowHandle(): NULLHANDLE;158 pTimer->PMhwnd = hwnd ? hwndOS2 : NULLHANDLE; 150 159 pTimer->PMid = WinStartTimer (GetThreadHAB(), pTimer->PMhwnd, 151 160 i + 1, timeout); … … 199 208 VOID TIMER_KillTimerFromWindow(HWND hwnd) 200 209 { 201 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);202 210 int i; 203 211 TIMER * pTimer; 204 212 205 if ( hwnd && !wnd) return;213 if (!IsWindow(hwnd)) return; 206 214 207 215 EnterCriticalSection(); -
trunk/src/user32/win32class.cpp
r5472 r5935 1 /* $Id: win32class.cpp,v 1.2 4 2001-04-04 09:01:25sandervl Exp $ */1 /* $Id: win32class.cpp,v 1.25 2001-06-09 14:50:20 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Managment Code for OS/2 … … 10 10 * Must all be changed if we want to support global app classes 11 11 * that can be used by other apps. (low priority) 12 * 13 * NOTE: To access a class object, you must call FindClass. This method 14 * increases the reference count of the object. When you're done 15 * with the object, you MUST call the release method! 16 * This mechanism prevents premature destruction of objects when there 17 * are still clients using it. 12 18 * 13 19 * Project Odin Software License can be found in LICENSE.TXT … … 34 40 //Win32WndClass methods: 35 41 //****************************************************************************** 36 Win32WndClass::Win32WndClass(WNDCLASSEXA *wndclass, BOOL fUnicode) : GenericObject(&wndclasses, OBJTYPE_CLASS) 42 Win32WndClass::Win32WndClass(WNDCLASSEXA *wndclass, BOOL fUnicode) 43 : GenericObject(&wndclasses, &critsect) 37 44 { 38 45 isUnicode = fUnicode; … … 134 141 else userClassBytes = NULL; 135 142 136 cWindows = 0;137 143 hIconSm = wndclass->hIconSm; 138 144 } … … 142 148 { 143 149 if(classNameA) { 144 dprintf(("Win32WndClass dtor, destroy class %s\n", classNameA));150 dprintf(("Win32WndClass dtor, destroy class %s\n", classNameA)); 145 151 } 146 152 147 153 //SvL: Don't delete global classes 148 154 if(classNameA && !(windowStyle & CS_GLOBALCLASS)) { 149 GlobalDeleteAtom(classAtom);155 GlobalDeleteAtom(classAtom); 150 156 } 151 157 … … 156 162 if(classNameW) free(classNameW); 157 163 if(menuNameA && HIWORD(menuNameA)) { 158 159 160 164 free(menuNameA); 165 assert(menuNameW); 166 free(menuNameW); 161 167 } 162 168 } … … 187 193 } 188 194 //****************************************************************************** 195 //Locates class in linked list and increases reference count (if found) 196 //Class object must be unreferenced after usage 189 197 //****************************************************************************** 190 198 Win32WndClass *Win32WndClass::FindClass(HINSTANCE hInstance, LPSTR id) 191 199 { 192 enterMutex(OBJTYPE_CLASS);200 lock(&critsect); 193 201 194 202 Win32WndClass *wndclass = (Win32WndClass *)wndclasses; 195 203 196 204 if(wndclass == NULL) { 197 leaveMutex(OBJTYPE_CLASS);205 unlock(&critsect); 198 206 return(NULL); 199 207 } … … 202 210 //CB: read comment below! 203 211 if(lstrcmpiA(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) { 204 leaveMutex(OBJTYPE_CLASS); 212 wndclass->addRef(); 213 unlock(&critsect); 205 214 return(wndclass); 206 215 } … … 214 223 wndclass->hInstance == hInstance) 215 224 { 216 leaveMutex(OBJTYPE_CLASS); 225 wndclass->addRef(); 226 unlock(&critsect); 217 227 return(wndclass); 218 228 } … … 226 236 //CB: need more code to compare instance; convert 0 to exe module handle 227 237 if(wndclass->classAtom == (DWORD)id /*&& wndclass->hInstance == hInstance*/) { 228 leaveMutex(OBJTYPE_CLASS); 238 wndclass->addRef(); 239 unlock(&critsect); 229 240 return(wndclass); 230 241 } … … 233 244 while(wndclass != NULL) { 234 245 if(wndclass->classAtom == (DWORD)id /* && wndclass->hInstance == hInstance*/) { 235 leaveMutex(OBJTYPE_CLASS); 246 wndclass->addRef(); 247 unlock(&critsect); 236 248 return(wndclass); 237 249 } … … 240 252 } 241 253 } 242 leaveMutex(OBJTYPE_CLASS);254 unlock(&critsect); 243 255 dprintf(("Class %X (inst %X) not found!", id, hInstance)); 244 256 return(NULL); 245 257 } 246 258 //****************************************************************************** 259 //Locates class in linked list and increases reference count (if found) 260 //Class object must be unreferenced after usage 247 261 //****************************************************************************** 248 262 Win32WndClass *Win32WndClass::FindClass(HINSTANCE hInstance, LPWSTR id) … … 252 266 253 267 if(HIWORD(id)) { 254 lpszClassName = UnicodeToAsciiString((LPWSTR)id);255 } 256 else 268 lpszClassName = UnicodeToAsciiString((LPWSTR)id); 269 } 270 else lpszClassName = (LPSTR)id; 257 271 258 272 winclass = FindClass(hInstance, lpszClassName); … … 551 565 wndclass = FindClass(hinst, id); 552 566 if(wndclass) { 553 if(wndclass->GetWindowCount() != 0) { 567 if(wndclass->getRefCount() != 1) { 568 wndclass->markDeleted(); 569 RELEASE_CLASSOBJ(wndclass); 554 570 dprintf2(("Win32WndClass::UnregisterClassA class %x still has windows!!", id)); 555 571 SetLastError(ERROR_CLASS_HAS_WINDOWS); 556 572 return FALSE; 557 573 } 574 RELEASE_CLASSOBJ(wndclass); 558 575 delete wndclass; 559 576 SetLastError(ERROR_SUCCESS); … … 566 583 //****************************************************************************** 567 584 //****************************************************************************** 568 GenericObject *Win32WndClass::wndclasses = NULL; 585 GenericObject *Win32WndClass::wndclasses = NULL; 586 CRITICAL_SECTION Win32WndClass::critsect = {0}; -
trunk/src/user32/win32class.h
r5242 r5935 1 /* $Id: win32class.h,v 1.1 4 2001-02-22 10:37:30 sandervl Exp $ */1 /* $Id: win32class.h,v 1.15 2001-06-09 14:50:20 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Managment Code for OS/2 … … 12 12 13 13 #include <gen_object.h> 14 15 #define RELEASE_CLASSOBJ(a) { a->release(); a = NULL; } 14 16 15 17 class Win32WndClass : public GenericObject … … 57 59 void setMenuName(LPSTR newMenuName); 58 60 59 void IncreaseWindowCount() { cWindows++; };60 void DecreaseWindowCount() { cWindows--; };61 DWORD GetWindowCount() { return cWindows; };62 63 61 BOOL hasClassName(LPSTR classname, BOOL fUnicode = FALSE); 64 62 … … 67 65 static BOOL UnregisterClassA(HINSTANCE hinst, LPSTR id); 68 66 67 //Locates class in linked list and increases reference count (if found) 68 //Class object must be unreferenced after usage 69 69 static Win32WndClass *FindClass(HINSTANCE hinst, LPSTR id); 70 70 static Win32WndClass *FindClass(HINSTANCE hinst, LPWSTR id); … … 97 97 ULONG processId; 98 98 99 //nr of windows created with this class100 ULONG cWindows;101 102 99 static GenericObject *wndclasses; 100 static CRITICAL_SECTION critsect; 103 101 }; 104 102 -
trunk/src/user32/win32dlg.cpp
r5802 r5935 1 /* $Id: win32dlg.cpp,v 1.6 5 2001-05-25 16:59:11sandervl Exp $ */1 /* $Id: win32dlg.cpp,v 1.66 2001-06-09 14:50:20 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 39 39 Win32Dialog::Win32Dialog(HINSTANCE hInst, LPCSTR dlgTemplate, HWND owner, 40 40 DLGPROC dlgProc, LPARAM param, BOOL isUnicode) 41 : Win32BaseWindow( OBJTYPE_DIALOG)41 : Win32BaseWindow() 42 42 { 43 43 RECT rect; … … 312 312 /* Owner must be a top-level window */ 313 313 if(getOwner() == NULL) { 314 windowDesktop->addRef(); 314 315 topOwner = windowDesktop; 315 316 } 316 else topOwner = getOwner()->GetTopParent();317 else topOwner = GetWindowFromHandle(getOwner()->GetTopParent()); 317 318 318 319 if(topOwner == NULL) { … … 415 416 topOwner->setOS2HwndModalDialog(hwndOldDialog); 416 417 if (!bOldOwner) topOwner->EnableWindow(TRUE); 418 RELEASE_WNDOBJ(topOwner); 417 419 } 418 420 retval = idResult; … … 869 871 CONTROLS_IsControl( wndFocus->getParent(), COMBOBOX_CONTROL )) 870 872 wndFocus->SendMessageA(CB_SHOWDROPDOWN, FALSE, 0 ); 873 RELEASE_WNDOBJ(wndFocus); 871 874 } 872 875 } -
trunk/src/user32/win32dlg.h
r4686 r5935 1 /* $Id: win32dlg.h,v 1.1 2 2000-11-24 10:30:36sandervl Exp $ */1 /* $Id: win32dlg.h,v 1.13 2001-06-09 14:50:21 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 67 67 LRESULT DefDlgProcW(UINT Msg, WPARAM wParam, LPARAM lParam); 68 68 69 Win32BaseWindow *getDlgItem(int id) { return FindWindowById(id); };69 HWND getDlgItem(int id) { return FindWindowById(id); }; 70 70 71 71 BOOL endDialog(int retval); -
trunk/src/user32/win32wbase.cpp
r5810 r5935 1 /* $Id: win32wbase.cpp,v 1.2 59 2001-05-27 19:01:35sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.260 2001-06-09 14:50:21 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 14 14 * 15 15 * TODO: Not thread/process safe 16 * 17 * NOTE: To access a window object, you must call GetWindowFromOS2Handle or 18 * GetWindowFromHandle. Both these methods increase the reference count 19 * of the object. When you're done with the object, you MUST call 20 * the release method! 21 * This mechanism prevents premature destruction of objects when there 22 * are still clients using it. 16 23 * 17 24 * NOTE: Client rectangle always relative to frame window … … 66 73 //****************************************************************************** 67 74 //****************************************************************************** 68 Win32BaseWindow::Win32BaseWindow(DWORD objType) : GenericObject(&windows, objType) 75 Win32BaseWindow::Win32BaseWindow() 76 : GenericObject(&windows, &critsect), ChildWindow(&critsect) 69 77 { 70 78 Init(); … … 72 80 //****************************************************************************** 73 81 //****************************************************************************** 74 Win32BaseWindow::Win32BaseWindow(HWND hwndOS2, ULONG reserved) : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow() 82 Win32BaseWindow::Win32BaseWindow(HWND hwndOS2, ULONG reserved) 83 : GenericObject(&windows, &critsect), ChildWindow(&critsect) 75 84 { 76 85 Init(); … … 80 89 //****************************************************************************** 81 90 Win32BaseWindow::Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode) 82 : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow()91 : GenericObject(&windows, &critsect), ChildWindow(&critsect) 83 92 { 84 93 Init(); … … 115 124 nrUserWindowBytes= 0; 116 125 117 magic = WIN32PM_MAGIC;118 126 OS2Hwnd = 0; 119 127 OS2HwndFrame = 0; … … 179 187 Win32BaseWindow::~Win32BaseWindow() 180 188 { 189 if(getRefCount() < 0) { 190 DebugInt3(); 191 } 192 181 193 if(hTaskList) { 182 194 OSLibWinRemoveFromTasklist(hTaskList); … … 187 199 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0); 188 200 189 if(!fDestroyAll && getParent() && getParent()->getFirstChild() == this && getNextChild() == NULL)190 {191 //if we're the last child that's being destroyed and our192 //parent window was also destroyed, then we delete the parent object193 if(getParent()->IsWindowDestroyed())194 {195 dprintf(("Last Child (%x) destroyed, get rid of our parent window (%x)", getWindowHandle(), getParent()->getWindowHandle()));196 delete getParent();197 setParent(NULL); //or else we'll crash in the dtor of the ChildWindow class198 }199 }200 else201 201 if(fDestroyAll) { 202 202 dprintf(("Destroying window %x %s", getWindowHandle(), windowNameA)); … … 206 206 /* Decrement class window counter */ 207 207 if(windowClass) { 208 windowClass->DecreaseWindowCount();208 RELEASE_CLASSOBJ(windowClass); 209 209 } 210 210 … … 236 236 if(propertyList) { 237 237 removeWindowProps(); 238 } 239 Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild(); 240 if(wndparent) { 241 RELEASE_WNDOBJ(wndparent); 242 } 243 if(windowClass) { 244 RELEASE_CLASSOBJ(windowClass); 238 245 } 239 246 } … … 287 294 if (!window->IsWindow() ) 288 295 { 296 RELEASE_WNDOBJ(window); 289 297 dprintf(("Bad parent %04x\n", cs->hwndParent )); 290 298 SetLastError(ERROR_INVALID_PARAMETER); 291 299 return FALSE; 292 300 } 301 RELEASE_WNDOBJ(window); 293 302 /* Windows does this for overlapped windows 294 303 * (I don't know about other styles.) */ … … 314 323 return 0; 315 324 } 316 /* Increment class window counter */317 windowClass->IncreaseWindowCount();318 325 319 326 #ifdef DEBUG … … 417 424 else 418 425 { 419 owner = GetWindowFromHandle( cs->hwndParent)->GetTopParent();426 owner = GetWindowFromHandle(GetWindowFromHandle(cs->hwndParent)->GetTopParent()); 420 427 if(owner == NULL) 421 428 { … … 491 498 fNoSizeMsg = TRUE; 492 499 493 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {500 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, getWindowHandle()) == FALSE) { 494 501 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd)); 495 502 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error … … 827 834 SendInternalMessageA(WM_NCDESTROY, 0, 0); 828 835 829 TIMER_KillTimerFromWindow( OS2Hwnd);830 831 if(get FirstChild() == NULL && fCreationFinished) {836 TIMER_KillTimerFromWindow(getWindowHandle()); 837 838 if(getRefCount() == 0 && getFirstChild() == NULL && fCreationFinished) { 832 839 delete this; 833 840 } 834 841 else { 835 842 //make sure no message can ever arrive for this window again (PM or from other win32 windows) 843 dprintf(("Mark window %x (%x) as deleted", getWindowHandle(), this)); 844 markDeleted(); 836 845 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0); 837 846 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0); … … 1028 1037 1029 1038 /* Activate the window if needed */ 1030 hwndTop = (GetTopParent()) ? GetTopParent()->getWindowHandle() : 0;1039 hwndTop = GetTopParent(); 1031 1040 1032 1041 HWND hwndActive = GetActiveWindow(); … … 1673 1682 if(wParam == VK_F4) /* try to close the window */ 1674 1683 { 1675 Win32BaseWindow *window = Get TopParent();1684 Win32BaseWindow *window = GetWindowFromHandle(GetTopParent()); 1676 1685 if(window && !(window->getClass()->getStyle() & CS_NOCLOSE)) 1677 1686 PostMessageA(window->getWindowHandle(), WM_SYSCOMMAND, SC_CLOSE, 0); 1687 if(window) RELEASE_WNDOBJ(window); 1678 1688 return 0; 1679 1689 } … … 2749 2759 OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP); 2750 2760 2751 //TODO: Send WM_STYLECHANGED msg?2761 //TODO: Send WM_STYLECHANGED msg? 2752 2762 setStyle(getStyle() & ~WS_CHILD); 2753 2763 setWindowId(0); … … 2790 2800 topwindow = GetWindowFromOS2FrameHandle(hwndTop); 2791 2801 if(topwindow) { 2792 return topwindow->getWindowHandle(); 2802 hwndTop = topwindow->getWindowHandle(); 2803 RELEASE_WNDOBJ(topwindow); 2804 return hwndTop; 2793 2805 } 2794 2806 return 0; … … 2797 2809 topwindow = GetWindowFromOS2FrameHandle(hwndTop); 2798 2810 if(topwindow) { 2799 return topwindow->getWindowHandle(); 2811 hwndTop = topwindow->getWindowHandle(); 2812 RELEASE_WNDOBJ(topwindow); 2813 return hwndTop; 2800 2814 } 2801 2815 hwndTop = OSLibWinQueryWindow(hwndTop, QWOS_NEXT); … … 2807 2821 // Get the top-level parent for a child window. 2808 2822 //****************************************************************************** 2809 Win32BaseWindow *Win32BaseWindow::GetTopParent()2823 HWND Win32BaseWindow::GetTopParent() 2810 2824 { 2811 2825 Win32BaseWindow *window = this; 2812 2826 HWND hwndTopParent = 0; 2827 2828 lock(); 2813 2829 while(window && (window->getStyle() & WS_CHILD)) 2814 2830 { 2815 2831 window = window->getParent(); 2816 2832 } 2817 return window; 2833 if(window) { 2834 hwndTopParent = window->getWindowHandle(); 2835 } 2836 unlock(); 2837 return hwndTopParent; 2818 2838 } 2819 2839 //****************************************************************************** … … 2907 2927 //****************************************************************************** 2908 2928 //****************************************************************************** 2909 Win32BaseWindow *Win32BaseWindow::FindWindowById(int id) 2910 { 2929 HWND Win32BaseWindow::FindWindowById(int id) 2930 { 2931 lock(); 2911 2932 for (Win32BaseWindow *child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild()) 2912 2933 { 2913 2934 if (child->getWindowId() == id) 2914 2935 { 2915 return child; 2916 } 2917 } 2936 unlock(); 2937 return child->getWindowHandle(); 2938 } 2939 } 2940 unlock(); 2918 2941 return 0; 2919 2942 } … … 2987 3010 OSLibWinEndEnumWindows(henum); 2988 3011 dprintf(("FindWindowEx: Found window %x", wnd->getWindowHandle())); 2989 return wnd->getWindowHandle(); 3012 HWND hwndret = wnd->getWindowHandle(); 3013 RELEASE_WNDOBJ(wnd); 3014 return hwndret; 2990 3015 } 3016 RELEASE_WNDOBJ(wnd); 2991 3017 } 2992 3018 hwnd = OSLibWinGetNextWindow(henum); … … 3014 3040 if(window) { 3015 3041 hwndRelated = window->getWindowHandle(); 3042 RELEASE_WNDOBJ(window); 3016 3043 } 3017 3044 else hwndRelated = 0; … … 3031 3058 if(window) { 3032 3059 hwndRelated = window->getWindowHandle(); 3060 RELEASE_WNDOBJ(window); 3033 3061 } 3034 3062 else hwndRelated = 0; … … 3046 3074 if(window) { 3047 3075 hwndRelated = window->getWindowHandle(); 3076 RELEASE_WNDOBJ(window); 3048 3077 } 3049 3078 else hwndRelated = 0; … … 3061 3090 if(window) { 3062 3091 hwndRelated = window->getWindowHandle(); 3092 RELEASE_WNDOBJ(window); 3063 3093 } 3064 3094 else hwndRelated = 0; … … 3081 3111 if(window) { 3082 3112 hwndRelated = window->getWindowHandle(); 3113 RELEASE_WNDOBJ(window); 3083 3114 } 3084 3115 else hwndRelated = 0; … … 3174 3205 { 3175 3206 HWND hwndActive; 3176 Win32BaseWindow *win32wnd;3177 ULONG magic;3178 3207 3179 3208 hwndActive = OSLibWinQueryActiveWindow(); … … 3377 3406 } 3378 3407 oldval = (LONG)WINPROC_GetProc(win32wndproc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A); 3408 dprintf(("SetWindowLong GWL_WNDPROC %x old %x new style %x", getWindowHandle(), oldval, value)); 3379 3409 WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, (WNDPROC)value, type, WIN_PROC_WINDOW); 3380 3410 break; … … 3500 3530 //****************************************************************************** 3501 3531 //****************************************************************************** 3502 Win32BaseWindow *Win32BaseWindow::GetWindowFromHandle(HWND hwnd)3503 {3504 Win32BaseWindow *window;3505 3506 if(HwGetWindowHandleData(hwnd, (DWORD *)&window) == TRUE) {3507 return window;3508 }3509 // dprintf2(("Win32BaseWindow::GetWindowFromHandle: not a win32 window %x", hwnd));3510 return NULL;3511 }3512 //******************************************************************************3513 //******************************************************************************3514 Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2Handle(HWND hwnd)3515 {3516 Win32BaseWindow *win32wnd;3517 DWORD magic;3518 3519 if(hwnd == OSLIB_HWND_DESKTOP)3520 {3521 return windowDesktop;3522 }3523 3524 win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwnd, OFFSET_WIN32WNDPTR);3525 magic = OSLibWinGetWindowULong(hwnd, OFFSET_WIN32PM_MAGIC);3526 3527 if(win32wnd && CheckMagicDword(magic)) {3528 return win32wnd;3529 }3530 // dprintf2(("Win32BaseWindow::GetWindowFromOS2Handle: not an Odin os2 window %x", hwnd));3531 return 0;3532 }3533 //******************************************************************************3534 //******************************************************************************3535 Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2FrameHandle(HWND hwnd)3536 {3537 return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT));3538 }3539 //******************************************************************************3540 //******************************************************************************3541 3532 HWND Win32BaseWindow::getNextDlgGroupItem(HWND hwndCtrl, BOOL fPrevious) 3542 3533 { … … 3622 3613 return retvalue; 3623 3614 } 3615 //****************************************************************************** 3616 //Locates window in linked list and increases reference count (if found) 3617 //Window object must be unreferenced after usage 3618 //****************************************************************************** 3619 Win32BaseWindow *Win32BaseWindow::GetWindowFromHandle(HWND hwnd) 3620 { 3621 Win32BaseWindow *window; 3622 3623 lock(&critsect); 3624 if(HwGetWindowHandleData(hwnd, (DWORD *)&window) == TRUE) { 3625 if(window) { 3626 //// dprintf(("addRef %x; refcount %d", hwnd, window->getRefCount()+1)); 3627 window->addRef(); 3628 } 3629 unlock(&critsect); 3630 return window; 3631 } 3632 unlock(&critsect); 3633 // dprintf2(("Win32BaseWindow::GetWindowFromHandle: not a win32 window %x", hwnd)); 3634 return NULL; 3635 } 3636 //****************************************************************************** 3637 //Locates window in linked list and increases reference count (if found) 3638 //Window object must be unreferenced after usage 3639 //****************************************************************************** 3640 Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2Handle(HWND hwndOS2) 3641 { 3642 DWORD magic; 3643 HWND hwnd; 3644 3645 if(hwndOS2 == OSLIB_HWND_DESKTOP) 3646 { 3647 windowDesktop->addRef(); 3648 return windowDesktop; 3649 } 3650 3651 hwnd = (HWND)OSLibWinGetWindowULong(hwndOS2, OFFSET_WIN32WNDPTR); 3652 magic = OSLibWinGetWindowULong(hwndOS2, OFFSET_WIN32PM_MAGIC); 3653 3654 if(hwnd && CheckMagicDword(magic)) { 3655 return GetWindowFromHandle(hwnd); 3656 } 3657 // dprintf2(("Win32BaseWindow::GetWindowFromOS2Handle: not an Odin os2 window %x", hwndOS2)); 3658 return 0; 3659 } 3660 //****************************************************************************** 3661 //Locates window in linked list and increases reference count (if found) 3662 //Window object must be unreferenced after usage 3663 //****************************************************************************** 3664 Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2FrameHandle(HWND hwnd) 3665 { 3666 return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT)); 3667 } 3668 //****************************************************************************** 3669 //****************************************************************************** 3670 HWND WIN32API Win32ToOS2Handle(HWND hwnd) 3671 { 3672 HWND hwndOS2; 3673 3674 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(hwnd); 3675 3676 if(window) { 3677 hwndOS2 = window->getOS2WindowHandle(); 3678 RELEASE_WNDOBJ(window); 3679 return hwndOS2; 3680 } 3681 // dprintf2(("Win32BaseWindow::Win32ToOS2Handle: not a win32 window %x", hwnd)); 3682 return hwnd; 3683 } 3684 //****************************************************************************** 3685 //****************************************************************************** 3686 HWND WIN32API OS2ToWin32Handle(HWND hwnd) 3687 { 3688 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 3689 HWND hwndWin32; 3690 3691 if(window) { 3692 hwndWin32 = window->getWindowHandle(); 3693 RELEASE_WNDOBJ(window); 3694 return hwndWin32; 3695 } 3696 window = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd); 3697 if(window) { 3698 hwndWin32 = window->getWindowHandle(); 3699 RELEASE_WNDOBJ(window); 3700 return hwndWin32; 3701 } 3702 3703 // dprintf2(("Win32BaseWindow::OS2ToWin32Handle: not a win32 window %x", hwnd)); 3704 return 0; 3705 // else return hwnd; //OS/2 window handle 3706 } 3707 //****************************************************************************** 3708 //****************************************************************************** 3709 GenericObject *Win32BaseWindow::windows = NULL; 3710 CRITICAL_SECTION Win32BaseWindow::critsect = {0}; 3711 3624 3712 //****************************************************************************** 3625 3713 //****************************************************************************** … … 3718 3806 //****************************************************************************** 3719 3807 //****************************************************************************** 3720 HWND WIN32API Win32ToOS2Handle(HWND hwnd)3721 {3722 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(hwnd);3723 3724 if(window) {3725 return window->getOS2WindowHandle();3726 }3727 // dprintf2(("Win32BaseWindow::Win32ToOS2Handle: not a win32 window %x", hwnd));3728 return hwnd;3729 }3730 //******************************************************************************3731 //******************************************************************************3732 HWND WIN32API OS2ToWin32Handle(HWND hwnd)3733 {3734 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);3735 3736 if(window) {3737 return window->getWindowHandle();3738 }3739 window = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd);3740 if(window) {3741 return window->getWindowHandle();3742 }3743 3744 // dprintf2(("Win32BaseWindow::OS2ToWin32Handle: not a win32 window %x", hwnd));3745 return 0;3746 // else return hwnd; //OS/2 window handle3747 }3748 //******************************************************************************3749 //******************************************************************************3750 3751 GenericObject *Win32BaseWindow::windows = NULL; -
trunk/src/user32/win32wbase.h
r5805 r5935 1 /* $Id: win32wbase.h,v 1.11 7 2001-05-25 19:59:30sandervl Exp $ */1 /* $Id: win32wbase.h,v 1.118 2001-06-09 14:50:21 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 35 35 #define CheckMagicDword(a) (a==WIN32PM_MAGIC) 36 36 37 #define RELEASE_WNDOBJ(a) { a->release(); a = NULL; } 38 37 39 typedef struct { 38 40 USHORT cb; … … 109 111 { 110 112 public: 111 DWORD magic; 112 113 Win32BaseWindow(DWORD objType); 113 Win32BaseWindow(); 114 114 Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode); 115 115 Win32BaseWindow(HWND hwndOS2, ULONG reserved); … … 227 227 BOOL GetWindowPlacement(LPWINDOWPLACEMENT winpos); 228 228 BOOL ScrollWindow(int dx, int dy); 229 229 virtual BOOL DestroyWindow(); 230 230 HWND SetActiveWindow(); 231 231 BOOL DeactivateChildWindow(); … … 236 236 237 237 HWND GetTopWindow(); 238 Win32BaseWindow *GetTopParent();238 HWND GetTopParent(); 239 239 240 240 HWND GetWindow(UINT uCmd); … … 295 295 void NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam); 296 296 297 Win32BaseWindow *FindWindowById(int id);297 HWND FindWindowById(int id); 298 298 299 299 static HWND FindWindowEx(HWND hwndParent, HWND hwndChildAfter, ATOM atom, LPSTR lpszWindow); … … 316 316 INT enumPropsExW(PROPENUMPROCEXW func, LPARAM lParam); 317 317 318 //Locates window in linked list and increases reference count (if found) 319 //Window object must be unreferenced after usage 318 320 static Win32BaseWindow *GetWindowFromHandle(HWND hwnd); 319 321 static Win32BaseWindow *GetWindowFromOS2Handle(HWND hwnd); … … 351 353 ULONG dwIDMenu; //GWL_ID 352 354 ULONG userData; //GWL_USERDATA 355 353 356 354 357 HWND hwndLinkAfter; … … 416 419 417 420 static GenericObject *windows; 421 static CRITICAL_SECTION critsect; 418 422 419 423 private: -
trunk/src/user32/win32wbasenonclient.cpp
r5404 r5935 1 /* $Id: win32wbasenonclient.cpp,v 1.3 0 2001-03-30 11:14:36sandervl Exp $ */1 /* $Id: win32wbasenonclient.cpp,v 1.31 2001-06-09 14:50:22 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (non-client methods) … … 25 25 #include <win32wbase.h> 26 26 #include "wndmsg.h" 27 #include "pmframe.h"28 27 #include "oslibwin.h" 29 28 #include "oslibmsg.h" … … 37 36 #include "win32wdesktop.h" 38 37 #include "controls.h" 38 #include "pmwindow.h" 39 39 #include <menu.h> 40 40 … … 262 262 case HTCAPTION: 263 263 { 264 Win32BaseWindow *topparent = GetTopParent();264 HWND hwndTopParent = GetTopParent(); 265 265 266 266 if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_MDICHILD)) 267 267 { 268 if (GetActiveWindow() != topparent->getWindowHandle())268 if (GetActiveWindow() != hwndTopParent) 269 269 { 270 270 //SvL: Calling topparent->SetActiveWindow() causes focus problems 271 topparent->SetActiveWindow();271 ::SetActiveWindow(hwndTopParent); 272 272 //// OSLibWinSetFocus(topparent->getOS2WindowHandle()); 273 273 } 274 if (GetActiveWindow() == topparent->getWindowHandle())274 if (GetActiveWindow() == hwndTopParent) 275 275 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam); 276 else dprintf(("ACtive window (%x) != toplevel wnd %x", OSLibWinQueryActiveWindow(), topparent->getWindowHandle()));276 else dprintf(("ACtive window (%x) != toplevel wnd %x", OSLibWinQueryActiveWindow(), hwndTopParent)); 277 277 } 278 278 else { 279 279 SetActiveWindow(); 280 if (GetActiveWindow() == topparent->getWindowHandle())280 if (GetActiveWindow() == hwndTopParent) 281 281 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam); 282 282 else dprintf(("ACtive window (%x) != wnd %x", OSLibWinQueryActiveWindow(), getWindowHandle())); -
trunk/src/user32/win32wbasepos.cpp
r5777 r5935 1 /* $Id: win32wbasepos.cpp,v 1.2 5 2001-05-22 09:33:16sandervl Exp $ */1 /* $Id: win32wbasepos.cpp,v 1.26 2001-06-09 14:50:22 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (nonclient/position methods) … … 35 35 #include "win32wndhandle.h" 36 36 #include "dc.h" 37 #include "pmframe.h"38 37 #include "win32wdesktop.h" 39 38 #include <win\hook.h> … … 256 255 break; /* There's a window in there */ 257 256 } 257 RELEASE_WNDOBJ(child); 258 258 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT); 259 259 } -
trunk/src/user32/win32wdesktop.cpp
r5685 r5935 1 /* $Id: win32wdesktop.cpp,v 1.1 6 2001-05-11 08:39:46sandervl Exp $ */1 /* $Id: win32wdesktop.cpp,v 1.17 2001-06-09 14:50:22 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Desktop Window for OS/2 … … 44 44 //****************************************************************************** 45 45 //****************************************************************************** 46 Win32Desktop::Win32Desktop() : Win32BaseWindow( OBJTYPE_WINDOW)46 Win32Desktop::Win32Desktop() : Win32BaseWindow() 47 47 { 48 48 rectWindow.left = 0; … … 86 86 { 87 87 return TRUE; //of course we succeeded 88 } 89 //****************************************************************************** 90 //****************************************************************************** 91 BOOL Win32Desktop::DestroyWindow() 92 { 93 dprintf(("WARNING: can't destroy desktop window!!")); 94 return FALSE; 88 95 } 89 96 //****************************************************************************** -
trunk/src/user32/win32wdesktop.h
r3663 r5935 1 /* $Id: win32wdesktop.h,v 1. 7 2000-06-07 21:45:52 sandervl Exp $ */1 /* $Id: win32wdesktop.h,v 1.8 2001-06-09 14:50:22 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Desktop Window for OS/2 … … 24 24 25 25 virtual BOOL EnableWindow(BOOL fEnable); 26 26 virtual BOOL DestroyWindow(); 27 27 virtual BOOL isDesktopWindow(); 28 28 -
trunk/src/user32/win32wmdichild.cpp
r4573 r5935 1 /* $Id: win32wmdichild.cpp,v 1.2 5 2000-11-09 18:15:22sandervl Exp $ */1 /* $Id: win32wmdichild.cpp,v 1.26 2001-06-09 14:50:23 sandervl Exp $ */ 2 2 /* 3 3 * Win32 MDI Child Window Class for OS/2 … … 46 46 //****************************************************************************** 47 47 Win32MDIChildWindow::Win32MDIChildWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL fUnicode) 48 : Win32BaseWindow( OBJTYPE_WINDOW)48 : Win32BaseWindow() 49 49 { 50 50 isUnicode = fUnicode; … … 73 73 DefWindowProcA(Msg, wParam, lParam); 74 74 menuModifyItem(); 75 if( client->getMaximizedChild() == this)75 if( client->getMaximizedChild() == getWindowHandle() ) 76 76 client->updateFrameText(MDI_REPAINTFRAME, NULL); 77 77 return 0; … … 93 93 94 94 case WM_SETFOCUS: 95 if(client->getActiveChild() != this)95 if(client->getActiveChild() != getWindowHandle() ) 96 96 client->childActivate(this); 97 97 break; … … 108 108 { 109 109 case SC_MOVE: 110 if( client->getMaximizedChild() == this)110 if( client->getMaximizedChild() == getWindowHandle()) 111 111 { 112 112 return 0; … … 119 119 120 120 case SC_MAXIMIZE: 121 if( client->getMaximizedChild() == this)121 if( client->getMaximizedChild() == getWindowHandle()) 122 122 { 123 123 return client->SendMessageA(Msg, wParam, lParam); … … 145 145 case WM_SIZE: 146 146 /* do not change */ 147 if( client->getActiveChild() == this&& wParam != SIZE_MAXIMIZED )147 if( client->getActiveChild() == getWindowHandle() && wParam != SIZE_MAXIMIZED ) 148 148 { 149 149 client->setMaximizedChild(NULL); 150 client->restoreFrameMenu( this);150 client->restoreFrameMenu(getWindowHandle()); 151 151 client->updateFrameText(MDI_REPAINTFRAME, NULL ); 152 152 } … … 154 154 if( wParam == SIZE_MAXIMIZED ) 155 155 { 156 Win32MDIChildWindow *maxChild = client->getMaximizedChild();157 158 if( maxChild == this) break;156 HWND maxChild = client->getMaximizedChild(); 157 158 if( maxChild == getWindowHandle() ) break; 159 159 160 160 if( maxChild) 161 161 { 162 maxChild->SendMessageA(WM_SETREDRAW, FALSE, 0L );162 ::SendMessageA(maxChild, WM_SETREDRAW, FALSE, 0L ); 163 163 client->restoreFrameMenu(maxChild); 164 maxChild->ShowWindow(SW_SHOWNOACTIVATE);165 166 maxChild->SendMessageA(WM_SETREDRAW, TRUE, 0L );164 ::ShowWindow(maxChild, SW_SHOWNOACTIVATE); 165 166 ::SendMessageA(maxChild, WM_SETREDRAW, TRUE, 0L ); 167 167 } 168 168 169 client->setMaximizedChild( this);170 client->setActiveChild( this);171 172 client->augmentFrameMenu( this);169 client->setMaximizedChild(getWindowHandle()); 170 client->setActiveChild(getWindowHandle()); 171 172 client->augmentFrameMenu(getWindowHandle()); 173 173 174 174 client->updateFrameText(MDI_REPAINTFRAME, NULL ); … … 221 221 DefWindowProcW(Msg, wParam, lParam); 222 222 menuModifyItem(); 223 if( client->getMaximizedChild() == this)223 if( client->getMaximizedChild() == getWindowHandle() ) 224 224 client->updateFrameText(MDI_REPAINTFRAME, NULL ); 225 225 … … 257 257 WORD wIDmenu = client->getFirstChildId() + client->getNrOfChildren(); 258 258 char lpstrDef[]="junk!"; 259 Win32MDIChildWindow *maximizedChild, *newchild; 259 Win32MDIChildWindow *newchild; 260 HWND maximizedChild; 260 261 CREATESTRUCTA createstruct; 261 262 ATOM classAtom; … … 287 288 maximizedChild = client->getMaximizedChild(); 288 289 289 maximizedChild->ShowWindow(SW_SHOWNOACTIVATE );290 ::ShowWindow(maximizedChild, SW_SHOWNOACTIVATE ); 290 291 291 292 if( style & WS_MAXIMIZE ) … … 379 380 if((newchild->getStyle() & WS_MAXIMIZE) && !client->getMaximizedChild() ) 380 381 { 381 client->setMaximizedChild(newchild );382 383 client->augmentFrameMenu(newchild );382 client->setMaximizedChild(newchild->getWindowHandle()); 383 384 client->augmentFrameMenu(newchild->getWindowHandle()); 384 385 385 386 client->updateFrameText(MDI_REPAINTFRAME, NULL ); … … 400 401 401 402 maximizedChild = client->getMaximizedChild(); 402 if( maximizedChild && maximizedChild->IsWindow() )403 maximizedChild->ShowWindow(SW_SHOWMAXIMIZED);403 if( ::IsWindow(maximizedChild) ) 404 ::ShowWindow(maximizedChild, SW_SHOWMAXIMIZED); 404 405 405 406 dprintf(("MDI child creation failed!!")); … … 456 457 * sequence and in the menu child list */ 457 458 459 lock(); 458 460 for( index = id+1; index <= client->getNrOfChildren() + 459 461 client->getFirstChildId(); index++ ) 460 462 { 461 Win32MDIChildWindow *tmpWnd = client->getChildByID(index);463 Win32MDIChildWindow *tmpWnd = (Win32MDIChildWindow *)GetWindowFromHandle(client->getChildByID(index)); 462 464 if( !tmpWnd ) 463 465 { 464 dprintf(("no window for id=%i\n",index));465 continue;466 dprintf(("no window for id=%i\n",index)); 467 continue; 466 468 } 467 469 … … 473 475 lstrcpynA(buffer + n, tmpWnd->getWindowNameA(), sizeof(buffer) - n ); 474 476 477 RELEASE_WNDOBJ(tmpWnd); 478 479 unlock(); 475 480 /* change menu */ 476 481 ModifyMenuA(client->getMDIMenu(), index ,MF_BYCOMMAND | MF_STRING, 477 482 index - 1 , buffer ); 478 } 483 lock(); 484 } 485 unlock(); 479 486 return TRUE; 480 487 } -
trunk/src/user32/win32wmdiclient.cpp
r5258 r5935 1 /* $Id: win32wmdiclient.cpp,v 1.3 4 2001-02-23 14:52:42sandervl Exp $ */1 /* $Id: win32wmdiclient.cpp,v 1.35 2001-06-09 14:50:23 sandervl Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 46 46 frameTitle(NULL), mdiFlags(0), idFirstChild(0), hWindowMenu(0), 47 47 sbRecalc(0), 48 Win32BaseWindow( OBJTYPE_WINDOW)48 Win32BaseWindow() 49 49 { 50 50 Init(); … … 125 125 126 126 case WM_MDIACTIVATE: 127 if( activeChild && activeChild->getWindowHandle()!= (HWND)wParam )127 if(activeChild != (HWND)wParam ) 128 128 { 129 129 mdichild = (Win32MDIChildWindow *)GetWindowFromHandle((HWND)wParam); 130 130 if(mdichild) { 131 131 mdichild->SetWindowPos(0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE); 132 RELEASE_WNDOBJ(mdichild); 132 133 } 133 134 } … … 150 151 if(mdichild) { 151 152 retvalue = destroyChild(mdichild, TRUE ); 153 RELEASE_WNDOBJ(mdichild); 152 154 } 153 155 goto END; 154 156 155 157 case WM_MDIGETACTIVE: 156 dprintf(("WM_MDIGETACTIVE: %x %x", this, (activeChild) ? activeChild->getWindowHandle() : 0));158 dprintf(("WM_MDIGETACTIVE: %x %x", this, activeChild)); 157 159 if (lParam) 158 160 *(BOOL *)lParam = (maximizedChild != 0); 159 161 160 retvalue = (activeChild) ? activeChild->getWindowHandle() : 0;162 retvalue = activeChild; 161 163 goto END; 162 164 … … 178 180 if(mdichild) { 179 181 switchActiveChild(mdichild, (lParam)? FALSE : TRUE ); 182 RELEASE_WNDOBJ(mdichild); 180 183 } 181 184 break; … … 212 215 if( activeChild ) 213 216 { 214 if( !( activeChild->getStyle() & WS_MINIMIZE) )215 ::SetFocus(activeChild ->getWindowHandle());217 if( !(GetWindowLongA(activeChild, GWL_STYLE) & WS_MINIMIZE) ) 218 ::SetFocus(activeChild); 216 219 } 217 220 retvalue = 0; … … 220 223 case WM_NCACTIVATE: 221 224 if( activeChild ) 222 activeChild->SendInternalMessageA(message, wParam, lParam);225 ::SendMessageA(activeChild, message, wParam, lParam); 223 226 break; 224 227 … … 234 237 HWND child = ChildWindowFromPoint(getWindowHandle(), point); 235 238 236 if( child && child != getWindowHandle() && ( !activeChild || activeChild->getWindowHandle()!= child) )239 if( child && child != getWindowHandle() && (activeChild != child) ) 237 240 ::SetWindowPos(child, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE ); 238 241 } … … 241 244 242 245 case WM_SIZE: 243 if( maximizedChild && maximizedChild->IsWindow() )246 if( ::IsWindow(maximizedChild) ) 244 247 { 245 248 RECT rect; … … 250 253 rect.bottom = HIWORD(lParam); 251 254 252 AdjustWindowRectEx(&rect, maximizedChild->getStyle(), 0, maximizedChild->getExStyle());253 ::MoveWindow(maximizedChild ->getWindowHandle(), rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 1);255 AdjustWindowRectEx(&rect, GetWindowLongA(maximizedChild, GWL_STYLE), 0, GetWindowLongA(maximizedChild, GWL_EXSTYLE)); 256 ::MoveWindow(maximizedChild, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 1); 254 257 } 255 258 else postUpdate(SB_BOTH+1); … … 285 288 return 0; 286 289 } 287 return window->MDIClientWndProc(message, wParam, lParam); 290 LRESULT ret = window->MDIClientWndProc(message, wParam, lParam); 291 RELEASE_WNDOBJ(window); 292 return ret; 288 293 } 289 294 /********************************************************************** … … 299 304 dwStyleMask |= WS_DISABLED | WS_VISIBLE; 300 305 301 if( !actchild ) actchild = getActiveChild(); 306 if( !actchild ) { 307 actchild = (Win32MDIChildWindow *)GetWindowFromHandle(getActiveChild()); 308 } 309 else actchild->addRef(); 310 302 311 if( !actchild) return 0; 303 312 313 lock(); 304 314 for ( curchild = (Win32MDIChildWindow *)actchild->getNextChild(); ; curchild = (Win32MDIChildWindow *)curchild->getNextChild()) 305 315 { … … 314 324 } 315 325 } 326 unlock(); 327 RELEASE_WNDOBJ(actchild); 316 328 return lastchild; 317 329 } … … 325 337 BOOL isActiveFrameWnd = 0; 326 338 LONG retvalue; 327 Win32MDIChildWindow *prevActive = activeChild;339 Win32MDIChildWindow *prevActive = (Win32MDIChildWindow *)GetWindowFromHandle(activeChild); 328 340 329 341 if( child && child->getStyle() & WS_DISABLED ) 330 342 { 343 if(prevActive) RELEASE_WNDOBJ(prevActive); 331 344 return 0; 332 345 } … … 334 347 /* Don't activate if it is already active. Might happen 335 348 since ShowWindow DOES activate MDI children */ 336 if(activeChild == child) 337 { 349 if(activeChild == child->getWindowHandle()) 350 { 351 if(prevActive) RELEASE_WNDOBJ(prevActive); 338 352 return 0; 339 353 } … … 358 372 if( maximizedChild) 359 373 { 360 if( maximizedChild != child ) {374 if( maximizedChild != child->getWindowHandle()) { 361 375 if( child ) { 362 activeChild = child ;376 activeChild = child->getWindowHandle(); 363 377 child->ShowWindow(SW_SHOWMAXIMIZED); 364 378 } 365 379 else 366 if(activeChild) activeChild->ShowWindow(SW_SHOWNORMAL );380 if(activeChild) ::ShowWindow(activeChild, SW_SHOWNORMAL ); 367 381 } 368 382 } 369 383 370 384 dprintf(("childActivate: %x %x", this, (child) ? child->getWindowHandle() : 0)); 371 activeChild = child ;385 activeChild = child->getWindowHandle(); 372 386 373 387 /* check if we have any children left */ … … 377 391 SetFocus(getWindowHandle()); 378 392 393 if(prevActive) RELEASE_WNDOBJ(prevActive); 379 394 return 0; 380 395 } … … 400 415 prevActive ? (WPARAM)prevActive->getWindowHandle() : 0, 401 416 child->getWindowHandle()); 417 418 if(prevActive) RELEASE_WNDOBJ(prevActive); 402 419 return TRUE; 403 420 } … … 410 427 void Win32MDIClientWindow::switchActiveChild(Win32MDIChildWindow *nextActiveChild, BOOL bNextWindow ) 411 428 { 412 Win32MDIChildWindow *prevActiveChild = 0;429 HWND prevActiveChild = 0; 413 430 414 431 if ( !nextActiveChild) return; /* no window to switch to */ … … 416 433 prevActiveChild = getActiveChild(); 417 434 418 if ( prevActiveChild != nextActiveChild )435 if ( prevActiveChild != nextActiveChild->getWindowHandle()) 419 436 { 420 437 BOOL bOptimize = 0; … … 429 446 430 447 if( bNextWindow && prevActiveChild ) 431 prevActiveChild->SetWindowPos(HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );448 ::SetWindowPos(prevActiveChild, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); 432 449 433 450 if( bOptimize ) … … 442 459 LRESULT Win32MDIClientWindow::destroyChild(Win32MDIChildWindow *child, BOOL flagDestroy ) 443 460 { 444 if( child == getActiveChild())461 if( child->getWindowHandle() == getActiveChild()) 445 462 { 446 463 switchActiveChild(child, TRUE); 447 464 448 if( child == getActiveChild() )465 if( child->getWindowHandle() == getActiveChild() ) 449 466 { 450 467 ::ShowWindow(child->getWindowHandle(),SW_HIDE); 451 if( child == getMaximizedChild() )468 if( child->getWindowHandle() == getMaximizedChild() ) 452 469 { 453 470 restoreFrameMenu(child); … … 492 509 if (frameTitle) 493 510 { 494 Win32MDIChildWindow *childWnd = getMaximizedChild();511 Win32MDIChildWindow *childWnd = (Win32MDIChildWindow *)GetWindowFromHandle(getMaximizedChild()); 495 512 496 513 if( childWnd && childWnd->getWindowNameA() ) … … 526 543 lpBuffer[MDI_MAXTITLELENGTH]='\0'; 527 544 } 545 if(childWnd) RELEASE_WNDOBJ(childWnd); 528 546 } 529 547 else … … 800 818 801 819 if (getMaximizedChild()) 802 SendInternalMessageA(WM_MDIRESTORE, (WPARAM)getMaximizedChild() ->getWindowHandle(), 0);820 SendInternalMessageA(WM_MDIRESTORE, (WPARAM)getMaximizedChild(), 0); 803 821 804 822 if (nActiveChildren == 0) return 0; … … 845 863 846 864 if (getMaximizedChild()) 847 SendInternalMessageA(WM_MDIRESTORE, (WPARAM)getMaximizedChild() ->getWindowHandle(), 0);865 SendInternalMessageA(WM_MDIRESTORE, (WPARAM)getMaximizedChild(), 0); 848 866 849 867 if (nActiveChildren == 0) return TRUE; … … 914 932 * MDI_AugmentFrameMenu 915 933 */ 916 BOOL Win32MDIClientWindow::augmentFrameMenu(Win32MDIChildWindow *child) 917 { 934 BOOL Win32MDIClientWindow::augmentFrameMenu(HWND hwndChild) 935 { 936 Win32MDIChildWindow *child = (Win32MDIChildWindow *)GetWindowFromHandle(hwndChild); 918 937 HMENU hSysPopup = 0,hFrameMenu = ::GetMenu(getParent()->getWindowHandle()),hSysMenu = ::GetSystemMenu(child->getWindowHandle(),FALSE); 919 938 HBITMAP hSysMenuBitmap = 0; 920 939 921 if (!hFrameMenu || !hSysMenu) 940 if (!hFrameMenu || !hSysMenu) { 941 RELEASE_WNDOBJ(child); 922 942 return 0; 923 943 } 924 944 // create a copy of sysmenu popup and insert it into frame menu bar 925 945 926 if (!(hSysPopup = LoadMenuA(GetModuleHandleA("USER32"), "SYSMENU"))) 946 if (!(hSysPopup = LoadMenuA(GetModuleHandleA("USER32"), "SYSMENU"))) { 947 RELEASE_WNDOBJ(child); 927 948 return 0; 949 } 928 950 929 951 //TRACE("\tgot popup %04x in sysmenu %04x\n", … … 936 958 937 959 // In Win 95 look, the system menu is replaced by the child icon 938 960 939 961 /* Find icon */ 940 962 HICON hIcon = child->IconForWindow(ICON_SMALL); … … 966 988 } 967 989 } 990 RELEASE_WNDOBJ(child); 968 991 969 992 if( !InsertMenuA(hFrameMenu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, … … 994 1017 * MDI_RestoreFrameMenu 995 1018 */ 996 BOOL Win32MDIClientWindow::restoreFrameMenu( Win32MDIChildWindow *child)1019 BOOL Win32MDIClientWindow::restoreFrameMenu(HWND hwndChild) 997 1020 { 998 1021 MENUITEMINFOA menuInfo; … … 1004 1027 1005 1028 if(!(iId == SC_RESTORE || iId == SC_CLOSE) ) 1006 return 0;1029 return 0; 1007 1030 1008 1031 /* … … 1049 1072 { 1050 1073 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 1074 Win32BaseWindow *child; 1051 1075 SCROLLINFO info; 1052 1076 RECT childRect, clientRect; … … 1059 1083 1060 1084 //TODO: Check if this goes correctly 1061 for (win32wnd = (Win32BaseWindow*)win32wnd->getFirstChild();win32wnd;win32wnd = (Win32BaseWindow*)win32wnd->getNextChild()) 1062 { 1063 if( win32wnd->getStyle() & WS_MAXIMIZE ) 1085 win32wnd->lock(); 1086 for (child = (Win32BaseWindow*)win32wnd->getFirstChild();child;child = (Win32BaseWindow*)child->getNextChild()) 1087 { 1088 if( child->getStyle() & WS_MAXIMIZE ) 1064 1089 { 1090 win32wnd->unlock(); 1091 RELEASE_WNDOBJ(win32wnd); 1065 1092 ShowScrollBar(hwnd, SB_BOTH, FALSE); 1066 1093 return; 1067 1094 } 1068 UnionRect(&childRect,win32wnd->getWindowRect(),&childRect); 1069 } 1095 UnionRect(&childRect,child->getWindowRect(),&childRect); 1096 } 1097 win32wnd->unlock(); 1098 RELEASE_WNDOBJ(win32wnd); 1099 1070 1100 UnionRect( &childRect, &clientRect, &childRect ); 1071 1101 … … 1121 1151 length = win32wnd->getClientWidth()/2; 1122 1152 shift = GetSystemMetrics(SM_CYHSCROLL); 1123 } else if (uMsg == WM_VSCROLL) 1153 } 1154 else if (uMsg == WM_VSCROLL) 1124 1155 { 1125 1156 GetScrollRange(hWnd,SB_VERT,&minPos,&maxPos); … … 1127 1158 length = win32wnd->getClientHeight()/2; 1128 1159 shift = GetSystemMetrics(SM_CXVSCROLL); 1129 } else return; 1160 } 1161 else 1162 { 1163 RELEASE_WNDOBJ(win32wnd); 1164 return; 1165 } 1166 RELEASE_WNDOBJ(win32wnd); 1130 1167 1131 1168 switch( wParam ) … … 1292 1329 } 1293 1330 1294 /* -------- Miscellaneous service functions ---------- 1295 * 1296 * MDI_GetChildByID 1297 */ 1298 Win32MDIChildWindow *Win32MDIClientWindow::getChildByID(INT id) 1299 { 1300 Win32MDIChildWindow *child; 1301 1302 for (child = (Win32MDIChildWindow *)getFirstChild() ; child; child = (Win32MDIChildWindow *)child->getNextChild()) 1303 if (child->getWindowId() == id) return child; 1304 1305 return 0; 1306 } 1331 /* -------- Miscellaneous service functions ---------- */ 1307 1332 1308 1333 void Win32MDIClientWindow::postUpdate(WORD recalc) -
trunk/src/user32/win32wmdiclient.h
r2469 r5935 1 /* $Id: win32wmdiclient.h,v 1. 8 2000-01-18 20:08:17sandervl Exp $ */1 /* $Id: win32wmdiclient.h,v 1.9 2001-06-09 14:50:23 sandervl Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 35 35 HWND getMDIMenu() { return hWindowMenu; }; 36 36 37 Win32MDIChildWindow *getMaximizedChild(){ return maximizedChild; };38 void setMaximizedChild(Win32MDIChildWindow *newchild) { maximizedChild = newchild; };37 HWND getMaximizedChild() { return maximizedChild; }; 38 void setMaximizedChild(HWND newchild) { maximizedChild = newchild; }; 39 39 40 Win32MDIChildWindow *getActiveChild(){ return activeChild; };41 void setActiveChild(Win32MDIChildWindow *newchild){ activeChild = newchild; };40 HWND getActiveChild() { return activeChild; }; 41 void setActiveChild(HWND newchild) { activeChild = newchild; }; 42 42 43 43 Win32MDIChildWindow *getWindow(Win32MDIChildWindow *actchild, BOOL bNext, DWORD dwStyleMask); 44 44 45 Win32MDIChildWindow *getChildByID(INT id);46 45 HWND getChildByID(INT id) { return FindWindowById(id); }; 46 void postUpdate(WORD recalc); 47 47 48 48 int getNrOfChildren() { return nActiveChildren; }; … … 70 70 BOOL cascade(UINT fuCascade); 71 71 BOOL tile(UINT fuTile); 72 BOOL augmentFrameMenu( Win32MDIChildWindow *child);73 BOOL restoreFrameMenu( Win32MDIChildWindow *child);72 BOOL augmentFrameMenu(HWND hwndChild); 73 BOOL restoreFrameMenu(HWND hwndChild); 74 74 75 75 private: 76 Win32MDIChildWindow *maximizedChild;77 Win32MDIChildWindow *activeChild;76 HWND maximizedChild; 77 HWND activeChild; 78 78 79 79 HWND hWindowMenu; -
trunk/src/user32/win32wnd.cpp
r3625 r5935 1 /* $Id: win32wnd.cpp,v 1. 9 2000-05-28 16:43:48sandervl Exp $ */1 /* $Id: win32wnd.cpp,v 1.10 2001-06-09 14:50:23 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class for OS/2 … … 54 54 { 55 55 Win32MDIClientWindow *window = NULL; 56 Win32MDIChildWindow *child;56 HWND hwndChild; 57 57 58 58 if(hwndMDIClient) … … 89 89 case SC_CLOSE: 90 90 case SC_RESTORE: 91 child = window->getMaximizedChild(); 92 if (child) 93 return ::SendMessageA(child->getWindowHandle(),WM_SYSCOMMAND,wParam,lParam); 91 hwndChild = window->getMaximizedChild(); 92 RELEASE_WNDOBJ(window); 93 if (hwndChild) 94 return ::SendMessageA(hwndChild, WM_SYSCOMMAND, wParam, lParam); 94 95 } 95 96 } 96 97 else 97 98 { 98 child = window->getChildByID(wParam);99 if ( child)100 ::SendMessageA(window->getWindowHandle(),WM_MDIACTIVATE,(WPARAM) child->getWindowHandle(),0L);99 hwndChild = window->getChildByID(wParam); 100 if (hwndChild) 101 ::SendMessageA(window->getWindowHandle(),WM_MDIACTIVATE,(WPARAM)hwndChild,0L); 101 102 } 102 103 break; … … 136 137 } 137 138 } 139 if(window) RELEASE_WNDOBJ(window); 138 140 return DefWindowProcA(Msg, wParam, lParam); 139 141 } … … 142 144 LRESULT Win32Window::DefFrameProcW(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam) 143 145 { 144 Win32Window *window = NULL; 145 146 if(hwndMDIClient) 147 window = (Win32Window *)GetWindowFromHandle(hwndMDIClient); 148 149 if(window) 146 switch(Msg) 150 147 { 151 switch(Msg)152 {153 148 case WM_NCACTIVATE: 154 window->SendMessageW(Msg, wParam, lParam);149 ::SendMessageW(hwndMDIClient, Msg, wParam, lParam); 155 150 break; 156 151 … … 166 161 case WM_SIZE: 167 162 return DefFrameProcA(hwndMDIClient, Msg, wParam, lParam ); 168 }169 163 } 170 164 return DefWindowProcW(Msg, wParam, lParam); -
trunk/src/user32/win32wndchild.cpp
r3663 r5935 1 /* $Id: win32wndchild.cpp,v 1. 6 2000-06-07 21:45:52sandervl Exp $ */1 /* $Id: win32wndchild.cpp,v 1.7 2001-06-09 14:50:24 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Child/Parent window class for OS/2 … … 19 19 //****************************************************************************** 20 20 //****************************************************************************** 21 ChildWindow::ChildWindow( )21 ChildWindow::ChildWindow(CRITICAL_SECTION *pLock) 22 22 { 23 parent = 0; 24 nextchild = 0; 25 children = 0; 23 parent = 0; 24 nextchild = 0; 25 children = 0; 26 pLockChild = pLock; 26 27 } 27 28 //****************************************************************************** … … 47 48 ChildWindow *curchild; 48 49 49 mutex.enter();50 Lock(); 50 51 51 52 curchild = children; … … 61 62 child->setNextChild(NULL); 62 63 63 mutex.leave();64 Unlock(); 64 65 return TRUE; 65 66 } … … 71 72 ChildWindow *curchild = children; 72 73 73 mutex.enter();74 Lock(); 74 75 75 76 if(curchild == child) { … … 80 81 dprintf(("ChildWindow::RemoveChild, children == NULL")); 81 82 DebugInt3(); 82 mutex.leave();83 Unlock(); 83 84 return FALSE; 84 85 } … … 88 89 dprintf(("ChildWindow::RemoveChild, curchild == NULL")); 89 90 DebugInt3(); 90 mutex.leave();91 Unlock(); 91 92 return FALSE; 92 93 } … … 94 95 curchild->setNextChild(child->getNextChild()); 95 96 } 96 mutex.leave();97 Unlock(); 97 98 return TRUE; 98 99 } -
trunk/src/user32/win32wndchild.h
r3663 r5935 1 /* $Id: win32wndchild.h,v 1. 5 2000-06-07 21:45:52sandervl Exp $ */1 /* $Id: win32wndchild.h,v 1.6 2001-06-09 14:50:24 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Child/Parent window class for OS/2 … … 13 13 #define __WIN32WNDCHILD_H__ 14 14 15 #include <vmutex.h> 15 #ifdef OS2_INCLUDED 16 #include <win32api.h> 17 #endif 16 18 17 19 #ifdef __cplusplus … … 20 22 { 21 23 public: 22 ChildWindow( );24 ChildWindow(CRITICAL_SECTION *pLock); 23 25 virtual ~ChildWindow(); 24 26 … … 45 47 46 48 private: 47 VMutex mutex; 49 void Lock() { EnterCriticalSection(pLockChild); }; 50 void Unlock() { LeaveCriticalSection(pLockChild); }; 51 52 CRITICAL_SECTION *pLockChild; 48 53 49 54 ChildWindow *parent; //GWL_HWNDPARENT -
trunk/src/user32/winaccel.cpp
r2846 r5935 1 /* $Id: winaccel.cpp,v 1. 7 2000-02-21 14:25:23sandervl Exp $ */1 /* $Id: winaccel.cpp,v 1.8 2001-06-09 14:50:24 sandervl Exp $ */ 2 2 /* 3 3 * Win32 accelerator key functions for OS/2 … … 85 85 else 86 86 { 87 Win32BaseWindow *window;87 Win32BaseWindow *window; 88 88 89 89 window = Win32BaseWindow::GetWindowFromHandle(hWnd); … … 123 123 mesg=WM_COMMAND; 124 124 } 125 RELEASE_WNDOBJ(window); 125 126 } 126 127 if ( mesg==WM_COMMAND || mesg==WM_SYSCOMMAND ) … … 165 166 /* YES, Accel16! */ 166 167 LPACCEL lpAccelTbl; 167 Win32BaseWindow *window;168 168 int i; 169 169 … … 181 181 return 0; 182 182 } 183 window = Win32BaseWindow::GetWindowFromHandle(hWnd); 184 if(!window) { 183 if(!IsWindow(hWnd)) { 185 184 dprintf(("TranslateAccelerator, window %x not found", hWnd)); 186 185 SetLastError(ERROR_INVALID_WINDOW_HANDLE); … … 233 232 } 234 233 235 mdichild = clientWnd->getActiveChild(); 236 if(!mdichild) { 234 hwndChild = clientWnd->getActiveChild(); 235 RELEASE_WNDOBJ(clientWnd); 236 if(!hwndChild) { 237 237 dprintf(("TranslateMDISysAccel NO active MDI child!!")); 238 238 return FALSE; 239 239 } 240 hwndChild = mdichild->getWindowHandle();241 240 242 241 if(IsWindow(hwndChild) && !(GetWindowLongA(hwndChild,GWL_STYLE) & WS_DISABLED) ) -
trunk/src/user32/windlg.cpp
r5258 r5935 1 /* $Id: windlg.cpp,v 1.2 2 2001-02-23 14:52:42sandervl Exp $ */1 /* $Id: windlg.cpp,v 1.23 2001-06-09 14:50:25 sandervl Exp $ */ 2 2 /* 3 3 * Win32 dialog apis for OS/2 … … 87 87 { 88 88 dprintf(("Win32Dialog error found (%0x)!!", GetLastError())); 89 RELEASE_WNDOBJ(dialog); 89 90 delete dialog; 90 91 return 0; 91 92 } 92 return dialog->getWindowHandle(); 93 HWND hwnd = dialog->getWindowHandle(); 94 RELEASE_WNDOBJ(dialog); 95 return hwnd; 93 96 } 94 97 //****************************************************************************** … … 115 118 { 116 119 dprintf(("Win32Dialog error found!!")); 120 RELEASE_WNDOBJ(dialog); 117 121 delete dialog; 118 122 return 0; 119 123 } 120 return dialog->getWindowHandle(); 124 HWND hwnd = dialog->getWindowHandle(); 125 RELEASE_WNDOBJ(dialog); 126 return hwnd; 121 127 } 122 128 //****************************************************************************** … … 127 133 LPARAM lParamInit) 128 134 { 135 INT result; 129 136 HWND hwnd = CreateDialogIndirectParamA(hInst, dlgtemplate, hwndParent, dlgproc, 130 137 lParamInit); … … 136 143 if(!dialog || !dialog->IsDialog()) { 137 144 dprintf(("DialogBoxIndirectParamA, dialog %x not found", hwnd)); 145 if(dialog) RELEASE_WNDOBJ(dialog); 138 146 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 139 147 return 0; 140 148 } 141 return dialog->doDialogBox(); 149 result = dialog->doDialogBox(); 150 RELEASE_WNDOBJ(dialog); 151 return result; 142 152 } 143 153 return -1; … … 149 159 LPARAM lParamInit) 150 160 { 161 INT result; 151 162 HWND hwnd = CreateDialogIndirectParamW(hInst, dlgtemplate, hwndParent, dlgproc, 152 163 lParamInit); … … 158 169 if(!dialog || !dialog->IsDialog()) { 159 170 dprintf(("DialogBoxIndirectParamW, dialog %x not found", hwnd)); 171 if(dialog) RELEASE_WNDOBJ(dialog); 160 172 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 161 173 return 0; 162 174 } 163 return dialog->doDialogBox(); 175 result = dialog->doDialogBox(); 176 RELEASE_WNDOBJ(dialog); 177 return result; 164 178 } 165 179 return -1; … … 170 184 DLGPROC dlgproc, LPARAM lParamInit) 171 185 { 186 INT result; 172 187 HWND hwnd = CreateDialogParamA( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit); 173 188 … … 179 194 if(!dialog || !dialog->IsDialog()) { 180 195 dprintf(("DialogBoxParamA, dialog %x not found", hwnd)); 196 if(dialog) RELEASE_WNDOBJ(dialog); 181 197 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 182 198 return 0; 183 199 } 184 return dialog->doDialogBox(); 200 result = dialog->doDialogBox(); 201 RELEASE_WNDOBJ(dialog); 202 return result; 185 203 } 186 204 return -1; … … 191 209 DLGPROC dlgproc, LPARAM lParamInit) 192 210 { 211 INT result; 193 212 HWND hwnd = CreateDialogParamW( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit); 194 213 … … 200 219 if(!dialog || !dialog->IsDialog()) { 201 220 dprintf(("DialogBoxParamW, dialog %x not found", hwnd)); 221 if(dialog) RELEASE_WNDOBJ(dialog); 202 222 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 203 223 return 0; 204 224 } 205 return dialog->doDialogBox(); 225 result = dialog->doDialogBox(); 226 RELEASE_WNDOBJ(dialog); 227 return result; 206 228 } 207 229 return -1; … … 213 235 { 214 236 Win32Dialog *dialog; 237 BOOL rc; 215 238 #ifdef DEBUG 216 BOOL rc;217 239 RECT dlgRect = *rect; 218 240 #endif … … 222 244 dprintf(("MapDialogRect, window %x not found", hwndDlg)); 223 245 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 224 return 0;225 }226 #ifdef DEBUG 246 if(dialog) RELEASE_WNDOBJ(dialog); 247 return 0; 248 } 227 249 rc = dialog->MapDialogRect(rect); 228 250 dprintf(("USER32: MapDialogRect %x (%d,%d)(%d,%d) -> (%d,%d)(%d,%d)", hwndDlg, dlgRect.left, dlgRect.top, dlgRect.right, dlgRect.bottom, rect->left, rect->top, rect->right, rect->bottom)); 251 RELEASE_WNDOBJ(dialog); 229 252 return rc; 230 #else231 dprintf(("USER32: MapDialogRect %x (%d,%d)(%d,%d)", hwndDlg, rect->left, rect->top, rect->right, rect->bottom));232 return dialog->MapDialogRect(rect);233 #endif234 253 } 235 254 //****************************************************************************** … … 334 353 HWND WIN32API GetNextDlgTabItem(HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious) 335 354 { 336 Win32BaseWindow *window; 337 338 window = (Win32BaseWindow*)Win32BaseWindow::GetWindowFromHandle(hwndDlg); 339 if(!window) { 355 if(!IsWindow(hwndDlg)) { 340 356 dprintf(("GetNextDlgTabItem, window %x not found", hwndDlg)); 341 357 SetLastError(ERROR_INVALID_WINDOW_HANDLE); … … 352 368 HWND WIN32API GetDlgItem(HWND hwnd, int id) 353 369 { 354 Win32BaseWindow *dlgcontrol, *window; 370 Win32BaseWindow *window; 371 HWND hwndDlgItem; 355 372 356 373 window = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 360 377 return 0; 361 378 } 362 dlgcontrol = window->FindWindowById(id); 363 if(dlgcontrol) { 364 dprintf(("USER32: GetDlgItem %x %d returned %x\n", hwnd, id, dlgcontrol->getWindowHandle())); 365 return dlgcontrol->getWindowHandle(); 379 hwndDlgItem = window->FindWindowById(id); 380 RELEASE_WNDOBJ(window); 381 if(hwndDlgItem) { 382 dprintf(("USER32: GetDlgItem %x %d returned %x\n", hwnd, id, hwndDlgItem)); 383 return hwndDlgItem; 366 384 } 367 385 dprintf(("USER32: GetDlgItem %x %d NOT FOUND!\n", hwnd, id)); -
trunk/src/user32/windlgmsg.cpp
r5496 r5935 1 /* $Id: windlgmsg.cpp,v 1. 8 2001-04-12 14:04:33sandervl Exp $ */1 /* $Id: windlgmsg.cpp,v 1.9 2001-06-09 14:50:25 sandervl Exp $ */ 2 2 /* 3 3 * Win32 dialog message APIs for OS/2 … … 30 30 { 31 31 Win32Dialog *dialog; 32 Win32BaseWindow *dlgcontrol;32 HWND hwndDlgItem; 33 33 34 34 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 37 37 return 0; 38 38 } 39 dlgcontrol = dialog->getDlgItem(id); 40 if(dlgcontrol) { 41 return dlgcontrol->SendMessageA(Msg, wParam, lParam); 39 hwndDlgItem = dialog->getDlgItem(id); 40 RELEASE_WNDOBJ(dialog); 41 if(hwndDlgItem) { 42 return SendMessageA(hwndDlgItem, Msg, wParam, lParam); 42 43 } 43 44 return 0; … … 48 49 { 49 50 Win32Dialog *dialog; 50 Win32BaseWindow *dlgcontrol;51 HWND hwndDlgItem; 51 52 52 53 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 55 56 return 0; 56 57 } 57 dlgcontrol = dialog->getDlgItem(id); 58 if(dlgcontrol) { 59 return dlgcontrol->SendMessageW(Msg, wParam, lParam); 58 hwndDlgItem = dialog->getDlgItem(id); 59 RELEASE_WNDOBJ(dialog); 60 if(hwndDlgItem) { 61 return SendMessageW(hwndDlgItem, Msg, wParam, lParam); 60 62 } 61 63 return 0; … … 90 92 ((win32wnd->getStyle() & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE) ) 91 93 { 92 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 ); 93 if (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) 94 { 95 INT textLen = win32wnd->GetWindowTextLengthA(); 96 97 if (textLen > 0) 98 { 99 /* find the accelerator key */ 100 char* text; 101 LPSTR p; 102 103 text = (char*)malloc(textLen+1); 104 win32wnd->GetWindowTextA(text,textLen); 105 p = text - 2; 106 do 94 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 ); 95 if (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) 96 { 97 INT textLen = win32wnd->GetWindowTextLengthA(); 98 99 if (textLen > 0) 107 100 { 108 p = strchr( p + 2, '&' ); 101 /* find the accelerator key */ 102 char* text; 103 LPSTR p; 104 105 text = (char*)malloc(textLen+1); 106 win32wnd->GetWindowTextA(text,textLen); 107 p = text - 2; 108 do 109 { 110 p = strchr( p + 2, '&' ); 111 } 112 while (p != NULL && p[1] == '&'); 113 114 /* and check if it's the one we're looking for */ 115 if (p != NULL && toupper( p[1] ) == toupper( vKey ) ) 116 { 117 if ((dlgCode & DLGC_STATIC) || 118 (win32wnd->getStyle() & 0x0f) == BS_GROUPBOX ) 119 { 120 /* set focus to the control */ 121 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 122 hwndControl, 1); 123 /* and bump it on to next */ 124 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0); 125 } 126 else 127 //TODO: this else part was removed in Wine and above if rules out this possibility (if (dlgCode & (DLGC_BUTTON | DLGC_STATIC))) 128 if (dlgCode & (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON)) 129 { 130 /* send command message as from the control */ 131 SendMessageA( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(win32wnd->getWindowId()), BN_CLICKED ), 132 (LPARAM)hwndControl ); 133 } 134 else if (dlgCode & DLGC_BUTTON) 135 { 136 /* send BM_CLICK message to the control */ 137 SendMessageA( hwndControl, BM_CLICK, 0, 0 ); 138 } 139 RetVal = TRUE; 140 free(text); 141 RELEASE_WNDOBJ(win32wnd); 142 break; 143 } 144 free(text); 109 145 } 110 while (p != NULL && p[1] == '&'); 111 112 /* and check if it's the one we're looking for */ 113 if (p != NULL && toupper( p[1] ) == toupper( vKey ) ) 114 { 115 if ((dlgCode & DLGC_STATIC) || 116 (win32wnd->getStyle() & 0x0f) == BS_GROUPBOX ) 117 { 118 /* set focus to the control */ 119 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 120 hwndControl, 1); 121 /* and bump it on to next */ 122 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0); 123 } 124 else if (dlgCode & 125 (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON)) 126 { 127 /* send command message as from the control */ 128 SendMessageA( hwndDlg, WM_COMMAND, 129 MAKEWPARAM( LOWORD(win32wnd->getWindowId()), 130 BN_CLICKED ), 131 (LPARAM)hwndControl ); 132 } 133 else 134 { 135 /* click the control */ 136 SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0); 137 SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0); 138 } 139 RetVal = TRUE; 140 free(text); 146 } 147 hwndNext = GetWindow( hwndControl, GW_CHILD ); 148 } 149 else 150 { 151 hwndNext = 0; 152 } 153 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 154 155 if (!hwndNext) 156 { 157 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT ); 158 } 159 while (!hwndNext) 160 { 161 hwndControl = GetParent( hwndControl ); 162 if (hwndControl == hwndDlg) 163 { 164 if(hwnd==hwndDlg){ /* prevent endless loop */ 165 hwndNext=hwnd; 141 166 break; 142 167 } 143 free(text); 144 } 145 } 146 hwndNext = GetWindow( hwndControl, GW_CHILD ); 147 } 148 else 149 { 150 hwndNext = 0; 151 } 152 if (!hwndNext) 153 { 154 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT ); 155 } 156 while (!hwndNext) 157 { 158 hwndControl = GetParent( hwndControl ); 159 if (hwndControl == hwndDlg) 160 { 161 if(hwnd==hwndDlg){ /* prevent endless loop */ 162 hwndNext=hwnd; 163 break; 164 } 165 hwndNext = GetWindow( hwndDlg, GW_CHILD ); 166 } 167 else 168 { 169 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT ); 170 } 171 } 168 hwndNext = GetWindow( hwndDlg, GW_CHILD ); 169 } 170 else 171 { 172 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT ); 173 } 174 } 172 175 hwndControl = hwndNext; 173 176 } … … 184 187 * We propagate up until we hit a that does not have DS_CONTROL, or 185 188 * whose parent is not a dialog. 189 * 190 * This is undocumented behaviour. 186 191 */ 187 192 static HWND DIALOG_FindMsgDestination( HWND hwndDlg ) … … 196 201 if (!pParent) break; 197 202 198 if (!pParent->IsDialog()) 199 break; 200 203 if (!pParent->IsDialog()) { 204 RELEASE_WNDOBJ(pParent); 205 break; 206 } 207 RELEASE_WNDOBJ(pParent); 201 208 hwndDlg = hParent; 202 209 } -
trunk/src/user32/window.cpp
r5713 r5935 1 /* $Id: window.cpp,v 1.9 8 2001-05-15 14:31:40sandervl Exp $ */1 /* $Id: window.cpp,v 1.99 2001-06-09 14:50:25 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 129 129 { 130 130 dprintf(("Win32BaseWindow error found!!")); 131 RELEASE_WNDOBJ(window); 131 132 delete window; 132 133 return 0; 133 134 } 134 return window->getWindowHandle(); 135 HWND hwnd = window->getWindowHandle(); 136 RELEASE_WNDOBJ(window); 137 return hwnd; 135 138 } 136 139 //****************************************************************************** … … 220 223 { 221 224 dprintf(("Win32BaseWindow error found!!")); 225 RELEASE_WNDOBJ(window); 222 226 delete window; 223 227 return 0; 224 228 } 225 return window->getWindowHandle(); 229 HWND hwnd = window->getWindowHandle(); 230 RELEASE_WNDOBJ(window); 231 return hwnd; 226 232 } 227 233 //****************************************************************************** … … 237 243 return 0; 238 244 } 239 return window->getWindowHandle(); 245 HWND hwnd = window->getWindowHandle(); 246 RELEASE_WNDOBJ(window); 247 return hwnd; 240 248 } 241 249 //****************************************************************************** … … 271 279 else dprintf(("CreateMDIWindowA: class %d parent %x (%d,%d) (%d,%d), %x %x lParam=%x", lpszClassName, hwndParent, x, y, nWidth, nHeight, dwStyle, lParam)); 272 280 273 return window->SendMessageA(WM_MDICREATE, 0, (LPARAM)&cs); 281 hwnd = window->SendMessageA(WM_MDICREATE, 0, (LPARAM)&cs); 282 RELEASE_WNDOBJ(window); 283 return hwnd; 274 284 } 275 285 //****************************************************************************** … … 306 316 else dprintf(("CreateMDIWindowW: class %d parent %x (%d,%d) (%d,%d), %x %x lParam=%x", lpszClassName, hwndParent, x, y, nWidth, nHeight, dwStyle, lParam)); 307 317 308 return window->SendMessageW(WM_MDICREATE, 0, (LPARAM)&cs); 318 hwnd = window->SendMessageW(WM_MDICREATE, 0, (LPARAM)&cs); 319 RELEASE_WNDOBJ(window); 320 return hwnd; 309 321 } 310 322 //****************************************************************************** … … 313 325 { 314 326 Win32BaseWindow *window; 327 BOOL ret; 315 328 316 329 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 320 333 return 0; 321 334 } 322 if(window->isDesktopWindow()) { 323 dprintf(("WARNING: Trying to destroy desktop window!")); 324 return FALSE; 325 } 326 return window->DestroyWindow(); 335 ret = window->DestroyWindow(); 336 RELEASE_WNDOBJ(window); 337 return ret; 327 338 } 328 339 //****************************************************************************** … … 331 342 { 332 343 Win32BaseWindow *window; 344 HWND hwndActive; 333 345 334 346 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 338 350 return 0; 339 351 } 340 return window->SetActiveWindow(); 352 hwndActive = window->SetActiveWindow(); 353 RELEASE_WNDOBJ(window); 354 return hwndActive; 341 355 } 342 356 //****************************************************************************** … … 346 360 { 347 361 Win32BaseWindow *window; 362 HWND hwndParent; 348 363 349 364 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 354 369 } 355 370 dprintf2(("GetParent %x", hwnd)); 356 return window->GetParent(); 371 hwndParent = window->GetParent(); 372 RELEASE_WNDOBJ(window); 373 return hwndParent; 357 374 } 358 375 //****************************************************************************** … … 360 377 HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent) 361 378 { 362 Win32BaseWindow *window, *parent; 379 Win32BaseWindow *window; 380 HWND hwndOldParent; 363 381 364 382 window = Win32BaseWindow::GetWindowFromHandle(hwndChild); … … 372 390 } 373 391 else { 374 parent = Win32BaseWindow::GetWindowFromHandle(hwndNewParent);375 if(!window) {392 if(!IsWindow(hwndNewParent)) { 393 RELEASE_WNDOBJ(window); 376 394 dprintf(("SetParent, parent %x not found", hwndNewParent)); 377 395 SetLastError(ERROR_INVALID_WINDOW_HANDLE); … … 380 398 } 381 399 dprintf(("SetParent %x %x", hwndChild, hwndNewParent)); 382 return window->SetParent(hwndNewParent); 400 hwndOldParent = window->SetParent(hwndNewParent); 401 RELEASE_WNDOBJ(window); 402 return hwndOldParent; 383 403 } 384 404 //****************************************************************************** … … 387 407 { 388 408 Win32BaseWindow *window; 409 BOOL fIsChild; 389 410 390 411 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 395 416 } 396 417 dprintf(("IsChild %x %x", hwndParent, hwnd)); 397 return window->IsChild(hwndParent); 418 fIsChild = window->IsChild(hwndParent); 419 RELEASE_WNDOBJ(window); 420 return fIsChild; 398 421 } 399 422 //****************************************************************************** … … 405 428 406 429 if(hwnd == HWND_DESKTOP) { 430 windowDesktop->addRef(); 407 431 window = windowDesktop; 408 432 } … … 417 441 hwndTop = window->GetTopWindow(); 418 442 dprintf2(("GetTopWindow %x returned %x", hwnd, hwndTop)); 443 RELEASE_WNDOBJ(window); 419 444 return hwndTop; 420 445 } … … 424 449 { 425 450 Win32BaseWindow *window; 426 BOOL rc;451 BOOL fIsIconic; 427 452 428 453 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 432 457 return FALSE; 433 458 } 434 rc = window->IsWindowIconic(); 435 dprintf(("IsIconic %x returned %d", hwnd, rc)); 436 return rc; 459 fIsIconic = window->IsWindowIconic(); 460 dprintf(("IsIconic %x returned %d", hwnd, fIsIconic)); 461 RELEASE_WNDOBJ(window); 462 return fIsIconic; 437 463 } 438 464 //****************************************************************************** … … 441 467 { 442 468 Win32BaseWindow *window; 443 HWND rc;469 HWND hwndRelated; 444 470 445 471 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 449 475 return 0; 450 476 } 451 return window->GetWindow(uCmd); 477 hwndRelated = window->GetWindow(uCmd); 478 RELEASE_WNDOBJ(window); 479 return hwndRelated; 452 480 } 453 481 //****************************************************************************** … … 456 484 { 457 485 Win32BaseWindow *window; 486 BOOL fEnabled; 458 487 459 488 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 464 493 } 465 494 dprintf(("EnableWindow %x %d", hwnd, fEnable)); 466 return window->EnableWindow(fEnable); 495 fEnabled = window->EnableWindow(fEnable); 496 RELEASE_WNDOBJ(window); 497 return fEnabled; 467 498 } 468 499 //****************************************************************************** … … 539 570 { 540 571 Win32BaseWindow *window; 572 BOOL ret; 541 573 542 574 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 546 578 return 0; 547 579 } 548 return window->ShowWindow(nCmdShow); 580 ret = window->ShowWindow(nCmdShow); 581 RELEASE_WNDOBJ(window); 582 return ret; 549 583 } 550 584 /***************************************************************************** … … 589 623 } 590 624 dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags)); 591 return window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags); 625 BOOL ret = window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags); 626 RELEASE_WNDOBJ(window); 627 return ret; 592 628 } 593 629 //****************************************************************************** … … 598 634 Win32BaseWindow *window; 599 635 600 window = Win32BaseWindow::GetWindowFromHandle(hwnd);601 if(!window) {602 dprintf(("SetWindowPlacement, window %x not found", hwnd));603 SetLastError(ERROR_INVALID_WINDOW_HANDLE);604 return FALSE;605 }606 636 if(!winpos || winpos->length != sizeof(WINDOWPLACEMENT)) { 607 637 dprintf(("SetWindowPlacement %x invalid parameter", hwnd)); … … 609 639 return FALSE; 610 640 } 641 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 642 if(!window) { 643 dprintf(("SetWindowPlacement, window %x not found", hwnd)); 644 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 645 return FALSE; 646 } 611 647 dprintf(("USER32: SetWindowPlacement %x %x", hwnd, winpos)); 612 return window->SetWindowPlacement((WINDOWPLACEMENT *)winpos); 648 BOOL ret = window->SetWindowPlacement((WINDOWPLACEMENT *)winpos); 649 RELEASE_WNDOBJ(window); 650 return ret; 613 651 } 614 652 //****************************************************************************** … … 620 658 Win32BaseWindow *window; 621 659 622 window = Win32BaseWindow::GetWindowFromHandle(hwnd);623 if(!window) {624 dprintf(("GetWindowPlacement, window %x not found", hwnd));625 SetLastError(ERROR_INVALID_WINDOW_HANDLE);626 return FALSE;627 }628 660 if(!winpos) { 629 661 dprintf(("GetWindowPlacement %x invalid parameter", hwnd)); … … 631 663 return FALSE; 632 664 } 665 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 666 if(!window) { 667 dprintf(("GetWindowPlacement, window %x not found", hwnd)); 668 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 669 return FALSE; 670 } 633 671 dprintf(("USER32: GetWindowPlacement %x %x", hwnd, winpos)); 634 return window->GetWindowPlacement(winpos); 672 BOOL ret = window->GetWindowPlacement(winpos); 673 RELEASE_WNDOBJ(window); 674 return ret; 635 675 } 636 676 //****************************************************************************** … … 647 687 } 648 688 dprintf2(("IsWindow %x", hwnd)); 649 return window->IsWindow(); 689 BOOL fIsWindow = window->IsWindow(); 690 RELEASE_WNDOBJ(window); 691 return fIsWindow; 650 692 } 651 693 //****************************************************************************** … … 653 695 BOOL WIN32API IsWindowEnabled( HWND hwnd) 654 696 { 655 Win32BaseWindow *window;656 697 DWORD dwStyle; 657 698 658 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 659 if(!window) { 699 if(!IsWindow(hwnd)) { 660 700 dprintf(("IsWindowEnabled, window %x not found", hwnd)); 661 701 SetLastError(ERROR_INVALID_WINDOW_HANDLE); … … 673 713 BOOL WIN32API IsWindowVisible(HWND hwnd) 674 714 { 675 Win32BaseWindow *window;676 715 BOOL ret; 677 716 HWND hwndParent; 678 717 DWORD dwStyle; 679 718 680 if( !hwnd) {//TODO: verify in NT!719 if(hwnd == HWND_DESKTOP) {//TODO: verify in NT! 681 720 dprintf(("IsWindowVisible DESKTOP returned TRUE")); 682 721 return TRUE; //desktop is always visible 683 722 } 684 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 685 686 if(!window) { 723 if(!IsWindow(hwnd)) { 687 724 dprintf(("IsWindowVisible, window %x not found", hwnd)); 688 725 SetLastError(ERROR_INVALID_WINDOW_HANDLE); … … 716 753 HWND WIN32API SetFocus(HWND hwnd) 717 754 { 718 Win32BaseWindow *window , *topparent;755 Win32BaseWindow *window; 719 756 Win32BaseWindow *oldfocuswnd; 720 HWND lastFocus, lastFocus_W, hwnd_O ;757 HWND lastFocus, lastFocus_W, hwnd_O, hwndTopParent; 721 758 BOOL activate; 722 759 TEB *teb; … … 741 778 else lastFocus = OSLibWinQueryFocus (OSLIB_HWND_DESKTOP); 742 779 743 topparent = window->GetTopParent();780 hwndTopParent = window->GetTopParent(); 744 781 activate = FALSE; 745 lastFocus_W = OS2ToWin32Handle 782 lastFocus_W = OS2ToWin32Handle(lastFocus); 746 783 if(lastFocus_W) { 747 784 oldfocuswnd = Win32BaseWindow::GetWindowFromHandle(lastFocus_W); 748 if(lastFocus_W != hwnd && topparent != oldfocuswnd->GetTopParent()) {785 if(lastFocus_W != hwnd && hwndTopParent != oldfocuswnd->GetTopParent()) { 749 786 activate = TRUE; 750 787 } 788 RELEASE_WNDOBJ(oldfocuswnd); 751 789 } 752 790 else activate = TRUE; … … 766 804 //mp1 = win32 window handle 767 805 //mp2 = top parent if activation required 768 OSLibPostMessageDirect(hwnd_O, WIN32APP_SETFOCUSMSG, hwnd, (activate) ? topparent->getWindowHandle(): 0);806 OSLibPostMessageDirect(hwnd_O, WIN32APP_SETFOCUSMSG, hwnd, (activate) ? hwndTopParent : 0); 769 807 return lastFocus_W; 770 808 } 771 809 teb->o.odin.hwndFocus = 0; 772 810 if(activate) { 773 SetActiveWindow( topparent->getWindowHandle());811 SetActiveWindow(hwndTopParent); 774 812 } 775 813 if(!IsWindow(hwnd)) return FALSE; //abort if window destroyed … … 827 865 Win32BaseWindow *window; 828 866 829 if (hwnd) 830 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 831 else 832 window = windowDesktop; 833 867 if(pRect == NULL) { 868 dprintf(("GetWindowRect %x invalid parameter!", hwnd)); 869 SetLastError(ERROR_INVALID_PARAMETER); 870 return FALSE; 871 } 872 873 if(hwnd == HWND_DESKTOP) { 874 windowDesktop->addRef(); 875 window = windowDesktop; 876 } 877 else window = Win32BaseWindow::GetWindowFromHandle(hwnd); 878 834 879 if(!window) { 835 880 dprintf(("GetWindowRect, window %x not found", hwnd)); 836 881 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 837 return FALSE;838 }839 if(pRect == NULL) {840 SetLastError(ERROR_INVALID_PARAMETER);841 882 return FALSE; 842 883 } … … 847 888 MapWindowPoints(window->getParent()->getWindowHandle(), 0, (PPOINT)pRect, 2); 848 889 } 849 890 RELEASE_WNDOBJ(window); 850 891 dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom)); 851 892 return TRUE; … … 864 905 } 865 906 dprintf(("GetWindowTextLengthA %x", hwnd)); 866 return window->GetWindowTextLengthA(); 907 int ret = window->GetWindowTextLengthA(); 908 RELEASE_WNDOBJ(window); 909 return ret; 867 910 } 868 911 //****************************************************************************** … … 881 924 rc = window->GetWindowTextA(lpsz, cch); 882 925 dprintf(("GetWindowTextA %x %s", hwnd, lpsz)); 926 RELEASE_WNDOBJ(window); 883 927 return rc; 884 928 } … … 896 940 } 897 941 dprintf(("GetWindowTextLengthW %x", hwnd)); 898 return window->GetWindowTextLengthW(); 942 int ret = window->GetWindowTextLengthW(); 943 RELEASE_WNDOBJ(window); 944 return ret; 899 945 } 900 946 //****************************************************************************** … … 910 956 return 0; 911 957 } 912 #ifdef DEBUG913 958 int rc = window->GetWindowTextW(lpsz, cch); 959 RELEASE_WNDOBJ(window); 914 960 dprintf(("GetWindowTextW %x %ls", hwnd, lpsz)); 915 961 return rc; 916 #else917 return window->GetWindowTextW(lpsz, cch);918 #endif919 962 } 920 963 //****************************************************************************** … … 931 974 } 932 975 dprintf(("SetWindowTextA %x %s", hwnd, lpsz)); 933 return window->SetWindowTextA((LPSTR)lpsz); 976 BOOL ret = window->SetWindowTextA((LPSTR)lpsz); 977 RELEASE_WNDOBJ(window); 978 return ret; 934 979 } 935 980 //****************************************************************************** … … 946 991 } 947 992 dprintf(("SetWindowTextW %x %ls", hwnd, lpsz)); 948 return window->SetWindowTextW((LPWSTR)lpsz); 993 BOOL ret = window->SetWindowTextW((LPWSTR)lpsz); 994 RELEASE_WNDOBJ(window); 995 return ret; 949 996 } 950 997 /******************************************************************* … … 991 1038 window->getClientRect(pRect); 992 1039 dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom)); 1040 RELEASE_WNDOBJ(window); 993 1041 return TRUE; 994 1042 } … … 1114 1162 return 0; 1115 1163 } 1116 if(hwndFrom) 1117 { 1164 if(hwndTo == hwndFrom) 1165 return 0; //nothing to do 1166 1167 if(hwndFrom == HWND_DESKTOP) 1168 { 1169 windowDesktop->addRef(); 1170 wndfrom = windowDesktop; 1171 } 1172 else { 1118 1173 wndfrom = Win32BaseWindow::GetWindowFromHandle(hwndFrom); 1119 1174 if(!wndfrom) { … … 1123 1178 } 1124 1179 } 1125 else wndfrom = windowDesktop; 1126 1127 if(hwndTo) 1128 { 1180 1181 if(hwndTo == HWND_DESKTOP) 1182 { 1183 windowDesktop->addRef(); 1184 wndto = windowDesktop; 1185 } 1186 else { 1129 1187 wndto = Win32BaseWindow::GetWindowFromHandle(hwndTo); 1130 1188 if(!wndto) { … … 1134 1192 } 1135 1193 } 1136 else wndto = windowDesktop;1137 1138 if(wndto == wndfrom)1139 return 0; //nothing to do1140 1194 1141 1195 dprintf2(("USER32: MapWindowPoints %x to %x (%d,%d) (%d)", hwndFrom, hwndTo, lpPoints->x, lpPoints->y, cPoints)); 1142 1196 WINPOS_GetWinOffset(wndfrom, wndto, &offset); 1143 1197 1198 RELEASE_WNDOBJ(wndto); 1199 RELEASE_WNDOBJ(wndfrom); 1144 1200 for(int i=0;i<cPoints;i++) 1145 1201 { … … 1154 1210 BOOL WIN32API ScreenToClient(HWND hwnd, LPPOINT pt) 1155 1211 { 1156 Win32BaseWindow *wnd;1157 1212 PRECT rcl; 1158 1213 BOOL rc; 1159 1214 1160 if(!hwnd) { 1161 return (TRUE); 1162 } 1163 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1164 if (!wnd) { 1215 if(hwnd == HWND_DESKTOP) { 1216 return (TRUE); //nothing to do 1217 } 1218 if (!IsWindow(hwnd)) { 1165 1219 dprintf(("warning: ScreenToClient: window %x not found!", hwnd)); 1166 1220 SetLastError(ERROR_INVALID_WINDOW_HANDLE); … … 1280 1334 BOOL WIN32API ClientToScreen (HWND hwnd, PPOINT pt) 1281 1335 { 1282 Win32BaseWindow *wnd;1283 1336 PRECT rcl; 1284 1337 1285 if (!hwnd) { 1286 SetLastError(ERROR_INVALID_PARAMETER); 1287 return (FALSE); 1288 } 1289 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1290 if (!wnd) { 1338 if(hwnd == HWND_DESKTOP) { 1339 return(TRUE); //nothing to do 1340 } 1341 if(!IsWindow(hwnd)) { 1291 1342 dprintf(("warning: ClientToScreen window %x not found!", hwnd)); 1292 1343 SetLastError(ERROR_INVALID_WINDOW_HANDLE); … … 1344 1395 int i; 1345 1396 HDWP newhdwp = hdwp,retvalue; 1346 Win32BaseWindow *window;1347 1397 1348 1398 pDWP = (DWP *)hdwp; … … 1355 1405 return 0; 1356 1406 1357 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 1358 if(!window) { 1407 if(!IsWindow(hwnd)) { 1359 1408 dprintf(("DeferWindowPos, window %x not found", hwnd)); 1360 1409 SetLastError(ERROR_INVALID_WINDOW_HANDLE); … … 1550 1599 } 1551 1600 dprintf(("CloseWindow %x\n", hwnd)); 1552 return window->CloseWindow(); 1601 BOOL ret = window->CloseWindow(); 1602 RELEASE_WNDOBJ(window); 1603 return ret; 1553 1604 } 1554 1605 //****************************************************************************** … … 1642 1693 return 0; 1643 1694 } 1644 return window->IsWindowUnicode(); 1695 BOOL ret = window->IsWindowUnicode(); 1696 RELEASE_WNDOBJ(window); 1697 return ret; 1645 1698 } 1646 1699 /*********************************************************************** … … 1655 1708 BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam) 1656 1709 { 1657 return windowDesktop->EnumThreadWindows(dwThreadId, lpfn, lParam);1710 return windowDesktop->EnumThreadWindows(dwThreadId, lpfn, lParam); 1658 1711 } 1659 1712 //****************************************************************************** … … 1661 1714 BOOL WIN32API EnumChildWindows(HWND hwnd, WNDENUMPROC lpfn, LPARAM lParam) 1662 1715 { 1663 Win32BaseWindow *window;1664 BOOL rc= TRUE;1665 ULONG henum;1666 HWND hwndNext;1667 1668 if(lpfn == NULL) {1669 dprintf(("EnumChildWindows invalid parameter %x %x\n", hwnd, lParam));1716 Win32BaseWindow *window; 1717 BOOL ret = TRUE; 1718 ULONG henum; 1719 HWND hwndNext; 1720 1721 if(lpfn == NULL) { 1722 dprintf(("EnumChildWindows invalid parameter %x %x\n", hwnd, lParam)); 1670 1723 SetLastError(ERROR_INVALID_PARAMETER); 1671 1724 return FALSE; 1672 }1673 window = Win32BaseWindow::GetWindowFromHandle(hwnd);1674 if(!window) {1725 } 1726 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 1727 if(!window) { 1675 1728 dprintf(("EnumChildWindows, window %x not found", hwnd)); 1676 1729 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 1677 1730 return FALSE; 1678 } 1679 return window->EnumChildWindows(lpfn, lParam); 1731 } 1732 ret = window->EnumChildWindows(lpfn, lParam); 1733 RELEASE_WNDOBJ(window); 1734 return ret; 1680 1735 } 1681 1736 //****************************************************************************** … … 1683 1738 BOOL WIN32API EnumWindows(WNDENUMPROC lpfn, LPARAM lParam) 1684 1739 { 1685 return windowDesktop->EnumWindows(lpfn, lParam);1740 return windowDesktop->EnumWindows(lpfn, lParam); 1686 1741 } 1687 1742 //****************************************************************************** … … 1697 1752 BOOL WIN32API OpenIcon(HWND hwnd) 1698 1753 { 1699 dprintf(("USER32: OpenIcon %x", hwnd));1700 1701 if(!IsIconic(hwnd))1754 dprintf(("USER32: OpenIcon %x", hwnd)); 1755 1756 if(!IsIconic(hwnd)) 1702 1757 return FALSE; 1703 ShowWindow(hwnd, SW_SHOWNORMAL);1704 return TRUE;1758 ShowWindow(hwnd, SW_SHOWNORMAL); 1759 return TRUE; 1705 1760 } 1706 1761 //****************************************************************************** … … 1711 1766 BOOL WIN32API ShowOwnedPopups(HWND hwndOwner, BOOL fShow) 1712 1767 { 1713 Win32BaseWindow *window, *owner;1714 HWND hwnd;1715 1716 owner = Win32BaseWindow::GetWindowFromHandle(hwndOwner);1717 if(!owner) {1768 Win32BaseWindow *window, *owner; 1769 HWND hwnd; 1770 1771 owner = Win32BaseWindow::GetWindowFromHandle(hwndOwner); 1772 if(!owner) { 1718 1773 dprintf(("ShowOwnedPopups, window %x not found", hwndOwner)); 1719 1774 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 1720 1775 return FALSE; 1721 }1722 dprintf(("USER32: ShowOwnedPopups %x %d", hwndOwner, fShow));1723 1724 hwnd = GetWindow(GetDesktopWindow(), GW_CHILD);1725 while(hwnd) {1776 } 1777 dprintf(("USER32: ShowOwnedPopups %x %d", hwndOwner, fShow)); 1778 1779 hwnd = GetWindow(GetDesktopWindow(), GW_CHILD); 1780 while(hwnd) { 1726 1781 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 1727 1782 if(window) { … … 1752 1807 } 1753 1808 } 1809 RELEASE_WNDOBJ(window); 1754 1810 } 1755 else 1811 else dprintf(("WARNING: window %x is not valid", hwnd)); 1756 1812 1757 1813 hwnd = GetWindow(hwnd, GW_HWNDNEXT); 1758 } 1759 return TRUE; 1814 } 1815 RELEASE_WNDOBJ(owner); 1816 return TRUE; 1760 1817 } 1761 1818 //****************************************************************************** … … 1803 1860 } 1804 1861 dprintf(("GetWindowContextHelpId %x", hwnd)); 1805 return window->getWindowContextHelpId(); 1862 DWORD ret = window->getWindowContextHelpId(); 1863 RELEASE_WNDOBJ(window); 1864 return ret; 1806 1865 } 1807 1866 //****************************************************************************** … … 1819 1878 dprintf(("SetWindowContextHelpId %x %d", hwnd, dwContextHelpId)); 1820 1879 window->setWindowContextHelpId(dwContextHelpId); 1880 RELEASE_WNDOBJ(window); 1821 1881 return(TRUE); 1822 1882 } … … 1833 1893 return 0; 1834 1894 } 1835 return window->getProp(str); 1895 HANDLE ret = window->getProp(str); 1896 RELEASE_WNDOBJ(window); 1897 return ret; 1836 1898 } 1837 1899 //****************************************************************************** … … 1860 1922 return FALSE; 1861 1923 } 1862 return window->setProp(str, handle); 1924 BOOL ret = window->setProp(str, handle); 1925 RELEASE_WNDOBJ(window); 1926 return ret; 1863 1927 } 1864 1928 //****************************************************************************** … … 1888 1952 return 0; 1889 1953 } 1890 return window->removeProp(str); 1954 HANDLE ret = window->removeProp(str); 1955 RELEASE_WNDOBJ(window); 1956 return ret; 1891 1957 } 1892 1958 //****************************************************************************** … … 1928 1994 return -1; 1929 1995 } 1930 return window->enumPropsExA(func, lParam); 1996 INT ret = window->enumPropsExA(func, lParam); 1997 RELEASE_WNDOBJ(window); 1998 return ret; 1931 1999 } 1932 2000 //****************************************************************************** … … 1942 2010 return -1; 1943 2011 } 1944 return window->enumPropsExW(func, lParam); 1945 } 1946 //****************************************************************************** 1947 //****************************************************************************** 2012 INT ret = window->enumPropsExW(func, lParam); 2013 RELEASE_WNDOBJ(window); 2014 return ret; 2015 } 2016 //****************************************************************************** 2017 //****************************************************************************** -
trunk/src/user32/windowclass.cpp
r5472 r5935 1 /* $Id: windowclass.cpp,v 1.2 0 2001-04-04 09:01:25sandervl Exp $ */1 /* $Id: windowclass.cpp,v 1.21 2001-06-09 14:50:26 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Code for OS/2 … … 52 52 wc.hIconSm = 0; 53 53 54 if(Win32WndClass::FindClass(wc.hInstance, (LPSTR)wc.lpszClassName)) { 54 wclass = Win32WndClass::FindClass(wc.hInstance, (LPSTR)wc.lpszClassName); 55 if(wclass) { 56 RELEASE_CLASSOBJ(wclass); 55 57 if(HIWORD(wc.lpszClassName)) { 56 58 dprintf(("RegisterClassA %x %s already exists", wc.hInstance, wc.lpszClassName)); … … 75 77 return(0); 76 78 } 77 return(wclass->getAtom()); 79 ATOM atom = wclass->getAtom(); 80 RELEASE_CLASSOBJ(wclass); 81 return atom; 78 82 } 79 83 //****************************************************************************** … … 84 88 Win32WndClass *wclass; 85 89 86 if(Win32WndClass::FindClass(lpWndClass->hInstance, (LPSTR)lpWndClass->lpszClassName)) { 90 wclass = Win32WndClass::FindClass(lpWndClass->hInstance, (LPSTR)lpWndClass->lpszClassName); 91 if(wclass) { 92 RELEASE_CLASSOBJ(wclass); 87 93 if(HIWORD(lpWndClass->lpszClassName)) { 88 94 dprintf(("RegisterClassExA %x %s already exists", lpWndClass->hInstance, lpWndClass->lpszClassName)); … … 100 106 return(0); 101 107 } 102 return(wclass->getAtom()); 108 ATOM atom = wclass->getAtom(); 109 RELEASE_CLASSOBJ(wclass); 110 return atom; 103 111 } 104 112 //****************************************************************************** … … 115 123 memcpy(&wc.style, lpwc, sizeof(WNDCLASSA)); 116 124 117 if(Win32WndClass::FindClass(wc.hInstance, (LPWSTR)wc.lpszClassName)) { 125 winclass = Win32WndClass::FindClass(wc.hInstance, (LPWSTR)wc.lpszClassName); 126 if(winclass) { 127 RELEASE_CLASSOBJ(winclass); 118 128 if(HIWORD(wc.lpszClassName)) { 119 129 dprintf(("RegisterClassW %x %ls already exists", wc.hInstance, wc.lpszClassName)); … … 139 149 } 140 150 rc = winclass->getAtom(); 141 151 RELEASE_CLASSOBJ(winclass); 142 152 return(rc); 143 153 } … … 153 163 memcpy(&wc, lpwc, sizeof(WNDCLASSEXA)); 154 164 155 if(Win32WndClass::FindClass(wc.hInstance, (LPWSTR)wc.lpszClassName)) { 165 winclass = Win32WndClass::FindClass(wc.hInstance, (LPWSTR)wc.lpszClassName); 166 if(winclass) { 167 RELEASE_CLASSOBJ(winclass); 156 168 if(HIWORD(wc.lpszClassName)) { 157 169 dprintf(("RegisterClassExW %x %ls already exists", wc.hInstance, wc.lpszClassName)); … … 170 182 } 171 183 rc = winclass->getAtom(); 184 RELEASE_CLASSOBJ(winclass); 172 185 173 186 return(rc); … … 180 193 181 194 ret = Win32WndClass::UnregisterClassA(hinst, (LPSTR)lpszClassName); 182 #if 1183 195 return ret; 184 #else185 //Spintest returns FALSE in dll termination, so pretend it succeeded186 // return(TRUE);187 #endif188 196 } 189 197 //****************************************************************************** … … 204 212 FreeAsciiString((char *)astring); 205 213 206 #if 1207 214 return ret; 208 #else209 //Spintest returns FALSE in dll termination, so pretend it succeeded210 // return(TRUE);211 #endif212 215 } 213 216 //****************************************************************************** … … 227 230 if(wndclass) { 228 231 wndclass->getClassInfo(&wc); 232 RELEASE_CLASSOBJ(wndclass); 229 233 memcpy(lpwc, &wc.style, sizeof(WNDCLASSA)); 230 234 SetLastError(ERROR_SUCCESS); … … 256 260 if(wndclass) { 257 261 wndclass->getClassInfo(&wc); 262 RELEASE_CLASSOBJ(wndclass); 258 263 memcpy(lpwc, &wc.style, sizeof(WNDCLASSW)); 259 264 SetLastError(ERROR_SUCCESS); … … 295 300 if(wndclass) { 296 301 wndclass->getClassInfo(lpwcx); 302 RELEASE_CLASSOBJ(wndclass); 297 303 lpwcx->cbSize = sizeof(WNDCLASSEXA); 298 304 SetLastError(ERROR_SUCCESS); … … 344 350 if(wndclass) { 345 351 wndclass->getClassInfo(lpwcx); 352 RELEASE_CLASSOBJ(wndclass); 346 353 lpwcx->cbSize = sizeof(WNDCLASSEXW); 347 354 SetLastError(ERROR_SUCCESS); … … 365 372 *lpszClassName = 0; 366 373 rc = (wnd->getClass())->getClassName(lpszClassName, cchClassName); 374 RELEASE_WNDOBJ(wnd); 367 375 dprintf(("USER32: GetClassNameA %x %s (%d)", hwnd, lpszClassName, rc)); 368 376 return rc; … … 373 381 { 374 382 Win32BaseWindow *wnd; 383 int ret; 375 384 376 385 dprintf(("USER32: GetClassNameW\n")); … … 380 389 return(0); 381 390 } 382 return (wnd->getClass())->getClassName(lpszClassName, cchClassName); 391 ret = (wnd->getClass())->getClassName(lpszClassName, cchClassName); 392 RELEASE_WNDOBJ(wnd); 393 return ret; 383 394 } 384 395 //****************************************************************************** … … 387 398 { 388 399 Win32BaseWindow *wnd; 400 LONG ret; 389 401 390 402 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 393 405 return(0); 394 406 } 395 return (wnd->getClass())->setClassLongA(nIndex, lNewVal); 407 ret = (wnd->getClass())->setClassLongA(nIndex, lNewVal); 408 RELEASE_WNDOBJ(wnd); 409 return ret; 396 410 } 397 411 //****************************************************************************** … … 400 414 { 401 415 Win32BaseWindow *wnd; 416 LONG ret; 402 417 403 418 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 406 421 return(0); 407 422 } 408 return (wnd->getClass())->setClassLongW(nIndex, lNewVal); 423 ret = (wnd->getClass())->setClassLongW(nIndex, lNewVal); 424 RELEASE_WNDOBJ(wnd); 425 return ret; 409 426 } 410 427 //****************************************************************************** … … 413 430 { 414 431 Win32BaseWindow *wnd; 432 LONG ret; 415 433 416 434 dprintf(("USER32: SetClassWord %x %d %x", hwnd, nIndex, (ULONG)wNewVal)); … … 420 438 return(0); 421 439 } 422 return (wnd->getClass())->setClassWord(nIndex, wNewVal); 440 ret = (wnd->getClass())->setClassWord(nIndex, wNewVal); 441 RELEASE_WNDOBJ(wnd); 442 return ret; 423 443 } 424 444 //****************************************************************************** … … 435 455 } 436 456 ret = (wnd->getClass())->getClassWord(nIndex); 457 RELEASE_WNDOBJ(wnd); 437 458 dprintf(("USER32: GetClassWord %x %d returned %x", hwnd, nIndex, (ULONG)ret)); 438 459 return ret; … … 451 472 } 452 473 ret = (wnd->getClass())->getClassLongA(nIndex); 474 RELEASE_WNDOBJ(wnd); 453 475 dprintf(("USER32: GetClassLongA %x %d returned %x", hwnd, nIndex, ret)); 454 476 return ret; … … 467 489 } 468 490 ret = (wnd->getClass())->getClassLongW(nIndex); 491 RELEASE_WNDOBJ(wnd); 469 492 dprintf(("USER32: GetClassLongW %x %d returned %x", hwnd, nIndex, ret)); 470 493 return ret; -
trunk/src/user32/windowmsg.cpp
r5805 r5935 1 /* $Id: windowmsg.cpp,v 1.2 5 2001-05-25 19:59:30sandervl Exp $ */1 /* $Id: windowmsg.cpp,v 1.26 2001-06-09 14:50:26 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 146 146 { 147 147 Win32BaseWindow *window; 148 LRESULT result; 148 149 149 150 if (hwnd == HWND_BROADCAST|| hwnd == HWND_TOPMOST) … … 158 159 return 0; 159 160 } 160 return window->SendMessageA(msg, wParam, lParam); 161 result = window->SendMessageA(msg, wParam, lParam); 162 RELEASE_WNDOBJ(window); 163 return result; 161 164 } 162 165 //****************************************************************************** … … 165 168 { 166 169 Win32BaseWindow *window; 170 LRESULT result; 167 171 168 172 if (hwnd == HWND_BROADCAST|| hwnd == HWND_TOPMOST) … … 177 181 return 0; 178 182 } 179 return window->SendMessageW(msg, wParam, lParam); 183 result = window->SendMessageW(msg, wParam, lParam); 184 RELEASE_WNDOBJ(window); 185 return result; 180 186 } 181 187 //****************************************************************************** … … 184 190 { 185 191 Win32BaseWindow *window; 192 HWND hwndOS2; 186 193 187 194 if (hwnd == HWND_BROADCAST) //Not HWND_TOPMOST??? … … 199 206 return 0; 200 207 } 208 hwndOS2 = window->getOS2WindowHandle(); 209 RELEASE_WNDOBJ(window); 201 210 dprintf(("PostMessageA, %x %x %x %x", hwnd, msg, wParam, lParam)); 202 return OSLibPostMessage( window->getOS2WindowHandle(), msg, wParam, lParam, FALSE);211 return OSLibPostMessage(hwndOS2, msg, wParam, lParam, FALSE); 203 212 } 204 213 //****************************************************************************** … … 207 216 { 208 217 Win32BaseWindow *window; 218 HWND hwndOS2; 209 219 210 220 if (hwnd == HWND_BROADCAST) //Not HWND_TOPMOST??? … … 222 232 return 0; 223 233 } 234 hwndOS2 = window->getOS2WindowHandle(); 235 RELEASE_WNDOBJ(window); 224 236 dprintf(("PostMessageW, %x %x %x %x", hwnd, msg, wParam, lParam)); 225 return OSLibPostMessage( window->getOS2WindowHandle(), msg, wParam, lParam, TRUE);237 return OSLibPostMessage(hwndOS2, msg, wParam, lParam, TRUE); 226 238 } 227 239 //****************************************************************************** -
trunk/src/user32/windowword.cpp
r5060 r5935 1 /* $Id: windowword.cpp,v 1.1 0 2001-02-03 18:52:03sandervl Exp $ */1 /* $Id: windowword.cpp,v 1.11 2001-06-09 14:50:26 sandervl Exp $ */ 2 2 3 3 /* … … 23 23 { 24 24 Win32BaseWindow *window; 25 LONG ret; 25 26 26 27 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 27 28 if(window) 28 29 { 29 return window->SetWindowLongA(nIndex,lNewLong); 30 ret = window->SetWindowLongA(nIndex,lNewLong); 31 RELEASE_WNDOBJ(window); 32 return ret; 30 33 } 31 34 else { … … 40 43 { 41 44 Win32BaseWindow *window; 45 LONG ret; 42 46 43 47 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 44 48 if(window) 45 49 { 46 return window->SetWindowLongA(nIndex,lNewLong, TRUE); 50 ret = window->SetWindowLongA(nIndex,lNewLong, TRUE); 51 RELEASE_WNDOBJ(window); 52 return ret; 47 53 } 48 54 else { … … 57 63 { 58 64 Win32BaseWindow *window; 65 LONG ret; 59 66 60 67 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 61 68 if(window) 62 69 { 63 return window->GetWindowWord(nIndex); 70 ret = window->GetWindowWord(nIndex); 71 RELEASE_WNDOBJ(window); 72 return ret; 64 73 } 65 74 else … … 75 84 { 76 85 Win32BaseWindow *window; 86 LONG ret; 77 87 78 88 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 79 89 if(window) 80 90 { 81 return window->SetWindowWord(nIndex, arg3); 91 ret = window->SetWindowWord(nIndex, arg3); 92 RELEASE_WNDOBJ(window); 93 return ret; 82 94 } 83 95 else … … 93 105 { 94 106 Win32BaseWindow *window; 107 LONG ret; 95 108 96 109 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 97 110 if(window) 98 111 { 99 return window->GetWindowLongA(nIndex); 112 ret = window->GetWindowLongA(nIndex); 113 RELEASE_WNDOBJ(window); 114 return ret; 100 115 } 101 116 else … … 111 126 { 112 127 Win32BaseWindow *window; 128 LONG ret; 113 129 114 130 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 115 131 if(window) 116 132 { 117 return window->GetWindowLongA(nIndex, TRUE); 133 ret = window->GetWindowLongA(nIndex, TRUE); 134 RELEASE_WNDOBJ(window); 135 return ret; 118 136 } 119 137 else -
trunk/src/user32/winproc.cpp
r4194 r5935 1 /* $Id: winproc.cpp,v 1. 6 2000-09-05 19:20:38sandervl Exp $ */1 /* $Id: winproc.cpp,v 1.7 2001-06-09 14:50:26 sandervl Exp $ */ 2 2 /* 3 3 * Window procedure callbacks … … 307 307 else dprintf2(("CallWindowProcA %x %x %x %x %x (unknown proc)", func, hwnd, msg, wParam, lParam)); 308 308 309 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(hwnd); 310 if(!window) { 309 if(!IsWindow(hwnd)) { 311 310 dprintf(("CallWindowProcA, window %x not found", hwnd)); 312 311 // return func( hwnd, msg, wParam, lParam ); … … 342 341 else dprintf2(("CallWindowProcW %x %x %x %x %x (unknown proc)", func, hwnd, msg, wParam, lParam)); 343 342 344 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(hwnd); 345 if(!window) { 343 if(!IsWindow(hwnd)) { 346 344 dprintf(("CallWindowProcW, window %x not found", hwnd)); 347 345 // return func( hwnd, msg, wParam, lParam );
Note:
See TracChangeset
for help on using the changeset viewer.