- Timestamp:
- Jul 14, 1999, 11:05:59 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/initterm.cpp
r300 r304 1 /* $Id: initterm.cpp,v 1. 1 1999-07-14 08:35:34 sandervlExp $ */1 /* $Id: initterm.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */ 2 2 3 3 /* … … 27 27 #define INCL_DOSMODULEMGR 28 28 #define INCL_DOSPROCESS 29 #include <os2wrap.h> 29 #include <os2wrap.h> //Odin32 OS/2 api wrappers 30 30 #include <stdlib.h> 31 31 #include <stdio.h> … … 95 95 if (CRT_init() == -1) 96 96 return 0UL; 97 97 _ctordtorInit(); 98 98 99 99 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ … … 105 105 rc = DosExitList(0x0000FF00|EXLST_ADD, cleanup); 106 106 if(rc) 107 107 return 0UL; 108 108 109 109 rc = DosExitList(0x00008000|EXLST_ADD, cleanupQueue); 110 110 if(rc) 111 111 return 0UL; 112 112 113 113 //SvL: 18-7-'98, Register system window classes (button, listbox etc etc) 114 114 RegisterSystemClasses(hModule); 115 115 116 117 116 //SvL: Try to start communication with our message spy queue server 117 InitSpyQueue(); 118 118 119 120 121 122 119 //SvL: Init win32 PM classes 120 if(InitPM() == FALSE) { 121 return 0UL; 122 } 123 123 break; 124 124 case 1 : -
trunk/src/user32/new/menu.cpp
r300 r304 1 /* $Id: menu.cpp,v 1. 1 1999-07-14 08:35:35 sandervlExp $ */1 /* $Id: menu.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */ 2 2 3 3 /* … … 17 17 */ 18 18 #include <os2win.h> 19 #include <stdlib.h> 19 20 20 21 //****************************************************************************** … … 88 89 free(astring); 89 90 if(rc) { 90 91 91 dprintf(("USER32: OS2GetMenuStringW %s\n", astring)); 92 AsciiToUnicode(astring, lpsz); 92 93 } 93 else 94 else lpsz[0] = 0; 94 95 return(rc); 95 96 } … … 158 159 #endif 159 160 if(lpPM->cbSize != 0) 160 161 rect = &lpPM->rcExclude; 161 162 162 163 return O32_TrackPopupMenu(hmenu, flags, X, Y, 0, hwnd, rect); … … 165 166 //****************************************************************************** 166 167 BOOL WIN32API AppendMenuA(HMENU hMenu, UINT uFlags, UINT ulDNewItem, 167 168 LPCSTR lpNewItem) 168 169 { 169 170 #ifdef DEBUG … … 173 174 174 175 if(uFlags & MF_STRING || uFlags == 0) 175 176 WriteLog("USER32: OS2AppendMenuA %s\n", lpNewItem); 176 177 177 178 rc = O32_AppendMenu(hMenu, uFlags, ulDNewItem, lpNewItem); … … 358 359 //****************************************************************************** 359 360 BOOL WIN32API CheckMenuRadioItem(HMENU hmenu, UINT idFirst, UINT idLast, 360 361 UINT idCheck, UINT uFlags) 361 362 { 362 363 #ifdef DEBUG … … 407 408 //****************************************************************************** 408 409 BOOL WIN32API SetMenuItemInfoA(HMENU hmenu, UINT par1, BOOL par2, 409 410 const MENUITEMINFOA * lpMenuItemInfo) 410 411 { 411 412 #ifdef DEBUG -
trunk/src/user32/new/oslibwin.cpp
r300 r304 1 /* $Id: oslibwin.cpp,v 1. 1 1999-07-14 08:35:35 sandervlExp $ */1 /* $Id: oslibwin.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 24 24 if(hwndParent == OSLIB_HWND_DESKTOP) 25 25 { 26 26 hwndParent = HWND_DESKTOP; 27 27 } 28 28 … … 40 40 41 41 if(hwndParent == 0) { 42 42 hwndParent = HWND_DESKTOP; 43 43 } 44 44 if(WinQueryWindowRect(hwndParent, &rectl) == 0) { 45 45 y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y); 46 46 } 47 47 if(dwFrameStyle) { 48 49 hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,50 48 dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs 49 hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle, 50 &dwFrameStyle, WIN32_STDCLASS, 51 51 "", 0, 0, 0, &hwndClient) != 0; 52 53 54 55 56 WinSetWindowPos(hwndFrame, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP,57 52 if(hwndFrame) { 53 if(pszName) { 54 WinSetWindowText(hwndFrame, pszName); 55 } 56 WinSetWindowPos(hwndFrame, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 57 x, y, cx, cy, SWP_SIZE | SWP_MOVE); 58 58 59 60 61 59 return hwndFrame; 60 } 61 return 0; 62 62 } 63 else 63 else return WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, x, y, cx, cy, 64 64 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL, 65 65 NULL); … … 74 74 /* Window styles */ 75 75 if(dwStyle & WINWS_MINIMIZE) 76 76 *OSWinStyle |= WS_MINIMIZED; 77 77 if(dwStyle & WINWS_VISIBLE) 78 78 *OSWinStyle |= WS_VISIBLE; 79 79 if(dwStyle & WINWS_DISABLED) 80 80 *OSWinStyle |= WS_DISABLED; 81 81 if(dwStyle & WINWS_CLIPSIBLINGS) 82 82 *OSWinStyle |= WS_CLIPSIBLINGS; 83 83 if(dwStyle & WINWS_CLIPCHILDREN) 84 84 *OSWinStyle |= WS_CLIPCHILDREN; 85 85 if(dwStyle & WINWS_MAXIMIZE) 86 86 *OSWinStyle |= WS_MAXIMIZED; 87 87 if(dwStyle & WINWS_GROUP) 88 88 *OSWinStyle |= WS_GROUP; 89 89 if(dwStyle & WINWS_TABSTOP) 90 90 *OSWinStyle |= WS_TABSTOP; 91 91 92 92 if(dwStyle & WINWS_CAPTION) 93 93 *OSFrameStyle |= FCF_TITLEBAR; 94 94 if(dwStyle & WINWS_BORDER) 95 95 *OSFrameStyle |= FCF_BORDER; 96 96 if(dwStyle & WINWS_DLGFRAME) 97 97 *OSFrameStyle |= FCF_DLGBORDER; 98 98 if(dwStyle & WINWS_VSCROLL) 99 99 *OSFrameStyle |= FCF_VERTSCROLL; 100 100 if(dwStyle & WINWS_HSCROLL) 101 101 *OSFrameStyle |= FCF_HORZSCROLL; 102 102 if(dwStyle & WINWS_SYSMENU) 103 103 *OSFrameStyle |= FCF_SYSMENU; 104 104 if(dwStyle & WINWS_THICKFRAME) 105 *OSFrameStyle |= FCF_SIZEBORDER;//??105 *OSFrameStyle |= FCF_SIZEBORDER; //?? 106 106 if(dwStyle & WINWS_MINIMIZEBOX) 107 107 *OSFrameStyle |= FCF_MINBUTTON; 108 108 if(dwStyle & WINWS_MAXIMIZEBOX) 109 109 *OSFrameStyle |= FCF_MAXBUTTON; 110 110 111 111 return TRUE; … … 115 115 BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value) 116 116 { 117 return WinSetWindowULong(hwnd, offset, value) == 0;117 return WinSetWindowULong(hwnd, offset, value); 118 118 } 119 119 //****************************************************************************** … … 121 121 ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset) 122 122 { 123 return Win GetWindowULong(hwnd, offset);123 return WinQueryWindowULong(hwnd, offset); 124 124 } 125 125 //****************************************************************************** -
trunk/src/user32/new/pmwindow.cpp
r300 r304 1 /* $Id: pmwindow.cpp,v 1. 2 1999-07-14 08:35:35 sandervlExp $ */1 /* $Id: pmwindow.cpp,v 1.3 1999-07-14 21:05:58 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 36 36 37 37 if(!hab || !hmq) { 38 dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq)); 39 return(FALSE); 38 UINT error; 39 40 //CB: only fail on real error 41 error = WinGetLastError(hab) & 0xFFFF; //error code 42 if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS) 43 { 44 dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq)); 45 dprintf((" Error = %x",error)); 46 return(FALSE); 47 } else 48 { 49 //CB: get queue handle (todo) 50 } 40 51 } 41 52 … … 46 57 CS_SIZEREDRAW, /* Class style */ 47 58 8)) { 48 49 59 dprintf(("WinRegisterClass Win32Window failed")); 60 return(FALSE); 50 61 } 51 62 … … 68 79 69 80 if(msg != WM_CREATE && win32wnd == NULL && magic != WIN32PM_MAGIC) { 70 71 81 dprintf(("Invalid win32wnd pointer for window %x!!", hwnd)); 82 goto RunDefWndProc; 72 83 } 73 84 switch( msg ) 74 { 85 { 75 86 case WM_CREATE: 76 77 78 87 //Processing is done in after WinCreateWindow returns 88 break; 89 79 90 case WM_QUIT: 80 81 82 83 84 91 if(win32wnd->MsgQuit()) { 92 goto RunDefWndProc; 93 } 94 break; 95 85 96 case WM_CLOSE: 86 87 88 89 97 if(win32wnd->MsgClose()) { 98 goto RunDefWndProc; 99 } 100 break; 90 101 91 102 case WM_DESTROY: 92 93 94 95 103 if(win32wnd->MsgDestroy()) { 104 goto RunDefWndProc; 105 } 106 break; 96 107 97 108 case WM_ENABLE: 98 99 100 101 109 if(win32wnd->MsgEnable((ULONG)mp1)) { 110 goto RunDefWndProc; 111 } 112 break; 102 113 103 114 case WM_SHOW: 104 105 106 107 115 if(win32wnd->MsgShow((ULONG)mp1)) { 116 goto RunDefWndProc; 117 } 118 break; 108 119 109 120 case WM_MOVE: … … 114 125 ULONG xScreen, yScreen, yParent, xParent; 115 126 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 elsexParent = yParent = -1;137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 127 rc = WinQueryWindowRect(hwnd, &rectl); 128 if(rc == TRUE) { 129 point.x = rectl.xLeft; 130 point.y = rectl.yBottom; 131 132 //If the window has a parent, calculate position relative to that window 133 if((hwndParent = WinQueryWindow(hwnd, QW_PARENT)) != WinQueryDesktopWindow(hab, NULLHANDLE)) { 134 rc = WinMapWindowPoints(hwnd, hwndParent, &point, 1); 135 if(rc == FALSE) { 136 dprintf(("WM_MOVE: WinMapWindowPoints (parent) failed!")); 137 break; 138 } 139 rc = WinQueryWindowRect(hwndParent, &rectl2); 140 if(rc == FALSE) { 141 dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!")); 142 break; 143 } 144 yParent = point.x; 145 yParent = OS2TOWIN32POINT(rectl2.yTop - rectl2.yBottom, point.y); 146 } 147 else xParent = yParent = -1; 148 149 point.x = rectl.xLeft; 150 point.y = rectl.yBottom; 151 152 rc = WinMapWindowPoints(hwnd, HWND_DESKTOP, &point, 1); 153 if(rc == FALSE) { 154 dprintf(("WM_MOVE: WinMapWindowPoints (desktop) failed!")); 155 break; 156 } 157 rc = WinQueryWindowRect(HWND_DESKTOP, &rectl); 158 if(rc == FALSE) { 159 dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!")); 160 break; 161 } 162 xScreen = point.x; 163 yScreen = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, point.y); 164 165 if(win32wnd->MsgMove(xScreen, yScreen, xParent, yParent)) { 166 goto RunDefWndProc; 167 } 168 } 169 else { 170 dprintf(("WM_MOVE: WinQueryWindowRect failed!")); 171 } 172 break; 162 173 } 163 174 164 175 case WM_WINDOWPOSCHANGED: 165 176 { 166 177 break; 167 178 } 168 179 169 180 case WM_ADJUSTWINDOWPOS: 170 181 { 171 // 172 182 // if(win32wnd->MsgWindowPosChanging(0, 0)) { 183 break; 173 184 } 174 185 … … 177 188 HPS hps; 178 189 179 180 190 hps = WinGetPS(hwnd); 191 if(win32wnd->MsgEraseBackGround((ULONG)hps)) 181 192 { 182 183 184 185 186 187 188 189 190 193 /* 194 * Return TRUE to request PM to paint the window background 195 * in SYSCLR_WINDOW. 196 */ 197 WinReleasePS(hps); 198 return (MRESULT)( TRUE ); 199 } 200 WinReleasePS(hps); 201 return (MRESULT) FALSE; 191 202 } 192 203 case WM_SIZE: … … 194 205 SWP swp; 195 206 196 197 198 199 200 201 if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), 202 (swp.fl & SWP_MINIMIZE) != 0, 203 (swp.fl & SWP_MAXIMIZE) != 0)) 207 rc = WinQueryWindowPos(hwnd, &swp); 208 if(rc == FALSE) { 209 dprintf(("WM_SIZE: WinQueryWindowPos failed!")); 210 break; 211 } 212 if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), 213 (swp.fl & SWP_MINIMIZE) != 0, 214 (swp.fl & SWP_MAXIMIZE) != 0)) 204 215 { 205 206 207 208 216 goto RunDefWndProc; 217 } 218 219 break; 209 220 } 210 221 … … 213 224 HWND hwndActivate = (HWND)mp1; 214 225 215 216 217 218 219 220 221 222 223 226 if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { 227 //another (non-win32) application's window 228 //set to NULL (allowed according to win32 SDK) to avoid problems 229 hwndActivate = NULL; 230 } 231 if(win32wnd->MsgActivate(1, hwndActivate)) { 232 goto RunDefWndProc; 233 } 234 break; 224 235 } 225 236 case WM_FOCUSCHANGE: 226 237 break; 227 238 228 239 case WM_SETFOCUS: … … 230 241 HWND hwndFocus = (HWND)mp1; 231 242 232 233 234 235 236 237 238 239 240 elserc = win32wnd->MsgKillFocus(hwndFocus);241 242 243 244 243 if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { 244 //another (non-win32) application's window 245 //set to NULL (allowed according to win32 SDK) to avoid problems 246 hwndFocus = NULL; 247 } 248 if((ULONG)mp2 == TRUE) { 249 rc = win32wnd->MsgSetFocus(hwndFocus); 250 } 251 else rc = win32wnd->MsgKillFocus(hwndFocus); 252 if(rc) { 253 goto RunDefWndProc; 254 } 255 break; 245 256 } 246 257 //************************************************************************** … … 248 259 //************************************************************************** 249 260 case WM_BUTTON1DOWN: 250 251 252 253 261 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 262 goto RunDefWndProc; 263 } 264 break; 254 265 case WM_BUTTON1UP: 255 256 257 258 266 if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 267 goto RunDefWndProc; 268 } 269 break; 259 270 case WM_BUTTON1DBLCLK: 260 261 262 263 271 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 272 goto RunDefWndProc; 273 } 274 break; 264 275 case WM_BUTTON2DOWN: 265 266 267 268 276 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 277 goto RunDefWndProc; 278 } 279 break; 269 280 case WM_BUTTON2UP: 270 271 272 273 281 if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 282 goto RunDefWndProc; 283 } 284 break; 274 285 case WM_BUTTON2DBLCLK: 275 276 277 278 286 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 287 goto RunDefWndProc; 288 } 289 break; 279 290 case WM_BUTTON2MOTIONSTART: 280 291 case WM_BUTTON2MOTIONEND: … … 289 300 case WM_BUTTON3MOTIONEND: 290 301 case WM_BUTTON3CLICK: 291 302 break; 292 303 293 304 case WM_MOUSEMOVE: 294 305 break; 295 306 296 307 //************************************************************************** … … 298 309 //************************************************************************** 299 310 case WM_VSCROLL: 300 311 break; 301 312 case WM_HSCROLL: 302 313 break; 303 314 304 315 case WM_CONTROL: 305 316 break; 306 317 307 318 case WM_COMMAND: 308 319 case WM_SYSCOMMAND: 309 320 break; 310 321 311 322 case WM_CHAR: 312 323 break; 313 324 314 325 case WM_INITMENU: … … 316 327 case WM_MENUEND: 317 328 case WM_NEXTMENU: 318 329 break; 319 330 320 331 case WM_TIMER: 321 332 break; 322 333 323 334 case WM_PAINT: 324 325 326 327 335 if(win32wnd->MsgPaint(0, 0)) { 336 goto RunDefWndProc; 337 } 338 break; 328 339 329 340 case WM_SYSCOLORCHANGE: 330 341 case WM_SYSVALUECHANGED: 331 342 break; 332 343 333 344 case WM_CALCVALIDRECTS: … … 353 364 case WM_SAVEAPPLICATION: 354 365 case WM_SEMANTICEVENT: 355 366 break; 356 367 default: 357 RestoreOS2TIB(); 358 368 RestoreOS2TIB(); 369 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 359 370 } 360 RestoreOS2TIB(); 371 RestoreOS2TIB(); 361 372 return (MRESULT)FALSE; 362 373 363 374 RunDefWndProc: 364 RestoreOS2TIB(); 375 RestoreOS2TIB(); 365 376 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 366 377 } /* End of Win32WindowProc */ -
trunk/src/user32/new/win32class.cpp
r300 r304 1 /* $Id: win32class.cpp,v 1. 2 1999-07-14 08:35:36 sandervlExp $ */1 /* $Id: win32class.cpp,v 1.3 1999-07-14 21:05:58 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Class Managment Code for OS/2 … … 23 23 { 24 24 if(HIWORD(wndclass->lpszClassName)) { 25 if(isUnicode) { 26 classNameA = (PCHAR)malloc(lstrlenW((LPWSTR)wndclass->lpszClassName)+1); 27 classNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)wndclass->lpszClassName)+1)*sizeof(WCHAR)); 28 } 29 else { 30 classNameA = (PCHAR)malloc(strlen(wndclass->lpszClassName)+1); 31 classNameW = (WCHAR *)malloc((strlen(wndclass->lpszClassName)+1)*sizeof(WCHAR)); 32 } 33 if(classNameA == NULL || classNameW == NULL) { 34 dprintf(("Win32Class ctr; classNameA/classNameW == NULL")); 35 exit(1); 36 } 37 if(isUnicode) { 38 lstrcpyW(classNameW, (LPWSTR)wndclass->lpszClassName); 39 UnicodeToAscii(classNameW, classNameA); 40 } 41 else { 42 strcpy((char *)classNameA, wndclass->lpszClassName); 43 AsciiToUnicode(classNameA, classNameW); 44 } 45 classAtom = GlobalAddAtomA(classNameA); 25 if(isUnicode) { 26 INT len = lstrlenW((LPWSTR)wndclass->lpszClassName)+1; 27 28 classNameA = (PCHAR)malloc(len); 29 classNameW = (WCHAR *)malloc(len*sizeof(WCHAR)); 30 } 31 else { 32 INT len = strlen(wndclass->lpszClassName)+1; 33 34 classNameA = (PCHAR)malloc(len); 35 classNameW = (WCHAR *)malloc(len*sizeof(WCHAR)); 36 } 37 if(classNameA == NULL || classNameW == NULL) { 38 dprintf(("Win32Class ctr; classNameA/classNameW == NULL")); 39 exit(1); 40 } 41 if(isUnicode) { 42 lstrcpyW(classNameW, (LPWSTR)wndclass->lpszClassName); 43 UnicodeToAscii(classNameW, classNameA); 44 } 45 else { 46 strcpy((char *)classNameA, wndclass->lpszClassName); 47 AsciiToUnicode(classNameA, classNameW); 48 } 49 classAtom = GlobalAddAtomA(classNameA); 46 50 } 47 51 else { 48 classNameA= NULL;49 50 classAtom= (DWORD)wndclass->lpszClassName;52 classNameA = NULL; 53 classNameW = NULL; 54 classAtom = (DWORD)wndclass->lpszClassName; 51 55 } 52 56 this->isUnicode = isUnicode; … … 62 66 dprintf(("USER32: wndclass->hbrBackground %X\n", wndclass->hbrBackground)); 63 67 if(HIWORD(wndclass->lpszClassName)) 64 dprintf(("USER32: wndclass->lpszClassName % X\n", wndclass->lpszClassName));65 else dprintf(("USER32: wndclass->lpszClassName % s\n", wndclass->lpszClassName));68 dprintf(("USER32: wndclass->lpszClassName %s\n", wndclass->lpszClassName)); 69 else dprintf(("USER32: wndclass->lpszClassName %X\n", wndclass->lpszClassName)); 66 70 67 71 if(HIWORD(wndclass->lpszMenuName)) {//convert string name identifier to numeric id … … 70 74 else dprintf(("USER32: wndclass->lpszMenuName %X\n", wndclass->lpszMenuName)); 71 75 72 nrExtraClassWords 73 nrExtraWindowWords 74 backgroundBrush = wndclass->hbrBackground;//TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL75 hCursor 76 hIcon 77 hInstance 76 nrExtraClassWords = wndclass->cbClsExtra; 77 nrExtraWindowWords = wndclass->cbWndExtra; 78 backgroundBrush = wndclass->hbrBackground; //TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL 79 hCursor = wndclass->hCursor; 80 hIcon = wndclass->hIcon; 81 hInstance = wndclass->hInstance; 78 82 79 83 menuNameA = 0; … … 81 85 setMenuName((LPSTR)wndclass->lpszMenuName); 82 86 83 windowStyle 84 windowProc 87 windowStyle = wndclass->style; 88 windowProc = wndclass->lpfnWndProc; 85 89 86 90 //User data class words/longs 87 91 if(nrExtraClassWords) { 88 89 90 91 92 93 94 } 95 else 92 userClassLong = (ULONG *)malloc(nrExtraClassWords); 93 if(userClassLong == NULL) { 94 dprintf(("Win32Class ctr: userClassLong == NULL!")); 95 exit(1); 96 } 97 memset(userClassLong, 0, nrExtraClassWords); 98 } 99 else userClassLong = NULL; 96 100 97 101 cWindows = 0; … … 102 106 Win32WndClass::~Win32WndClass() 103 107 { 104 if(userClassLong) 105 if(classNameA) 106 if(classNameW) 108 if(userClassLong) free(userClassLong); 109 if(classNameA) free(classNameA); 110 if(classNameW) free(classNameW); 107 111 if(menuNameA && HIWORD(menuNameA)) { 108 109 110 112 free(menuNameA); 113 assert(menuNameW); 114 free(menuNameW); 111 115 } 112 116 } … … 117 121 Win32WndClass *wndclass = (Win32WndClass *)wndclasses; 118 122 119 if(wndclass == NULL) 123 if(wndclass == NULL) return(NULL); 120 124 121 125 if(HIWORD(id) != 0) { 122 123 124 125 126 127 128 129 130 131 132 133 126 if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) { 127 return(wndclass); 128 } 129 else { 130 wndclass = (Win32WndClass *)wndclass->GetNext(); 131 while(wndclass != NULL) { 132 if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) { 133 return(wndclass); 134 } 135 wndclass = (Win32WndClass *)wndclass->GetNext(); 136 } 137 } 134 138 } 135 139 else { 136 137 138 139 140 141 142 143 144 145 146 147 140 if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) { 141 return(wndclass); 142 } 143 else { 144 wndclass = (Win32WndClass *)wndclass->GetNext(); 145 while(wndclass != NULL) { 146 if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) { 147 return(wndclass); 148 } 149 wndclass = (Win32WndClass *)wndclass->GetNext(); 150 } 151 } 148 152 } 149 153 dprintf(("Class %X (inst %X) not found!", id, hInstance)); … … 157 161 wndclass->cbWndExtra = nrExtraWindowWords; 158 162 wndclass->hbrBackground = backgroundBrush; 159 wndclass->hCursor 163 wndclass->hCursor = hCursor; 160 164 wndclass->hIcon = hIcon; 161 165 wndclass->hInstance = hInstance; 162 166 wndclass->lpszMenuName = (LPCTSTR)menuNameA; 163 167 wndclass->lpszClassName = (classNameA) ? (LPCTSTR)classNameA : (LPCTSTR)classAtom; 164 wndclass->style 165 wndclass->lpfnWndProc 166 wndclass->hIconSm 168 wndclass->style = windowStyle; 169 wndclass->lpfnWndProc = windowProc; 170 wndclass->hIconSm = hIconSm; 167 171 return(TRUE); 168 172 } … … 174 178 wndclass->cbWndExtra = nrExtraWindowWords; 175 179 wndclass->hbrBackground = backgroundBrush; 176 wndclass->hCursor 180 wndclass->hCursor = hCursor; 177 181 wndclass->hIcon = hIcon; 178 182 wndclass->hInstance = hInstance; 179 183 wndclass->lpszMenuName = (LPCWSTR)menuNameW; 180 184 wndclass->lpszClassName = (classNameW) ? (LPCWSTR)classNameW : (LPCWSTR)classAtom; 181 wndclass->style 182 wndclass->lpfnWndProc 183 wndclass->hIconSm 185 wndclass->style = windowStyle; 186 wndclass->lpfnWndProc = windowProc; 187 wndclass->hIconSm = hIconSm; 184 188 return(TRUE); 185 189 } … … 189 193 { 190 194 if(HIWORD(classNameA)) { 191 192 195 strncpy(lpszClassName, classNameA, cchClassName-1); 196 return strlen(lpszClassName); 193 197 } 194 198 *(ULONG *)lpszClassName = classAtom; … … 202 206 203 207 if(HIWORD(classNameW)) { 204 205 208 lstrcpyW(lpszClassName, classNameW); 209 return lstrlenW(lpszClassName)*sizeof(WCHAR); 206 210 } 207 211 *(ULONG *)lpszClassName = classAtom; … … 213 217 { 214 218 if(HIWORD(menuNameA)) { 215 216 217 219 free(menuNameA); 220 free(menuNameW); 221 menuNameA = 0; 218 222 menuNameW = 0; 219 223 } 220 224 if(HIWORD(newMenuName)) { 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 225 if(isUnicode) { 226 menuNameA = (PCHAR)malloc(lstrlenW((LPWSTR)newMenuName)+1); 227 menuNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)newMenuName)+1)*sizeof(WCHAR)); 228 } 229 else { 230 menuNameA = (PCHAR)malloc(strlen(newMenuName)+1); 231 menuNameW = (WCHAR *)malloc((strlen(newMenuName)+1)*sizeof(WCHAR)); 232 } 233 if(menuNameA == NULL || menuNameW == NULL) { 234 dprintf(("Win32Class ctr; menuName/menuNameW == NULL")); 235 exit(1); 236 } 237 if(isUnicode) { 238 lstrcpyW(menuNameW, (LPWSTR)newMenuName); 239 UnicodeToAscii(menuNameW, menuNameA); 240 } 241 else { 242 strcpy((char *)menuNameA, newMenuName); 243 AsciiToUnicode(menuNameA, menuNameW); 244 } 241 245 } 242 246 else {//id 243 244 247 menuNameA = (PCHAR)newMenuName; 248 menuNameW = (WCHAR *)newMenuName; 245 249 } 246 250 } … … 250 254 { 251 255 switch(index) { 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 256 case GCL_CBCLSEXTRA: 257 return nrExtraClassWords; 258 case GCL_CBWNDEXTRA: 259 return nrExtraWindowWords; 260 case GCL_HBRBACKGROUND: 261 return backgroundBrush; 262 case GCL_HCURSOR: 263 return hCursor; 264 case GCL_HICON: 265 return hIcon; 266 case GCL_HMODULE: 267 return hInstance; 268 case GCL_MENUNAME: 269 return (isUnicode) ? (ULONG)menuNameW : (ULONG)menuNameA; 270 case GCL_STYLE: 271 return windowStyle; 272 case GCL_WNDPROC: 273 return (ULONG)windowProc; 274 case GCW_ATOM: //TODO: does this really happen in windows? 275 SetLastError(ERROR_INVALID_PARAMETER); 276 return 0; 277 default: 278 if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) { 279 return userClassLong[index]; 280 } 281 SetLastError(ERROR_INVALID_PARAMETER); 282 return 0; 279 283 } 280 284 } … … 284 288 { 285 289 switch(index) { 286 case GCW_ATOM: 287 288 289 290 291 292 293 290 case GCW_ATOM: 291 return (WORD)classAtom; 292 default: 293 if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) { 294 return ((WORD *)userClassLong)[index]; 295 } 296 SetLastError(ERROR_INVALID_PARAMETER); 297 return 0; 294 298 } 295 299 } … … 302 306 303 307 switch(index) { 304 305 306 // 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 rc = 0;//old value is meaningless (according to Wine)330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 308 case GCL_CBCLSEXTRA: //TODO (doesn't affect allocated classes, so what does it do?) 309 rc = nrExtraClassWords; 310 // nrExtraClassWords = lNewVal; 311 break; 312 case GCL_CBWNDEXTRA: 313 rc = nrExtraWindowWords; 314 nrExtraWindowWords = lNewVal; 315 break; 316 case GCL_HBRBACKGROUND: 317 rc = backgroundBrush; 318 backgroundBrush = lNewVal; 319 break; 320 case GCL_HCURSOR: 321 rc = hCursor; 322 hCursor = lNewVal; 323 break; 324 case GCL_HICON: 325 rc = hIcon; 326 hIcon = lNewVal; 327 break; 328 case GCL_HMODULE: 329 rc = hInstance; 330 hInstance = lNewVal; 331 break; 332 case GCL_MENUNAME: 333 rc = 0; //old value is meaningless (according to Wine) 334 setMenuName((LPSTR)lNewVal); 335 break; 336 case GCL_STYLE: 337 rc = windowStyle; 338 windowStyle = lNewVal; 339 break; 340 case GCL_WNDPROC: 341 rc = (ULONG)windowProc; 342 windowProc = (WNDPROC)lNewVal; 343 break; 344 case GCW_ATOM: //TODO: does this really happen in windows? 345 SetLastError(ERROR_INVALID_PARAMETER); 346 return 0; 347 default: 348 if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) { 349 rc = userClassLong[index]; 350 userClassLong[index] = lNewVal; 351 return(rc); 352 } 353 SetLastError(ERROR_INVALID_PARAMETER); 354 return 0; 351 355 } 352 356 return(rc); … … 359 363 360 364 switch(index) { 361 case GCW_ATOM: 362 363 364 365 366 367 368 369 370 371 372 365 case GCW_ATOM: 366 rc = (WORD)classAtom; 367 classAtom = wNewVal; 368 return(rc); 369 default: 370 if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) { 371 rc = ((WORD *)userClassLong)[index]; 372 ((WORD *)userClassLong)[index] = wNewVal; 373 return(rc); 374 } 375 SetLastError(ERROR_INVALID_PARAMETER); 376 return 0; 373 377 } 374 378 } … … 383 387 wndclass = FindClass(hinst, id); 384 388 if(wndclass) { 385 386 389 delete wndclass; 390 return; 387 391 } 388 392 dprintf(("::UnregisterClass, couldn't find class %X!!\n", id)); -
trunk/src/user32/new/win32wnd.cpp
r300 r304 1 /* $Id: win32wnd.cpp,v 1. 1 1999-07-14 08:35:37 sandervlExp $ */1 /* $Id: win32wnd.cpp,v 1.2 1999-07-14 21:05:58 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 45 45 //****************************************************************************** 46 46 Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode) 47 47 : GenericObject(&windows, OBJTYPE_WINDOW) 48 48 { 49 49 Init(); … … 57 57 isUnicode = FALSE; 58 58 59 *windowName= NULL;59 windowName = NULL; 60 60 wndNameLength = 0; 61 61 62 *windowText= NULL;;62 windowText = NULL;; 63 63 wndTextLength = 0; 64 65 *userWindowLong= NULL;;64 65 userWindowLong = NULL;; 66 66 nrUserWindowLong = 0; 67 67 … … 69 69 OS2Hwnd = 0; 70 70 Win32Hwnd = 0; 71 if(HMHandleAllocate(&Win32Hwnd, (ULONG)this) != 0) 72 { 73 dprintf(("Win32Window::Init HMHandleAllocate failed!!")); 74 DebugInt3(); 71 72 //CB: what does this code? Win32Hwnd is always 0! 73 if(HMHandleAllocate(&Win32Hwnd, (ULONG)this) != 0) 74 { 75 dprintf(("Win32Window::Init HMHandleAllocate failed!!")); 76 DebugInt3(); 75 77 } 76 78 posx = posy = 0; … … 78 80 79 81 dwExStyle = 0; 80 dwStyle 82 dwStyle = 0; 81 83 win32wndproc = 0; 82 84 hInstance = 0; 83 85 parent = 0; 84 windowId = 0xFFFFFFFF; 86 windowId = 0xFFFFFFFF; //default = -1 85 87 userData = 0; 86 88 … … 95 97 { 96 98 if(Win32Hwnd) 97 99 HMHandleFree(Win32Hwnd); 98 100 if(windowName) 99 101 free(windowName); 100 102 if(windowText) 101 103 free(windowText); 102 104 if(userWindowLong) 103 105 free(userWindowLong); 104 106 } 105 107 //****************************************************************************** … … 109 111 char buffer[256]; 110 112 DWORD tmp; 111 INT sw = SW_SHOW; 113 INT sw = SW_SHOW; 112 114 POINT maxSize, maxPos, minTrack, maxTrack; 113 115 … … 117 119 if (cs->hwndParent) 118 120 { 119 121 /* Make sure parent is valid */ 120 122 if (!IsWindow( cs->hwndParent )) 121 123 { 122 123 124 125 126 } 127 else 124 dprintf(("Bad parent %04x\n", cs->hwndParent )); 125 SetLastError(ERROR_INVALID_PARAMETER); 126 return FALSE; 127 } 128 } 129 else 128 130 if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) { 129 131 dprintf(("No parent for child window\n" )); 130 132 SetLastError(ERROR_INVALID_PARAMETER); 131 133 return FALSE; /* WS_CHILD needs a parent, but WS_POPUP doesn't */ 132 134 } … … 141 143 } 142 144 143 /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX 144 * with an atom as the class name, put some programs expect to have a *REAL* string in 145 * lpszClass when the CREATESTRUCT is sent with WM_CREATE 145 /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX 146 * with an atom as the class name, put some programs expect to have a *REAL* string in 147 * lpszClass when the CREATESTRUCT is sent with WM_CREATE 146 148 */ 147 if (!HIWORD(cs->lpszClass) ) { 149 if (!HIWORD(cs->lpszClass) ) { 148 150 if (isUnicode) { 149 150 } 151 152 153 154 151 GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) ); 152 } 153 else { 154 GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) ); 155 } 156 cs->lpszClass = buffer; 155 157 } 156 158 … … 160 162 // PDB *pdb = PROCESS_Current(); 161 163 162 /* Never believe Microsoft's documentation... CreateWindowEx doc says 163 * that if an overlapped window is created with WS_VISIBLE style bit 164 /* Never believe Microsoft's documentation... CreateWindowEx doc says 165 * that if an overlapped window is created with WS_VISIBLE style bit 164 166 * set and the x parameter is set to CW_USEDEFAULT, the system ignores 165 167 * the y parameter. However, disassembling NT implementation (WIN32K.SYS) 166 168 * reveals that 167 169 * 168 * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16 169 * 2) it does not ignore the y parameter as the docs claim; instead, it 170 * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16 171 * 2) it does not ignore the y parameter as the docs claim; instead, it 170 172 * uses it as second parameter to ShowWindow() unless y is either 171 173 * CW_USEDEFAULT or CW_USEDEFAULT16. 172 * 174 * 173 175 * The fact that we didn't do 2) caused bogus windows pop up when wine 174 * was running apps that were using this obscure feature. Example - 175 * calc.exe that comes with Win98 (only Win98, it's different from 176 * was running apps that were using this obscure feature. Example - 177 * calc.exe that comes with Win98 (only Win98, it's different from 176 178 * the one that comes with Win95 and NT) 177 179 */ … … 212 214 nrUserWindowLong = windowClass->getExtraWndWords(); 213 215 if(nrUserWindowLong) { 214 215 216 userWindowLong = (ULONG *)malloc(nrUserWindowLong); 217 memset(userWindowLong, 0, nrUserWindowLong); 216 218 } 217 219 218 220 if ((cs->style & WS_CHILD) && cs->hwndParent) 219 221 { 220 221 222 223 224 225 222 if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR) 223 { 224 dprintf(("HMHandleTranslateToOS2 couldn't find parent window %x!!!", cs->hwndParent)); 225 return FALSE; 226 } 227 parent = (Win32Window *)tmp; 226 228 } 227 229 else 228 230 { 229 parent = NULL; 231 parent = NULL; //desktop 230 232 if (!cs->hwndParent) { 231 232 233 owner = NULL; 234 } 233 235 else 234 236 { 235 236 237 238 239 240 241 237 if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR) 238 { 239 dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent)); 240 return FALSE; 241 } 242 owner = (Win32Window *)tmp; 243 } 242 244 } 243 245 … … 256 258 if (!(cs->style & WS_CHILD)) 257 259 { 258 259 260 260 dwStyle |= WS_CLIPSIBLINGS; 261 if (!(cs->style & WS_POPUP)) 262 { 261 263 dwStyle |= WS_CAPTION; 262 264 flags |= WIN_NEED_SIZE; 263 265 } 264 266 } 265 267 if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME; … … 300 302 else 301 303 { 302 303 304 305 306 } 307 } 308 else 304 if (windowClass->getMenuNameA()) { 305 cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA()); 306 if (cs->hMenu) SetMenu( getWindowHandle(), cs->hMenu ); 307 } 308 } 309 } 310 else windowId = (UINT)cs->hMenu; 309 311 310 312 DWORD dwOSWinStyle, dwOSFrameStyle; … … 314 316 OS2Hwnd = OSLibWinCreateWindow((parent) ? parent->getOS2WindowHandle() : 0, 315 317 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName, 316 cs->x, cs->y, cs->cx, cs->cy, 317 318 cs->x, cs->y, cs->cx, cs->cy, 319 (owner) ? owner->getOS2WindowHandle() : 0, 318 320 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE); 319 321 320 322 if(OS2Hwnd == 0) { 321 322 323 dprintf(("Window creation failed!!")); 324 return FALSE; 323 325 } 324 326 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { 325 326 327 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd)); 328 return FALSE; 327 329 } 328 330 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) { 329 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd)); 330 return FALSE; 331 } 332 331 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd)); 332 return FALSE; 333 } 334 335 return TRUE; 333 336 } 334 337 /******************************************************************* … … 338 341 */ 339 342 void Win32Window::GetMinMaxInfo(POINT *maxSize, POINT *maxPos, 340 343 POINT *minTrack, POINT *maxTrack ) 341 344 { 342 345 MINMAXINFO MinMax; … … 378 381 lpPos = (LPINTERNALPOS)GetPropA( wndPtr->hwndSelf, atomInternalPos ); 379 382 if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) ) 380 383 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition ); 381 384 else 382 385 { … … 454 457 { 455 458 WORD fwSizeType = 0; 456 459 457 460 if(fMinimize) { 458 461 fwSizeType = SIZE_MINIMIZED; 459 462 } 460 463 else 461 464 if(fMaximize) { 462 463 } 464 else 465 fwSizeType = SIZE_MAXIMIZED; 466 } 467 else fwSizeType = SIZE_RESTORED; 465 468 466 469 return SendMessageA(WM_SIZE, fwSizeType, MAKELONG((USHORT)width, (USHORT)height)); … … 491 494 492 495 switch(msg) { 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 496 case BUTTON_LEFTDOWN: 497 win32msg = WM_LBUTTONDOWN; 498 break; 499 case BUTTON_LEFTUP: 500 win32msg = WM_LBUTTONUP; 501 break; 502 case BUTTON_LEFTDBLCLICK: 503 win32msg = WM_LBUTTONDBLCLK; 504 break; 505 case BUTTON_RIGHTUP: 506 win32msg = WM_RBUTTONUP; 507 break; 508 case BUTTON_RIGHTDOWN: 509 win32msg = WM_RBUTTONDOWN; 510 break; 511 case BUTTON_RIGHTDBLCLICK: 512 win32msg = WM_RBUTTONDBLCLK; 513 break; 514 default: 515 dprintf(("Win32Window::Button: invalid msg!!!!")); 516 return 1; 514 517 } 515 518 return SendMessageA(win32msg, 0, MAKELONG(x, OS2TOWIN32POINT(height, y))); … … 532 535 { 533 536 if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE) 534 537 dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 535 538 536 539 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg … … 539 542 switch(Msg) 540 543 { 541 542 544 case WM_CREATE: 545 { 543 546 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) { 544 545 547 dprintf(("WM_NCCREATE returned FALSE\n")); 548 return(0); //don't create window 546 549 } 547 550 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) { 548 549 550 } 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 551 dprintf(("WM_CREATE returned FALSE\n")); 552 return(0); //don't create window 553 } 554 NotifyParent(Msg, wParam, lParam); 555 556 return(1); 557 } 558 case WM_LBUTTONDOWN: 559 case WM_MBUTTONDOWN: 560 case WM_RBUTTONDOWN: 561 NotifyParent(Msg, wParam, lParam); 562 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 563 564 case WM_DESTROY: 565 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0); 566 NotifyParent(Msg, wParam, lParam); 567 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0); 568 default: 569 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 567 570 } 568 571 } … … 574 577 Win32Window *parentwindow; 575 578 576 while(window) 579 while(window) 577 580 { 578 579 580 581 582 583 584 585 586 elseparentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );587 588 589 elsebreak;590 591 581 if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) ) 582 { 583 /* Notify the parent window only */ 584 parentwindow = window->getParent(); 585 if(parentwindow) { 586 if(Msg == WM_CREATE || Msg == WM_DESTROY) { 587 parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle()); 588 } 589 else parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam ); 590 } 591 } 592 else break; 593 594 window = parentwindow; 592 595 } 593 596 } … … 599 602 600 603 switch(index) { 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 elseoldval = 0;625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 604 case GWL_EXSTYLE: 605 oldval = dwExStyle; 606 dwExStyle = value; 607 return oldval; 608 case GWL_STYLE: 609 oldval = dwStyle; 610 dwStyle = value; 611 return oldval; 612 case GWL_WNDPROC: 613 oldval = (LONG)getWindowProc(); 614 setWindowProc((WNDPROC)value); 615 return oldval; 616 case GWL_HINSTANCE: 617 oldval = hInstance; 618 hInstance = value; 619 return oldval; 620 case GWL_HWNDPARENT: 621 { 622 ULONG tmp; 623 624 if(getParent()) { 625 oldval = getParent()->getWindowHandle(); 626 } 627 else oldval = 0; 628 629 if(value == 0) {//desktop window = parent 630 setParent(NULL); 631 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP); 632 return oldval; 633 } 634 if(HMHandleTranslateToOS2(value, &tmp) == NO_ERROR) 635 { 636 setParent((Win32Window *)tmp); 637 OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle()); 638 return oldval; 639 } 640 SetLastError(ERROR_INVALID_PARAMETER); 641 return 0; 642 } 643 case GWL_ID: 644 oldval = getWindowId(); 645 setWindowId(value); 646 return oldval; 647 case GWL_USERDATA: 648 oldval = userData; 649 userData = value; 650 return oldval; 651 default: 652 if(index >= 0 && index/4 < nrUserWindowLong) 653 { 654 oldval = userWindowLong[index/4]; 655 userWindowLong[index/4] = value; 656 return oldval; 657 } 658 SetLastError(ERROR_INVALID_PARAMETER); 659 return 0; 657 660 } 658 661 } … … 662 665 { 663 666 switch(index) { 664 665 666 667 668 669 670 671 672 673 674 675 676 elsereturn 0;677 678 679 680 681 682 683 684 685 686 687 667 case GWL_EXSTYLE: 668 return dwExStyle; 669 case GWL_STYLE: 670 return dwStyle; 671 case GWL_WNDPROC: 672 return (ULONG)getWindowProc(); 673 case GWL_HINSTANCE: 674 return hInstance; 675 case GWL_HWNDPARENT: 676 if(getParent()) { 677 return getParent()->getWindowHandle(); 678 } 679 else return 0; 680 case GWL_ID: 681 return getWindowId(); 682 case GWL_USERDATA: 683 return userData; 684 default: 685 if(index >= 0 && index/4 < nrUserWindowLong) 686 { 687 return userWindowLong[index/4]; 688 } 689 SetLastError(ERROR_INVALID_PARAMETER); 690 return 0; 688 691 } 689 692 } … … 696 699 if(index >= 0 && index/4 < nrUserWindowLong) 697 700 { 698 699 700 701 oldval = ((WORD *)userWindowLong)[index/2]; 702 ((WORD *)userWindowLong)[index/2] = value; 703 return oldval; 701 704 } 702 705 SetLastError(ERROR_INVALID_PARAMETER); … … 709 712 if(index >= 0 && index/4 < nrUserWindowLong) 710 713 { 711 714 return ((WORD *)userWindowLong)[index/2]; 712 715 } 713 716 SetLastError(ERROR_INVALID_PARAMETER); -
trunk/src/user32/new/window.cpp
r300 r304 1 /* $Id: window.cpp,v 1. 1 1999-07-14 08:35:37 sandervlExp $ */1 /* $Id: window.cpp,v 1.2 1999-07-14 21:05:59 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 37 37 dprintf(("CreateWindowEx32A: bad class name ")); 38 38 if (!HIWORD(className)) { 39 40 41 else 42 39 dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className))); 40 } 41 else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className )); 42 SetLastError(ERROR_INVALID_PARAMETER); 43 43 return 0; 44 44 } … … 58 58 cs.dwExStyle = exStyle; 59 59 window = new Win32Window( &cs, classAtom, FALSE ); 60 if(window == NULL) 60 if(window == NULL) 61 61 { 62 63 62 dprintf(("Win32Window creation failed!!")); 63 return 0; 64 64 } 65 65 if(GetLastError() != 0) 66 66 { 67 delete window; 68 return 0; 67 dprintf(("Win32Window error found!!")); 68 delete window; 69 return 0; 69 70 } 70 71 return window->getWindowHandle(); -
trunk/src/user32/new/windowclass.cpp
r300 r304 1 /* $Id: windowclass.cpp,v 1. 1 1999-07-14 08:35:37 sandervlExp $ */1 /* $Id: windowclass.cpp,v 1.2 1999-07-14 21:05:59 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Class Code for OS/2 … … 37 37 Win32WndClass *wclass; 38 38 39 memcpy(&wc, lpWndClass, sizeof(WNDCLASSA)); 39 //CB: size new in ex structure 40 wc.cbSize = sizeof(wc); 41 memcpy(&wc.style, lpWndClass, sizeof(WNDCLASSA)); 40 42 wc.hIconSm = 0; 41 42 wclass = new Win32WndClass(&wc );43 44 wclass = new Win32WndClass(&wc,FALSE); 43 45 if(wclass == NULL) { 44 45 46 dprintf(("RegisterClassA wclass == NULL!")); 47 return(0); 46 48 } 47 49 return(wclass->getAtom()); … … 53 55 Win32WndClass *wclass; 54 56 55 wclass = new Win32WndClass((WNDCLASSEXA *)lpWndClass );57 wclass = new Win32WndClass((WNDCLASSEXA *)lpWndClass,FALSE); 56 58 if(wclass == NULL) { 57 58 59 dprintf(("RegisterClassExA wclass == NULL!")); 60 return(0); 59 61 } 60 62 return(wclass->getAtom()); 61 63 } 62 64 //****************************************************************************** 65 //CB: update to unicode! 63 66 //****************************************************************************** 64 67 WORD WIN32API RegisterClassW(CONST WNDCLASSW *lpwc) … … 68 71 69 72 dprintf(("RegisterClassW\n")); 70 memcpy(&wclass, lpwc, sizeof(WNDCLASSA)); 73 //CB: size new in ex structure 74 wclass.cbSize = sizeof(wclass); 75 memcpy(&wclass.style, lpwc, sizeof(WNDCLASSA)); 71 76 if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) { 72 77 wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName); 73 78 } 74 79 if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) { 75 80 wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName); 76 81 } 77 82 rc = RegisterClassA((CONST WNDCLASSA *)&wclass); 78 83 79 84 if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) { 80 85 FreeAsciiString((char *)wclass.lpszMenuName); 81 86 } 82 87 if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) { 83 88 FreeAsciiString((char *)wclass.lpszClassName); 84 89 } 85 90 return(rc); 86 91 } 87 92 //****************************************************************************** 93 //CB: update to unicode! 88 94 //****************************************************************************** 89 95 ATOM WIN32API RegisterClassExW(CONST WNDCLASSEXW *lpwc) … … 95 101 memcpy(&wclass, lpwc, sizeof(WNDCLASSEXA)); 96 102 if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) { 97 103 wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName); 98 104 } 99 105 if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) { 100 106 wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName); 101 107 } 102 108 rc = RegisterClassExA((CONST WNDCLASSEXA *)&wclass); 103 109 104 110 if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) { 105 111 FreeAsciiString((char *)wclass.lpszMenuName); 106 112 } 107 113 if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) { 108 114 FreeAsciiString((char *)wclass.lpszClassName); 109 115 } 110 116 return(rc); … … 121 127 } 122 128 //****************************************************************************** 129 //CB:update to unicode! 123 130 //****************************************************************************** 124 131 BOOL WIN32API UnregisterClassW(LPCWSTR lpszClassName, HINSTANCE hinst) … … 128 135 dprintf(("USER32: UnregisterClassW\n")); 129 136 if((ULONG)lpszClassName >> 16 != 0) { 130 131 } 132 else 137 astring = UnicodeToAsciiString((LPWSTR)lpszClassName); 138 } 139 else astring = (char *)lpszClassName; 133 140 134 141 Win32WndClass::UnregisterClassA(hinst, (LPSTR)astring); 135 if((ULONG)astring >> 16 != 0) 136 142 if((ULONG)astring >> 16 != 0) 143 FreeAsciiString((char *)astring); 137 144 //Spintest returns FALSE in dll termination, so pretend it succeeded 138 145 return(TRUE); … … 150 157 wndclass = Win32WndClass::FindClass(hInstance, (LPSTR)lpszClass); 151 158 if(wndclass) { 152 wndclass->getClassInfo(&wc); 153 memcpy(lpwc, &wc, sizeof(WNDCLASSA)); 154 return(TRUE); 155 } 156 return(FALSE); 157 } 158 //****************************************************************************** 159 wndclass->getClassInfo(&wc); 160 memcpy(lpwc, &wc, sizeof(WNDCLASSA)); 161 return(TRUE); 162 } 163 return(FALSE); 164 } 165 //****************************************************************************** 166 //CB: update to unicode! 159 167 //****************************************************************************** 160 168 BOOL WIN32API GetClassInfoW(HINSTANCE hinst, LPCWSTR lpszClass, WNDCLASSW *lpwc) … … 168 176 169 177 if((ULONG)lpszClass >> 16 != 0) { 170 178 astring = UnicodeToAsciiString((LPWSTR)lpszClass); 171 179 } 172 180 else astring = (char *)lpszClass; 173 181 174 182 wndclass = Win32WndClass::FindClass(hinst, astring); 175 if((ULONG)astring >> 16 != 0) 176 183 if((ULONG)astring >> 16 != 0) 184 FreeAsciiString((char *)astring); 177 185 if(wndclass) { 178 179 180 181 } 182 return(FALSE); 186 wndclass->getClassInfo(&wc); 187 memcpy(lpwc, &wc, sizeof(WNDCLASSW)); 188 return(TRUE); 189 } 190 return(FALSE); 183 191 } 184 192 /**************************************************************************** … … 203 211 BOOL rc; 204 212 Win32WndClass *wndclass; 205 213 206 214 dprintf(("USER32:GetClassInfoExA (%08xh,%x,%08x).\n", 207 215 hInstance, 208 216 lpszClass, 209 217 lpwcx)); 210 218 211 219 wndclass = Win32WndClass::FindClass(hInstance, (LPSTR)lpszClass); 212 220 if(wndclass) { 213 214 215 } 216 return(FALSE); 221 wndclass->getClassInfo(lpwcx); 222 return(TRUE); 223 } 224 return(FALSE); 217 225 } 218 226 /***************************************************************************** … … 243 251 244 252 if((ULONG)lpszClass >> 16 != 0) { 245 253 astring = UnicodeToAsciiString((LPWSTR)lpszClass); 246 254 } 247 255 else astring = (char *)lpszClass; 248 256 249 257 wndclass = Win32WndClass::FindClass(hInstance, astring); 250 if((ULONG)astring >> 16 != 0) 251 258 if((ULONG)astring >> 16 != 0) 259 FreeAsciiString((char *)astring); 252 260 if(wndclass) { 253 254 255 } 256 return(FALSE); 261 wndclass->getClassInfo(lpwcx); 262 return(TRUE); 263 } 264 return(FALSE); 257 265 } 258 266 //****************************************************************************** … … 265 273 wnd = WIN2OS2HWND(hwnd); 266 274 if(wnd == NULL) { 267 268 275 dprintf(("GetClassNameA wnd == NULL")); 276 return(0); 269 277 } 270 278 return (wnd->getClass())->getClassName(lpszClassName, cchClassName); … … 279 287 wnd = WIN2OS2HWND(hwnd); 280 288 if(wnd == NULL) { 281 282 289 dprintf(("GetClassNameA wnd == NULL")); 290 return(0); 283 291 } 284 292 return (wnd->getClass())->getClassName(lpszClassName, cchClassName); … … 293 301 wnd = WIN2OS2HWND(hwnd); 294 302 if(wnd == NULL) { 295 296 303 dprintf(("SetClassLongA wnd == NULL")); 304 return(0); 297 305 } 298 306 return (wnd->getClass())->setClassLongA(nIndex, lNewVal); … … 307 315 wnd = WIN2OS2HWND(hwnd); 308 316 if(wnd == NULL) { 309 310 317 dprintf(("SetClassLongW wnd == NULL")); 318 return(0); 311 319 } 312 320 return (wnd->getClass())->setClassLongW(nIndex, lNewVal); … … 321 329 wnd = WIN2OS2HWND(hwnd); 322 330 if(wnd == NULL) { 323 324 331 dprintf(("SetClassWordA wnd == NULL")); 332 return(0); 325 333 } 326 334 return (wnd->getClass())->setClassWord(nIndex, wNewVal); … … 335 343 wnd = WIN2OS2HWND(hwnd); 336 344 if(wnd == NULL) { 337 338 345 dprintf(("GetClassWordA wnd == NULL")); 346 return(0); 339 347 } 340 348 return (wnd->getClass())->getClassWord(nIndex); … … 349 357 wnd = WIN2OS2HWND(hwnd); 350 358 if(wnd == NULL) { 351 352 359 dprintf(("GetClassLongA wnd == NULL")); 360 return(0); 353 361 } 354 362 return (wnd->getClass())->getClassLongA(nIndex); … … 363 371 wnd = WIN2OS2HWND(hwnd); 364 372 if(wnd == NULL) { 365 366 373 dprintf(("GetClassLongW wnd == NULL")); 374 return(0); 367 375 } 368 376 return (wnd->getClass())->getClassLongW(nIndex); -
trunk/src/user32/new/windowmsg.cpp
r300 r304 1 /* $Id: windowmsg.cpp,v 1. 1 1999-07-14 08:35:37 sandervlExp $ */1 /* $Id: windowmsg.cpp,v 1.2 1999-07-14 21:05:59 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 37 37 dprintf(("USER32: PostQuitMessage\n")); 38 38 39 O32_PostQuitMessage( arg1);39 O32_PostQuitMessage(nExitCode); 40 40 } 41 41 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.