- Timestamp:
- Jul 14, 1999, 11:05:59 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 9 edited
-
initterm.cpp (modified) (4 diffs)
-
menu.cpp (modified) (8 diffs)
-
oslibwin.cpp (modified) (6 diffs)
-
pmwindow.cpp (modified) (14 diffs)
-
win32class.cpp (modified) (17 diffs)
-
win32wnd.cpp (modified) (25 diffs)
-
window.cpp (modified) (3 diffs)
-
windowclass.cpp (modified) (19 diffs)
-
windowmsg.cpp (modified) (2 diffs)
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> //Odin32 OS/2 api wrappers29 #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 _ctordtorInit();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 return 0UL;107 return 0UL; 108 108 109 109 rc = DosExitList(0x00008000|EXLST_ADD, cleanupQueue); 110 110 if(rc) 111 return 0UL;111 return 0UL; 112 112 113 113 //SvL: 18-7-'98, Register system window classes (button, listbox etc etc) 114 RegisterSystemClasses(hModule);114 RegisterSystemClasses(hModule); 115 115 116 //SvL: Try to start communication with our message spy queue server117 InitSpyQueue();116 //SvL: Try to start communication with our message spy queue server 117 InitSpyQueue(); 118 118 119 //SvL: Init win32 PM classes120 if(InitPM() == FALSE) {121 return 0UL;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 dprintf(("USER32: OS2GetMenuStringW %s\n", astring));91 AsciiToUnicode(astring, lpsz);91 dprintf(("USER32: OS2GetMenuStringW %s\n", astring)); 92 AsciiToUnicode(astring, lpsz); 92 93 } 93 else lpsz[0] = 0;94 else lpsz[0] = 0; 94 95 return(rc); 95 96 } … … 158 159 #endif 159 160 if(lpPM->cbSize != 0) 160 rect = &lpPM->rcExclude;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 LPCSTR lpNewItem)168 LPCSTR lpNewItem) 168 169 { 169 170 #ifdef DEBUG … … 173 174 174 175 if(uFlags & MF_STRING || uFlags == 0) 175 WriteLog("USER32: OS2AppendMenuA %s\n", lpNewItem);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 UINT idCheck, UINT uFlags)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 const MENUITEMINFOA * lpMenuItemInfo)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 hwndParent = HWND_DESKTOP;26 hwndParent = HWND_DESKTOP; 27 27 } 28 28 … … 40 40 41 41 if(hwndParent == 0) { 42 hwndParent = HWND_DESKTOP;42 hwndParent = HWND_DESKTOP; 43 43 } 44 44 if(WinQueryWindowRect(hwndParent, &rectl) == 0) { 45 y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y);45 y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y); 46 46 } 47 47 if(dwFrameStyle) { 48 dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs49 hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,50 &dwFrameStyle, WIN32_STDCLASS,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 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);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 return hwndFrame;60 }61 return 0;59 return hwndFrame; 60 } 61 return 0; 62 62 } 63 else return WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, x, y, cx, cy,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 *OSWinStyle |= WS_MINIMIZED;76 *OSWinStyle |= WS_MINIMIZED; 77 77 if(dwStyle & WINWS_VISIBLE) 78 *OSWinStyle |= WS_VISIBLE;78 *OSWinStyle |= WS_VISIBLE; 79 79 if(dwStyle & WINWS_DISABLED) 80 *OSWinStyle |= WS_DISABLED;80 *OSWinStyle |= WS_DISABLED; 81 81 if(dwStyle & WINWS_CLIPSIBLINGS) 82 *OSWinStyle |= WS_CLIPSIBLINGS;82 *OSWinStyle |= WS_CLIPSIBLINGS; 83 83 if(dwStyle & WINWS_CLIPCHILDREN) 84 *OSWinStyle |= WS_CLIPCHILDREN;84 *OSWinStyle |= WS_CLIPCHILDREN; 85 85 if(dwStyle & WINWS_MAXIMIZE) 86 *OSWinStyle |= WS_MAXIMIZED;86 *OSWinStyle |= WS_MAXIMIZED; 87 87 if(dwStyle & WINWS_GROUP) 88 *OSWinStyle |= WS_GROUP;88 *OSWinStyle |= WS_GROUP; 89 89 if(dwStyle & WINWS_TABSTOP) 90 *OSWinStyle |= WS_TABSTOP;90 *OSWinStyle |= WS_TABSTOP; 91 91 92 92 if(dwStyle & WINWS_CAPTION) 93 *OSFrameStyle |= FCF_TITLEBAR;93 *OSFrameStyle |= FCF_TITLEBAR; 94 94 if(dwStyle & WINWS_BORDER) 95 *OSFrameStyle |= FCF_BORDER;95 *OSFrameStyle |= FCF_BORDER; 96 96 if(dwStyle & WINWS_DLGFRAME) 97 *OSFrameStyle |= FCF_DLGBORDER;97 *OSFrameStyle |= FCF_DLGBORDER; 98 98 if(dwStyle & WINWS_VSCROLL) 99 *OSFrameStyle |= FCF_VERTSCROLL;99 *OSFrameStyle |= FCF_VERTSCROLL; 100 100 if(dwStyle & WINWS_HSCROLL) 101 *OSFrameStyle |= FCF_HORZSCROLL;101 *OSFrameStyle |= FCF_HORZSCROLL; 102 102 if(dwStyle & WINWS_SYSMENU) 103 *OSFrameStyle |= FCF_SYSMENU;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 *OSFrameStyle |= FCF_MINBUTTON;107 *OSFrameStyle |= FCF_MINBUTTON; 108 108 if(dwStyle & WINWS_MAXIMIZEBOX) 109 *OSFrameStyle |= FCF_MAXBUTTON;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 dprintf(("WinRegisterClass Win32Window failed"));49 return(FALSE);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 dprintf(("Invalid win32wnd pointer for window %x!!", hwnd));71 goto RunDefWndProc;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 //Processing is done in after WinCreateWindow returns77 break;78 87 //Processing is done in after WinCreateWindow returns 88 break; 89 79 90 case WM_QUIT: 80 if(win32wnd->MsgQuit()) {81 goto RunDefWndProc;82 }83 break;84 91 if(win32wnd->MsgQuit()) { 92 goto RunDefWndProc; 93 } 94 break; 95 85 96 case WM_CLOSE: 86 if(win32wnd->MsgClose()) {87 goto RunDefWndProc;88 }89 break;97 if(win32wnd->MsgClose()) { 98 goto RunDefWndProc; 99 } 100 break; 90 101 91 102 case WM_DESTROY: 92 if(win32wnd->MsgDestroy()) {93 goto RunDefWndProc;94 }95 break;103 if(win32wnd->MsgDestroy()) { 104 goto RunDefWndProc; 105 } 106 break; 96 107 97 108 case WM_ENABLE: 98 if(win32wnd->MsgEnable((ULONG)mp1)) {99 goto RunDefWndProc;100 }101 break;109 if(win32wnd->MsgEnable((ULONG)mp1)) { 110 goto RunDefWndProc; 111 } 112 break; 102 113 103 114 case WM_SHOW: 104 if(win32wnd->MsgShow((ULONG)mp1)) {105 goto RunDefWndProc;106 }107 break;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 rc = WinQueryWindowRect(hwnd, &rectl);117 if(rc == TRUE) {118 point.x = rectl.xLeft;119 point.y = rectl.yBottom;120 121 //If the window has a parent, calculate position relative to that window122 if((hwndParent = WinQueryWindow(hwnd, QW_PARENT)) != WinQueryDesktopWindow(hab, NULLHANDLE)) {123 rc = WinMapWindowPoints(hwnd, hwndParent, &point, 1);124 if(rc == FALSE) {125 dprintf(("WM_MOVE: WinMapWindowPoints (parent) failed!"));126 break;127 }128 rc = WinQueryWindowRect(hwndParent, &rectl2);129 if(rc == FALSE) {130 dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!"));131 break;132 }133 yParent = point.x;134 yParent = OS2TOWIN32POINT(rectl2.yTop - rectl2.yBottom, point.y);135 }136 elsexParent = yParent = -1;137 138 point.x = rectl.xLeft;139 point.y = rectl.yBottom;140 141 rc = WinMapWindowPoints(hwnd, HWND_DESKTOP, &point, 1);142 if(rc == FALSE) {143 dprintf(("WM_MOVE: WinMapWindowPoints (desktop) failed!"));144 break;145 }146 rc = WinQueryWindowRect(HWND_DESKTOP, &rectl);147 if(rc == FALSE) {148 dprintf(("WM_MOVE: WinQueryWindowRect(HWND_DESKTOP, &rectl) failed!"));149 break;150 }151 xScreen = point.x;152 yScreen = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, point.y);153 154 if(win32wnd->MsgMove(xScreen, yScreen, xParent, yParent)) {155 goto RunDefWndProc;156 }157 }158 else {159 dprintf(("WM_MOVE: WinQueryWindowRect failed!"));160 }161 break;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 break;177 break; 167 178 } 168 179 169 180 case WM_ADJUSTWINDOWPOS: 170 181 { 171 // if(win32wnd->MsgWindowPosChanging(0, 0)) {172 break;182 // if(win32wnd->MsgWindowPosChanging(0, 0)) { 183 break; 173 184 } 174 185 … … 177 188 HPS hps; 178 189 179 hps = WinGetPS(hwnd);180 if(win32wnd->MsgEraseBackGround((ULONG)hps))190 hps = WinGetPS(hwnd); 191 if(win32wnd->MsgEraseBackGround((ULONG)hps)) 181 192 { 182 /*183 * Return TRUE to request PM to paint the window background184 * in SYSCLR_WINDOW.185 */186 WinReleasePS(hps);187 return (MRESULT)( TRUE );188 }189 WinReleasePS(hps);190 return (MRESULT) FALSE;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 rc = WinQueryWindowPos(hwnd, &swp);197 if(rc == FALSE) {198 dprintf(("WM_SIZE: WinQueryWindowPos failed!"));199 break;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 goto RunDefWndProc;206 }207 208 break;216 goto RunDefWndProc; 217 } 218 219 break; 209 220 } 210 221 … … 213 224 HWND hwndActivate = (HWND)mp1; 214 225 215 if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {216 //another (non-win32) application's window217 //set to NULL (allowed according to win32 SDK) to avoid problems218 hwndActivate = NULL;219 }220 if(win32wnd->MsgActivate(1, hwndActivate)) {221 goto RunDefWndProc;222 }223 break;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 break;237 break; 227 238 228 239 case WM_SETFOCUS: … … 230 241 HWND hwndFocus = (HWND)mp1; 231 242 232 if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {233 //another (non-win32) application's window234 //set to NULL (allowed according to win32 SDK) to avoid problems235 hwndFocus = NULL;236 }237 if((ULONG)mp2 == TRUE) {238 rc = win32wnd->MsgSetFocus(hwndFocus);239 }240 elserc = win32wnd->MsgKillFocus(hwndFocus);241 if(rc) {242 goto RunDefWndProc;243 }244 break;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 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {251 goto RunDefWndProc;252 }253 break;261 if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 262 goto RunDefWndProc; 263 } 264 break; 254 265 case WM_BUTTON1UP: 255 if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {256 goto RunDefWndProc;257 }258 break;266 if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 267 goto RunDefWndProc; 268 } 269 break; 259 270 case WM_BUTTON1DBLCLK: 260 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {261 goto RunDefWndProc;262 }263 break;271 if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 272 goto RunDefWndProc; 273 } 274 break; 264 275 case WM_BUTTON2DOWN: 265 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {266 goto RunDefWndProc;267 }268 break;276 if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 277 goto RunDefWndProc; 278 } 279 break; 269 280 case WM_BUTTON2UP: 270 if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {271 goto RunDefWndProc;272 }273 break;281 if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) { 282 goto RunDefWndProc; 283 } 284 break; 274 285 case WM_BUTTON2DBLCLK: 275 if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {276 goto RunDefWndProc;277 }278 break;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 break;302 break; 292 303 293 304 case WM_MOUSEMOVE: 294 break;305 break; 295 306 296 307 //************************************************************************** … … 298 309 //************************************************************************** 299 310 case WM_VSCROLL: 300 break;311 break; 301 312 case WM_HSCROLL: 302 break;313 break; 303 314 304 315 case WM_CONTROL: 305 break;316 break; 306 317 307 318 case WM_COMMAND: 308 319 case WM_SYSCOMMAND: 309 break;320 break; 310 321 311 322 case WM_CHAR: 312 break;323 break; 313 324 314 325 case WM_INITMENU: … … 316 327 case WM_MENUEND: 317 328 case WM_NEXTMENU: 318 break;329 break; 319 330 320 331 case WM_TIMER: 321 break;332 break; 322 333 323 334 case WM_PAINT: 324 if(win32wnd->MsgPaint(0, 0)) {325 goto RunDefWndProc;326 }327 break;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 break;342 break; 332 343 333 344 case WM_CALCVALIDRECTS: … … 353 364 case WM_SAVEAPPLICATION: 354 365 case WM_SEMANTICEVENT: 355 break;366 break; 356 367 default: 357 RestoreOS2TIB(); 358 return WinDefWindowProc( hwnd, msg, mp1, mp2 );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 classNameW = NULL;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 = wndclass->cbClsExtra;73 nrExtraWindowWords = wndclass->cbWndExtra;74 backgroundBrush = wndclass->hbrBackground;//TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL75 hCursor = wndclass->hCursor;76 hIcon = wndclass->hIcon;77 hInstance = wndclass->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 = wndclass->style;84 windowProc = wndclass->lpfnWndProc;87 windowStyle = wndclass->style; 88 windowProc = wndclass->lpfnWndProc; 85 89 86 90 //User data class words/longs 87 91 if(nrExtraClassWords) { 88 userClassLong = (ULONG *)malloc(nrExtraClassWords);89 if(userClassLong == NULL) {90 dprintf(("Win32Class ctr: userClassLong == NULL!"));91 exit(1);92 }93 memset(userClassLong, 0, nrExtraClassWords);94 } 95 else userClassLong = NULL;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) free(userClassLong);105 if(classNameA) free(classNameA);106 if(classNameW) free(classNameW);108 if(userClassLong) free(userClassLong); 109 if(classNameA) free(classNameA); 110 if(classNameW) free(classNameW); 107 111 if(menuNameA && HIWORD(menuNameA)) { 108 free(menuNameA);109 assert(menuNameW);110 free(menuNameW);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) return(NULL);123 if(wndclass == NULL) return(NULL); 120 124 121 125 if(HIWORD(id) != 0) { 122 if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {123 return(wndclass);124 }125 else {126 wndclass = (Win32WndClass *)wndclass->GetNext();127 while(wndclass != NULL) {128 if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {129 return(wndclass);130 }131 wndclass = (Win32WndClass *)wndclass->GetNext();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 if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {137 return(wndclass);138 }139 else {140 wndclass = (Win32WndClass *)wndclass->GetNext();141 while(wndclass != NULL) {142 if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {143 return(wndclass);144 }145 wndclass = (Win32WndClass *)wndclass->GetNext();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 = 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 = windowStyle;165 wndclass->lpfnWndProc = windowProc;166 wndclass->hIconSm = 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 = 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 = windowStyle;182 wndclass->lpfnWndProc = windowProc;183 wndclass->hIconSm = 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 strncpy(lpszClassName, classNameA, cchClassName-1);192 return strlen(lpszClassName);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 lstrcpyW(lpszClassName, classNameW);205 return lstrlenW(lpszClassName)*sizeof(WCHAR);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 free(menuNameA);216 free(menuNameW);217 menuNameA = 0;219 free(menuNameA); 220 free(menuNameW); 221 menuNameA = 0; 218 222 menuNameW = 0; 219 223 } 220 224 if(HIWORD(newMenuName)) { 221 if(isUnicode) {222 menuNameA = (PCHAR)malloc(lstrlenW((LPWSTR)newMenuName)+1);223 menuNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)newMenuName)+1)*sizeof(WCHAR));224 }225 else {226 menuNameA = (PCHAR)malloc(strlen(newMenuName)+1);227 menuNameW = (WCHAR *)malloc((strlen(newMenuName)+1)*sizeof(WCHAR));228 }229 if(menuNameA == NULL || menuNameW == NULL) {230 dprintf(("Win32Class ctr; menuName/menuNameW == NULL"));231 exit(1);232 }233 if(isUnicode) {234 lstrcpyW(menuNameW, (LPWSTR)newMenuName);235 UnicodeToAscii(menuNameW, menuNameA);236 }237 else {238 strcpy((char *)menuNameA, newMenuName);239 AsciiToUnicode(menuNameA, menuNameW);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 menuNameA = (PCHAR)newMenuName;244 menuNameW = (WCHAR *)newMenuName;247 menuNameA = (PCHAR)newMenuName; 248 menuNameW = (WCHAR *)newMenuName; 245 249 } 246 250 } … … 250 254 { 251 255 switch(index) { 252 case GCL_CBCLSEXTRA:253 return nrExtraClassWords;254 case GCL_CBWNDEXTRA:255 return nrExtraWindowWords;256 case GCL_HBRBACKGROUND:257 return backgroundBrush;258 case GCL_HCURSOR:259 return hCursor;260 case GCL_HICON:261 return hIcon;262 case GCL_HMODULE:263 return hInstance;264 case GCL_MENUNAME:265 return (isUnicode) ? (ULONG)menuNameW : (ULONG)menuNameA;266 case GCL_STYLE:267 return windowStyle;268 case GCL_WNDPROC:269 return (ULONG)windowProc;270 case GCW_ATOM: //TODO: does this really happen in windows?271 SetLastError(ERROR_INVALID_PARAMETER);272 return 0;273 default:274 if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {275 return userClassLong[index];276 }277 SetLastError(ERROR_INVALID_PARAMETER);278 return 0;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 return (WORD)classAtom;288 default:289 if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) {290 return ((WORD *)userClassLong)[index];291 }292 SetLastError(ERROR_INVALID_PARAMETER);293 return 0;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 case GCL_CBCLSEXTRA: //TODO (doesn't affect allocated classes, so what does it do?)305 rc = nrExtraClassWords;306 // nrExtraClassWords = lNewVal;307 break;308 case GCL_CBWNDEXTRA:309 rc = nrExtraWindowWords;310 nrExtraWindowWords = lNewVal;311 break;312 case GCL_HBRBACKGROUND:313 rc = backgroundBrush;314 backgroundBrush = lNewVal;315 break;316 case GCL_HCURSOR:317 rc = hCursor;318 hCursor = lNewVal;319 break;320 case GCL_HICON:321 rc = hIcon;322 hIcon = lNewVal;323 break;324 case GCL_HMODULE:325 rc = hInstance;326 hInstance = lNewVal;327 break;328 case GCL_MENUNAME:329 rc = 0;//old value is meaningless (according to Wine)330 setMenuName((LPSTR)lNewVal);331 break;332 case GCL_STYLE:333 rc = windowStyle;334 windowStyle = lNewVal;335 break;336 case GCL_WNDPROC:337 rc = (ULONG)windowProc;338 windowProc = (WNDPROC)lNewVal;339 break;340 case GCW_ATOM: //TODO: does this really happen in windows?341 SetLastError(ERROR_INVALID_PARAMETER);342 return 0;343 default:344 if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {345 rc = userClassLong[index];346 userClassLong[index] = lNewVal;347 return(rc);348 }349 SetLastError(ERROR_INVALID_PARAMETER);350 return 0;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 rc = (WORD)classAtom;363 classAtom = wNewVal;364 return(rc);365 default:366 if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) {367 rc = ((WORD *)userClassLong)[index];368 ((WORD *)userClassLong)[index] = wNewVal;369 return(rc);370 }371 SetLastError(ERROR_INVALID_PARAMETER);372 return 0;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 delete wndclass;386 return;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 : GenericObject(&windows, OBJTYPE_WINDOW)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 = 0;82 dwStyle = 0; 81 83 win32wndproc = 0; 82 84 hInstance = 0; 83 85 parent = 0; 84 windowId = 0xFFFFFFFF; //default = -186 windowId = 0xFFFFFFFF; //default = -1 85 87 userData = 0; 86 88 … … 95 97 { 96 98 if(Win32Hwnd) 97 HMHandleFree(Win32Hwnd);99 HMHandleFree(Win32Hwnd); 98 100 if(windowName) 99 free(windowName);101 free(windowName); 100 102 if(windowText) 101 free(windowText);103 free(windowText); 102 104 if(userWindowLong) 103 free(userWindowLong);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 /* Make sure parent is valid */121 /* Make sure parent is valid */ 120 122 if (!IsWindow( cs->hwndParent )) 121 123 { 122 dprintf(("Bad parent %04x\n", cs->hwndParent ));123 SetLastError(ERROR_INVALID_PARAMETER);124 return FALSE;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 SetLastError(ERROR_INVALID_PARAMETER);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 GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );150 } 151 else {152 GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );153 }154 cs->lpszClass = buffer;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 userWindowLong = (ULONG *)malloc(nrUserWindowLong);215 memset(userWindowLong, 0, nrUserWindowLong);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 if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR)221 {222 dprintf(("HMHandleTranslateToOS2 couldn't find parent window %x!!!", cs->hwndParent));223 return FALSE;224 }225 parent = (Win32Window *)tmp;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; //desktop231 parent = NULL; //desktop 230 232 if (!cs->hwndParent) { 231 owner = NULL;232 }233 owner = NULL; 234 } 233 235 else 234 236 { 235 if(HMHandleTranslateToOS2(cs->hwndParent, &tmp) != NO_ERROR)236 {237 dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent));238 return FALSE;239 }240 owner = (Win32Window *)tmp;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 dwStyle |= WS_CLIPSIBLINGS;259 if (!(cs->style & WS_POPUP))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 if (windowClass->getMenuNameA()) {303 cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA());304 if (cs->hMenu) SetMenu( getWindowHandle(), cs->hMenu );305 }306 } 307 } 308 else windowId = (UINT)cs->hMenu;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 (owner) ? owner->getOS2WindowHandle() : 0,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 dprintf(("Window creation failed!!"));322 return FALSE;323 dprintf(("Window creation failed!!")); 324 return FALSE; 323 325 } 324 326 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { 325 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));326 return FALSE;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 POINT *minTrack, POINT *maxTrack )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 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );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 fwSizeType = SIZE_MINIMIZED;461 fwSizeType = SIZE_MINIMIZED; 459 462 } 460 463 else 461 464 if(fMaximize) { 462 fwSizeType = SIZE_MAXIMIZED;463 } 464 else fwSizeType = SIZE_RESTORED;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 case BUTTON_LEFTDOWN:494 win32msg = WM_LBUTTONDOWN;495 break;496 case BUTTON_LEFTUP:497 win32msg = WM_LBUTTONUP;498 break;499 case BUTTON_LEFTDBLCLICK:500 win32msg = WM_LBUTTONDBLCLK;501 break;502 case BUTTON_RIGHTUP:503 win32msg = WM_RBUTTONUP;504 break;505 case BUTTON_RIGHTDOWN:506 win32msg = WM_RBUTTONDOWN;507 break;508 case BUTTON_RIGHTDBLCLICK:509 win32msg = WM_RBUTTONDBLCLK;510 break;511 default:512 dprintf(("Win32Window::Button: invalid msg!!!!"));513 return 1;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 dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));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 case WM_CREATE:542 {544 case WM_CREATE: 545 { 543 546 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) { 544 dprintf(("WM_NCCREATE returned FALSE\n"));545 return(0); //don't create window547 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 dprintf(("WM_CREATE returned FALSE\n"));549 return(0); //don't create window550 } 551 NotifyParent(Msg, wParam, lParam);552 553 return(1);554 }555 case WM_LBUTTONDOWN:556 case WM_MBUTTONDOWN:557 case WM_RBUTTONDOWN:558 NotifyParent(Msg, wParam, lParam);559 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);560 561 case WM_DESTROY:562 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);563 NotifyParent(Msg, wParam, lParam);564 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);565 default:566 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);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 if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) )579 {580 /* Notify the parent window only */581 parentwindow = window->getParent();582 if(parentwindow) {583 if(Msg == WM_CREATE || Msg == WM_DESTROY) {584 parentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());585 }586 elseparentwindow->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );587 }588 }589 elsebreak;590 591 window = parentwindow;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 case GWL_EXSTYLE:602 oldval = dwExStyle;603 dwExStyle = value;604 return oldval;605 case GWL_STYLE:606 oldval = dwStyle;607 dwStyle = value;608 return oldval;609 case GWL_WNDPROC:610 oldval = (LONG)getWindowProc();611 setWindowProc((WNDPROC)value);612 return oldval;613 case GWL_HINSTANCE:614 oldval = hInstance;615 hInstance = value;616 return oldval;617 case GWL_HWNDPARENT:618 {619 ULONG tmp;620 621 if(getParent()) {622 oldval = getParent()->getWindowHandle();623 }624 elseoldval = 0;625 626 if(value == 0) {//desktop window = parent627 setParent(NULL);628 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);629 return oldval;630 }631 if(HMHandleTranslateToOS2(value, &tmp) == NO_ERROR)632 {633 setParent((Win32Window *)tmp);634 OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle());635 return oldval;636 }637 SetLastError(ERROR_INVALID_PARAMETER);638 return 0;639 }640 case GWL_ID:641 oldval = getWindowId();642 setWindowId(value);643 return oldval;644 case GWL_USERDATA:645 oldval = userData;646 userData = value;647 return oldval;648 default:649 if(index >= 0 && index/4 < nrUserWindowLong)650 {651 oldval = userWindowLong[index/4];652 userWindowLong[index/4] = value;653 return oldval;654 }655 SetLastError(ERROR_INVALID_PARAMETER);656 return 0;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 case GWL_EXSTYLE:665 return dwExStyle;666 case GWL_STYLE:667 return dwStyle;668 case GWL_WNDPROC:669 return (ULONG)getWindowProc();670 case GWL_HINSTANCE:671 return hInstance;672 case GWL_HWNDPARENT:673 if(getParent()) {674 return getParent()->getWindowHandle();675 }676 elsereturn 0;677 case GWL_ID:678 return getWindowId();679 case GWL_USERDATA:680 return userData;681 default:682 if(index >= 0 && index/4 < nrUserWindowLong)683 {684 return userWindowLong[index/4];685 }686 SetLastError(ERROR_INVALID_PARAMETER);687 return 0;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 oldval = ((WORD *)userWindowLong)[index/2];699 ((WORD *)userWindowLong)[index/2] = value;700 return oldval;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 return ((WORD *)userWindowLong)[index/2];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 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);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 dprintf(("Win32Window creation failed!!"));63 return 0;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 dprintf(("RegisterClassA wclass == NULL!"));45 return(0);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 dprintf(("RegisterClassExA wclass == NULL!"));58 return(0);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 wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);77 wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName); 73 78 } 74 79 if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) { 75 wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);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 FreeAsciiString((char *)wclass.lpszMenuName);85 FreeAsciiString((char *)wclass.lpszMenuName); 81 86 } 82 87 if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) { 83 FreeAsciiString((char *)wclass.lpszClassName);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 wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);103 wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName); 98 104 } 99 105 if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) { 100 wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);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 FreeAsciiString((char *)wclass.lpszMenuName);111 FreeAsciiString((char *)wclass.lpszMenuName); 106 112 } 107 113 if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) { 108 FreeAsciiString((char *)wclass.lpszClassName);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 astring = UnicodeToAsciiString((LPWSTR)lpszClassName);131 } 132 else astring = (char *)lpszClassName;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 FreeAsciiString((char *)astring);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 astring = UnicodeToAsciiString((LPWSTR)lpszClass);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 FreeAsciiString((char *)astring);183 if((ULONG)astring >> 16 != 0) 184 FreeAsciiString((char *)astring); 177 185 if(wndclass) { 178 wndclass->getClassInfo(&wc);179 memcpy(lpwc, &wc, sizeof(WNDCLASSW));180 return(TRUE);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 wndclass->getClassInfo(lpwcx);214 return(TRUE);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 astring = UnicodeToAsciiString((LPWSTR)lpszClass);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 FreeAsciiString((char *)astring);258 if((ULONG)astring >> 16 != 0) 259 FreeAsciiString((char *)astring); 252 260 if(wndclass) { 253 wndclass->getClassInfo(lpwcx);254 return(TRUE);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 dprintf(("GetClassNameA wnd == NULL"));268 return(0);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 dprintf(("GetClassNameA wnd == NULL"));282 return(0);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 dprintf(("SetClassLongA wnd == NULL"));296 return(0);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 dprintf(("SetClassLongW wnd == NULL"));310 return(0);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 dprintf(("SetClassWordA wnd == NULL"));324 return(0);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 dprintf(("GetClassWordA wnd == NULL"));338 return(0);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 dprintf(("GetClassLongA wnd == NULL"));352 return(0);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 dprintf(("GetClassLongW wnd == NULL"));366 return(0);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.
