Changeset 628
- Timestamp:
- Aug 22, 1999, 8:29:38 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 2 edited
-
oslibwin.cpp (modified) (10 diffs)
-
win32wnd.cpp (modified) (69 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/oslibwin.cpp
r601 r628 1 /* $Id: oslibwin.cpp,v 1.2 2 1999-08-20 20:09:51 sandervlExp $ */1 /* $Id: oslibwin.cpp,v 1.23 1999-08-22 18:29:37 dengert Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 31 31 if(hwndParent == OSLIB_HWND_DESKTOP) 32 32 { 33 hwndParent = HWND_DESKTOP;33 hwndParent = HWND_DESKTOP; 34 34 } 35 35 … … 39 39 //****************************************************************************** 40 40 HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle, 41 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame)41 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame) 42 42 { 43 43 HWND hwndClient; … … 46 46 47 47 if(pszName && *pszName == 0) { 48 pszName = NULL;48 pszName = NULL; 49 49 } 50 50 if(hwndParent == OSLIB_HWND_DESKTOP) { 51 hwndParent = HWND_DESKTOP;51 hwndParent = HWND_DESKTOP; 52 52 } 53 53 if(Owner == OSLIB_HWND_DESKTOP) { 54 Owner = HWND_DESKTOP;54 Owner = HWND_DESKTOP; 55 55 } 56 56 57 57 if(dwFrameStyle) { 58 dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs 59 if(pszName) 60 dwFrameStyle |= FCF_TITLEBAR; 61 62 dwFrameStyle |= FCF_TASKLIST; 63 *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle, 64 &dwFrameStyle, WIN32_STDCLASS, 65 "", 0, 0, 0, &hwndClient); 66 if(*hwndFrame) { 67 if(pszName) { 68 WinSetWindowText(*hwndFrame, pszName); 69 } 70 return hwndClient; 71 } 72 dprintf(("OSLibWinCreateWindow: WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB()))); 73 return 0; 58 ULONG dwClientStyle; 59 60 dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP); 61 if(pszName) 62 dwFrameStyle |= FCF_TITLEBAR; 63 64 dwFrameStyle |= FCF_TASKLIST; 65 *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle, 66 &dwFrameStyle, WIN32_STDCLASS, 67 "", dwClientStyle, 0, 0, &hwndClient); 68 if(*hwndFrame) { 69 if(pszName) { 70 WinSetWindowText(*hwndFrame, pszName); 71 } 72 return hwndClient; 73 } 74 dprintf(("OSLibWinCreateWindow: WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB()))); 75 return 0; 74 76 } 75 77 hwndClient = WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, 0, 0, 0, 0, 76 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL,77 NULL);78 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL, 79 NULL); 78 80 *hwndFrame = hwndClient; 79 81 return hwndClient; … … 83 85 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle) 84 86 { 85 *OSWinStyle = 0;87 *OSWinStyle = 0; 86 88 *OSFrameStyle = 0; 87 89 88 90 /* Window styles */ 89 91 if(dwStyle & WS_MINIMIZE_W) 90 *OSWinStyle |= WS_MINIMIZED;92 *OSWinStyle |= WS_MINIMIZED; 91 93 //Done explicitely in CreateWindowExA 92 94 #if 0 93 95 if(dwStyle & WS_VISIBLE_W) 94 *OSWinStyle |= WS_VISIBLE;96 *OSWinStyle |= WS_VISIBLE; 95 97 #endif 96 98 if(dwStyle & WS_DISABLED_W) 97 *OSWinStyle |= WS_DISABLED;99 *OSWinStyle |= WS_DISABLED; 98 100 if(dwStyle & WS_CLIPSIBLINGS_W) 99 *OSWinStyle |= WS_CLIPSIBLINGS;101 *OSWinStyle |= WS_CLIPSIBLINGS; 100 102 if(dwStyle & WS_CLIPCHILDREN_W) 101 *OSWinStyle |= WS_CLIPCHILDREN;103 *OSWinStyle |= WS_CLIPCHILDREN; 102 104 if(dwStyle & WS_MAXIMIZE_W) 103 *OSWinStyle |= WS_MAXIMIZED;105 *OSWinStyle |= WS_MAXIMIZED; 104 106 if(dwStyle & WS_GROUP_W) 105 *OSWinStyle |= WS_GROUP;107 *OSWinStyle |= WS_GROUP; 106 108 if(dwStyle & WS_TABSTOP_W) 107 *OSWinStyle |= WS_TABSTOP;109 *OSWinStyle |= WS_TABSTOP; 108 110 109 111 if(dwStyle & WS_CAPTION_W) 110 *OSFrameStyle |= FCF_TITLEBAR;112 *OSFrameStyle |= FCF_TITLEBAR; 111 113 if(dwStyle & WS_DLGFRAME_W) 112 *OSFrameStyle |= FCF_DLGBORDER;114 *OSFrameStyle |= FCF_DLGBORDER; 113 115 else 114 116 if(dwStyle & WS_BORDER_W) 115 *OSFrameStyle |= FCF_BORDER;117 *OSFrameStyle |= FCF_BORDER; 116 118 117 119 if(dwStyle & WS_VSCROLL_W) 118 *OSFrameStyle |= FCF_VERTSCROLL;120 *OSFrameStyle |= FCF_VERTSCROLL; 119 121 if(dwStyle & WS_HSCROLL_W) 120 *OSFrameStyle |= FCF_HORZSCROLL;122 *OSFrameStyle |= FCF_HORZSCROLL; 121 123 if(dwStyle & WS_SYSMENU_W) 122 *OSFrameStyle |= FCF_SYSMENU;124 *OSFrameStyle |= FCF_SYSMENU; 123 125 if(dwStyle & WS_THICKFRAME_W) 124 *OSFrameStyle |= FCF_SIZEBORDER;//??126 *OSFrameStyle |= FCF_SIZEBORDER; //?? 125 127 if(dwStyle & WS_MINIMIZEBOX_W) 126 *OSFrameStyle |= FCF_MINBUTTON;128 *OSFrameStyle |= FCF_MINBUTTON; 127 129 if(dwStyle & WS_MAXIMIZEBOX_W) 128 *OSFrameStyle |= FCF_MAXBUTTON;130 *OSFrameStyle |= FCF_MAXBUTTON; 129 131 130 132 if(dwExStyle & WS_EX_DLGMODALFRAME_W) 131 *OSFrameStyle |= FCF_DLGBORDER;133 *OSFrameStyle |= FCF_DLGBORDER; 132 134 133 135 return TRUE; … … 224 226 //****************************************************************************** 225 227 BOOL OSLibWinSetWindowPos(HWND hwnd, HWND hwndInsertBehind, LONG x, LONG y, LONG cx, 226 LONG cy, ULONG fl)228 LONG cy, ULONG fl) 227 229 { 228 230 HWND hwndParent = hwndInsertBehind; … … 230 232 231 233 if(fl & SWP_MOVE) { 232 switch(hwndParent)233 {234 case HWNDOS_TOP:235 case HWNDOS_BOTTOM:236 hwndParent = HWND_DESKTOP;237 break;238 }239 y = MapOS2ToWin32Y(hwndParent, cy, y);234 switch(hwndParent) 235 { 236 case HWNDOS_TOP: 237 case HWNDOS_BOTTOM: 238 hwndParent = HWND_DESKTOP; 239 break; 240 } 241 y = MapOS2ToWin32Y(hwndParent, cy, y); 240 242 } 241 243 rc = WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl); … … 250 252 251 253 if(fl & SWP_SHOW) { 252 rc = WinShowWindow(hwnd, TRUE);254 rc = WinShowWindow(hwnd, TRUE); 253 255 } 254 256 if(rc == 0) 255 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));257 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB()))); 256 258 rc = WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, fl); 257 259 if(rc == 0) 258 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));260 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB()))); 259 261 return rc; 260 262 } … … 269 271 BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo) 270 272 { 271 BOOL rc;273 BOOL rc; 272 274 RECTLOS2 rectl; 273 275 274 276 rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl); 275 277 if(rc) { 276 if(RelativeTo == RELATIVE_TO_SCREEN) {277 MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect);278 }279 elseMapOS2ToWin32Rectl(&rectl, pRect);280 } 281 else memset(pRect, 0, sizeof(RECT));278 if(RelativeTo == RELATIVE_TO_SCREEN) { 279 MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect); 280 } 281 else MapOS2ToWin32Rectl(&rectl, pRect); 282 } 283 else memset(pRect, 0, sizeof(RECT)); 282 284 return rc; 283 285 } … … 291 293 rc = WinQueryWindowPos(hwnd, &swp); 292 294 if(rc == FALSE) { 293 dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));294 return FALSE;295 dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd)); 296 return FALSE; 295 297 } 296 298 297 299 if(swp.fl & SWP_MINIMIZE) 298 return TRUE;299 else return FALSE;300 return TRUE; 301 else return FALSE; 300 302 } 301 303 //****************************************************************************** -
trunk/src/user32/new/win32wnd.cpp
r614 r628 1 /* $Id: win32wnd.cpp,v 1.2 7 1999-08-22 08:30:52 sandervlExp $ */1 /* $Id: win32wnd.cpp,v 1.28 1999-08-22 18:29:38 dengert Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 57 57 //****************************************************************************** 58 58 Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode) 59 : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow()59 : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow() 60 60 { 61 61 Init(); … … 67 67 void Win32Window::Init() 68 68 { 69 isUnicode = FALSE;70 fCreated = FALSE;71 fFirstShow = TRUE;69 isUnicode = FALSE; 70 fCreated = FALSE; 71 fFirstShow = TRUE; 72 72 73 73 memset(windowNameA, 0, MAX_WINDOW_NAMELENGTH); … … 78 78 nrUserWindowLong = 0; 79 79 80 magic = WIN32PM_MAGIC;81 OS2Hwnd = 0;82 OS2HwndFrame = 0;83 OS2HwndMenu = 0;84 Win32Hwnd = 0;80 magic = WIN32PM_MAGIC; 81 OS2Hwnd = 0; 82 OS2HwndFrame = 0; 83 OS2HwndMenu = 0; 84 Win32Hwnd = 0; 85 85 86 86 if(HMHandleAllocate(&Win32Hwnd, (ULONG)this) != 0) 87 87 { 88 dprintf(("Win32Window::Init HMHandleAllocate failed!!"));89 DebugInt3();90 } 91 Win32Hwnd &= 0xFFFF;92 Win32Hwnd |= 0x68000000;93 94 posx = posy = 0;88 dprintf(("Win32Window::Init HMHandleAllocate failed!!")); 89 DebugInt3(); 90 } 91 Win32Hwnd &= 0xFFFF; 92 Win32Hwnd |= 0x68000000; 93 94 posx = posy = 0; 95 95 width = height = 0; 96 96 97 dwExStyle = 0;98 dwStyle = 0;99 win32wndproc = 0;100 hInstance = 0;101 windowId = 0xFFFFFFFF;//default = -1102 userData = 0;97 dwExStyle = 0; 98 dwStyle = 0; 99 win32wndproc = 0; 100 hInstance = 0; 101 windowId = 0xFFFFFFFF; //default = -1 102 userData = 0; 103 103 104 104 hwndLinkAfter = HWND_BOTTOM; 105 flags = 0;106 isIcon = FALSE;105 flags = 0; 106 isIcon = FALSE; 107 107 lastHitTestVal = 0; 108 owner = NULL;109 windowClass = 0;108 owner = NULL; 109 windowClass = 0; 110 110 111 111 acceltableResource = NULL; 112 menuResource = NULL;113 iconResource = NULL;112 menuResource = NULL; 113 iconResource = NULL; 114 114 } 115 115 //****************************************************************************** … … 122 122 123 123 if(Win32Hwnd) 124 HMHandleFree(Win32Hwnd & 0xFFFF);124 HMHandleFree(Win32Hwnd & 0xFFFF); 125 125 if(userWindowLong) 126 free(userWindowLong);126 free(userWindowLong); 127 127 } 128 128 //****************************************************************************** … … 145 145 if (cs->hwndParent) 146 146 { 147 Win32Window *window = GetWindowFromHandle(cs->hwndParent);148 if(!window) {149 dprintf(("Bad parent %04x\n", cs->hwndParent ));150 SetLastError(ERROR_INVALID_PARAMETER);151 return FALSE;152 }153 /* Make sure parent is valid */154 if (!window->IsWindow() )155 {156 dprintf(("Bad parent %04x\n", cs->hwndParent ));157 SetLastError(ERROR_INVALID_PARAMETER);158 return FALSE;159 }147 Win32Window *window = GetWindowFromHandle(cs->hwndParent); 148 if(!window) { 149 dprintf(("Bad parent %04x\n", cs->hwndParent )); 150 SetLastError(ERROR_INVALID_PARAMETER); 151 return FALSE; 152 } 153 /* Make sure parent is valid */ 154 if (!window->IsWindow() ) 155 { 156 dprintf(("Bad parent %04x\n", cs->hwndParent )); 157 SetLastError(ERROR_INVALID_PARAMETER); 158 return FALSE; 159 } 160 160 } 161 161 else 162 162 if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) { 163 dprintf(("No parent for child window\n" ));164 SetLastError(ERROR_INVALID_PARAMETER);165 return FALSE; /* WS_CHILD needs a parent, but WS_POPUP doesn't */163 dprintf(("No parent for child window\n" )); 164 SetLastError(ERROR_INVALID_PARAMETER); 165 return FALSE; /* WS_CHILD needs a parent, but WS_POPUP doesn't */ 166 166 } 167 167 … … 170 170 if (!windowClass) 171 171 { 172 GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );173 dprintf(("Bad class '%s'\n", buffer ));174 return 0;172 GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) ); 173 dprintf(("Bad class '%s'\n", buffer )); 174 return 0; 175 175 } 176 176 … … 180 180 */ 181 181 if (!HIWORD(cs->lpszClass) ) { 182 if (isUnicode) {183 GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );184 }185 else {186 GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );187 }188 cs->lpszClass = buffer;182 if (isUnicode) { 183 GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) ); 184 } 185 else { 186 GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) ); 187 } 188 cs->lpszClass = buffer; 189 189 } 190 190 … … 192 192 if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16) 193 193 { 194 // PDB *pdb = PROCESS_Current();194 // PDB *pdb = PROCESS_Current(); 195 195 196 196 /* Never believe Microsoft's documentation... CreateWindowEx doc says 197 * that if an overlapped window is created with WS_VISIBLE style bit198 * set and the x parameter is set to CW_USEDEFAULT, the system ignores199 * the y parameter. However, disassembling NT implementation (WIN32K.SYS)200 * reveals that201 *202 * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16203 * 2) it does not ignore the y parameter as the docs claim; instead, it204 * uses it as second parameter to ShowWindow() unless y is either205 * CW_USEDEFAULT or CW_USEDEFAULT16.206 *207 * The fact that we didn't do 2) caused bogus windows pop up when wine208 * was running apps that were using this obscure feature. Example -209 * calc.exe that comes with Win98 (only Win98, it's different from210 * the one that comes with Win95 and NT)211 */212 if (cs->y != CW_USEDEFAULT && cs->y != CW_USEDEFAULT16) sw = cs->y;213 214 /* We have saved cs->y, now we can trash it */197 * that if an overlapped window is created with WS_VISIBLE style bit 198 * set and the x parameter is set to CW_USEDEFAULT, the system ignores 199 * the y parameter. However, disassembling NT implementation (WIN32K.SYS) 200 * reveals that 201 * 202 * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16 203 * 2) it does not ignore the y parameter as the docs claim; instead, it 204 * uses it as second parameter to ShowWindow() unless y is either 205 * CW_USEDEFAULT or CW_USEDEFAULT16. 206 * 207 * The fact that we didn't do 2) caused bogus windows pop up when wine 208 * was running apps that were using this obscure feature. Example - 209 * calc.exe that comes with Win98 (only Win98, it's different from 210 * the one that comes with Win95 and NT) 211 */ 212 if (cs->y != CW_USEDEFAULT && cs->y != CW_USEDEFAULT16) sw = cs->y; 213 214 /* We have saved cs->y, now we can trash it */ 215 215 #if 0 216 if ( !(cs->style & (WS_CHILD | WS_POPUP))217 &&(pdb->env_db->startup_info->dwFlags & STARTF_USEPOSITION) )218 {219 cs->x = pdb->env_db->startup_info->dwX;220 cs->y = pdb->env_db->startup_info->dwY;221 }216 if ( !(cs->style & (WS_CHILD | WS_POPUP)) 217 && (pdb->env_db->startup_info->dwFlags & STARTF_USEPOSITION) ) 218 { 219 cs->x = pdb->env_db->startup_info->dwX; 220 cs->y = pdb->env_db->startup_info->dwY; 221 } 222 222 #endif 223 cs->x = 0;224 cs->y = 0;225 // }223 cs->x = 0; 224 cs->y = 0; 225 // } 226 226 } 227 227 if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16) 228 228 { 229 229 #if 0 230 PDB *pdb = PROCESS_Current();231 if ( !(cs->style & (WS_CHILD | WS_POPUP))232 &&(pdb->env_db->startup_info->dwFlags & STARTF_USESIZE) )233 {234 cs->cx = pdb->env_db->startup_info->dwXSize;235 cs->cy = pdb->env_db->startup_info->dwYSize;236 }237 else238 {230 PDB *pdb = PROCESS_Current(); 231 if ( !(cs->style & (WS_CHILD | WS_POPUP)) 232 && (pdb->env_db->startup_info->dwFlags & STARTF_USESIZE) ) 233 { 234 cs->cx = pdb->env_db->startup_info->dwXSize; 235 cs->cy = pdb->env_db->startup_info->dwYSize; 236 } 237 else 238 { 239 239 #endif 240 cs->cx = 600; /* FIXME */241 cs->cy = 400;242 // }240 cs->cx = 600; /* FIXME */ 241 cs->cy = 400; 242 // } 243 243 } 244 244 … … 249 249 nrUserWindowLong = windowClass->getExtraWndWords(); 250 250 if(nrUserWindowLong) { 251 userWindowLong = (ULONG *)malloc(nrUserWindowLong);252 memset(userWindowLong, 0, nrUserWindowLong);251 userWindowLong = (ULONG *)malloc(nrUserWindowLong); 252 memset(userWindowLong, 0, nrUserWindowLong); 253 253 } 254 254 255 255 if ((cs->style & WS_CHILD) && cs->hwndParent) 256 256 { 257 SetParent(cs->hwndParent);257 SetParent(cs->hwndParent); 258 258 } 259 259 else 260 260 { 261 if (!cs->hwndParent) {262 owner = NULL;263 }264 else265 {266 owner = GetWindowFromHandle(cs->hwndParent);267 if(owner == NULL)268 {269 dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent));270 return FALSE;271 }272 }261 if (!cs->hwndParent) { 262 owner = NULL; 263 } 264 else 265 { 266 owner = GetWindowFromHandle(cs->hwndParent); 267 if(owner == NULL) 268 { 269 dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent)); 270 return FALSE; 271 } 272 } 273 273 } 274 274 … … 279 279 280 280 hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) 281 ? HWND_BOTTOM : HWND_TOP;281 ? HWND_BOTTOM : HWND_TOP; 282 282 283 283 #if 0 … … 288 288 { 289 289 CBT_CREATEWNDA cbtc; 290 LRESULT ret;290 LRESULT ret; 291 291 292 292 cbtc.lpcs = cs; 293 293 cbtc.hwndInsertAfter = hwndLinkAfter; 294 ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc)295 : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc);296 if (ret)294 ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc) 295 : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc); 296 if (ret) 297 297 { 298 TRACE_(win)("CBT-hook returned 0\n");299 wndPtr->pDriver->pFinalize(wndPtr);300 retvalue =0;301 goto end;298 TRACE_(win)("CBT-hook returned 0\n"); 299 wndPtr->pDriver->pFinalize(wndPtr); 300 retvalue = 0; 301 goto end; 302 302 } 303 303 } … … 310 310 if (!(cs->style & WS_CHILD)) 311 311 { 312 dwStyle |= WS_CLIPSIBLINGS;313 if (!(cs->style & WS_POPUP))314 {315 dwStyle |= WS_CAPTION;316 flags |= WIN_NEED_SIZE;317 }312 dwStyle |= WS_CLIPSIBLINGS; 313 if (!(cs->style & WS_POPUP)) 314 { 315 dwStyle |= WS_CAPTION; 316 flags |= WIN_NEED_SIZE; 317 } 318 318 } 319 319 if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME; … … 330 330 if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD))) 331 331 { 332 GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);333 if (maxSize.x < cs->cx) cs->cx = maxSize.x;334 if (maxSize.y < cs->cy) cs->cy = maxSize.y;335 if (cs->cx < minTrack.x ) cs->cx = minTrack.x;336 if (cs->cy < minTrack.y ) cs->cy = minTrack.y;332 GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack); 333 if (maxSize.x < cs->cx) cs->cx = maxSize.x; 334 if (maxSize.y < cs->cy) cs->cy = maxSize.y; 335 if (cs->cx < minTrack.x ) cs->cx = minTrack.x; 336 if (cs->cy < minTrack.y ) cs->cy = minTrack.y; 337 337 } 338 338 339 339 if(cs->style & WS_CHILD) 340 340 { 341 if(cs->cx < 0) cs->cx = 0;342 if(cs->cy < 0) cs->cy = 0;341 if(cs->cx < 0) cs->cx = 0; 342 if(cs->cy < 0) cs->cy = 0; 343 343 } 344 344 else 345 345 { 346 if (cs->cx <= 0) cs->cx = 1;347 if (cs->cy <= 0) cs->cy = 1;346 if (cs->cx <= 0) cs->cx = 1; 347 if (cs->cy <= 0) cs->cy = 1; 348 348 } 349 349 … … 352 352 rectWindow.right = cs->x + cs->cx; 353 353 rectWindow.bottom = cs->y + cs->cy; 354 rectClient = rectWindow;354 rectClient = rectWindow; 355 355 356 356 DWORD dwOSWinStyle, dwOSFrameStyle; … … 361 361 #if 1 362 362 if(cs->style & WS_CHILD) { 363 dwOSFrameStyle = 0;363 dwOSFrameStyle = 0; 364 364 } 365 365 #endif 366 366 367 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2 FrameWindowHandle() : OSLIB_HWND_DESKTOP,368 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,369 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP,370 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,371 &OS2HwndFrame);367 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP, 368 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName, 369 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP, 370 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 371 &OS2HwndFrame); 372 372 373 373 if(OS2Hwnd == 0) { 374 dprintf(("Window creation failed!!"));375 return FALSE;374 dprintf(("Window creation failed!!")); 375 return FALSE; 376 376 } 377 377 378 378 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { 379 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));380 return FALSE;379 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd)); 380 return FALSE; 381 381 } 382 382 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) { 383 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));384 return FALSE;383 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd)); 384 return FALSE; 385 385 } 386 386 #if 0 387 387 if(OS2Hwnd != OS2HwndFrame) { 388 388 if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { 389 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));390 return FALSE;389 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame)); 390 return FALSE; 391 391 } 392 392 if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) { 393 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));394 return FALSE;393 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame)); 394 return FALSE; 395 395 } 396 396 } … … 400 400 if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION ) 401 401 { 402 if (cs->hMenu) SetMenu(cs->hMenu);403 else404 {405 if (windowClass->getMenuNameA()) {406 cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA());407 if (cs->hMenu) SetMenu(cs->hMenu );408 }409 }410 } 411 else windowId = (UINT)cs->hMenu;402 if (cs->hMenu) SetMenu(cs->hMenu); 403 else 404 { 405 if (windowClass->getMenuNameA()) { 406 cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA()); 407 if (cs->hMenu) SetMenu(cs->hMenu ); 408 } 409 } 410 } 411 else windowId = (UINT)cs->hMenu; 412 412 413 413 //Set icon from class 414 414 if(windowClass->getIcon()) 415 SetIcon(windowClass->getIcon());415 SetIcon(windowClass->getIcon()); 416 416 417 417 if(getParent()) { 418 SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top,419 rectClient.right-rectClient.left,420 rectClient.bottom-rectClient.top,421 SWP_NOACTIVATE);418 SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top, 419 rectClient.right-rectClient.left, 420 rectClient.bottom-rectClient.top, 421 SWP_NOACTIVATE | SWP_NOZORDER); 422 422 } 423 423 else { 424 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,425 rectClient.right-rectClient.left,426 rectClient.bottom-rectClient.top,427 SWP_NOACTIVATE);424 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top, 425 rectClient.right-rectClient.left, 426 rectClient.bottom-rectClient.top, 427 SWP_NOACTIVATE); 428 428 } 429 429 //Get the client window rectangle … … 439 439 if(SendInternalMessage(WM_NCCREATE, 0, (LPARAM)cs) ) 440 440 { 441 //doesn't work right, messes up client rectangle441 //doesn't work right, messes up client rectangle 442 442 #if 0 443 SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient );443 SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient ); 444 444 #endif 445 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);446 dprintf(("Sending WM_CREATE"));447 if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )448 {449 if(!(flags & WIN_NEED_SIZE)) {450 SendMessageA(WM_SIZE, SIZE_RESTORED,451 MAKELONG(rectClient.right-rectClient.left,452 rectClient.bottom-rectClient.top));453 SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );454 }455 if (cs->style & WS_VISIBLE) ShowWindow( sw );445 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top); 446 dprintf(("Sending WM_CREATE")); 447 if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 ) 448 { 449 if(!(flags & WIN_NEED_SIZE)) { 450 SendMessageA(WM_SIZE, SIZE_RESTORED, 451 MAKELONG(rectClient.right-rectClient.left, 452 rectClient.bottom-rectClient.top)); 453 SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 454 } 455 if (cs->style & WS_VISIBLE) ShowWindow( sw ); 456 456 457 457 #if 0 458 /* Call WH_SHELL hook */459 460 if (!(dwStyle & WS_CHILD) && !owner)461 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );458 /* Call WH_SHELL hook */ 459 460 if (!(dwStyle & WS_CHILD) && !owner) 461 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); 462 462 #endif 463 SetLastError(0);464 return TRUE;465 }463 SetLastError(0); 464 return TRUE; 465 } 466 466 } 467 467 fCreated = FALSE; … … 473 473 #if 0 474 474 /*********************************************************************** 475 * WINPOS_MinMaximize475 * WINPOS_MinMaximize 476 476 * 477 477 * Fill in lpRect and return additional flags to be used with SetWindowPos(). … … 492 492 if( dwStyle & WS_MINIMIZE ) 493 493 { 494 if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )495 return (SWP_NOSIZE | SWP_NOMOVE);496 swpFlags |= SWP_NOCOPYBITS;494 if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) ) 495 return (SWP_NOSIZE | SWP_NOMOVE); 496 swpFlags |= SWP_NOCOPYBITS; 497 497 } 498 498 switch( cmd ) 499 499 { 500 case SW_MINIMIZE:501 if( dwStyle & WS_MAXIMIZE)502 {503 flags |= WIN_RESTORE_MAX;504 dwStyle &= ~WS_MAXIMIZE;505 }506 else507 flags &= ~WIN_RESTORE_MAX;508 dwStyle |= WS_MINIMIZE;500 case SW_MINIMIZE: 501 if( dwStyle & WS_MAXIMIZE) 502 { 503 flags |= WIN_RESTORE_MAX; 504 dwStyle &= ~WS_MAXIMIZE; 505 } 506 else 507 flags &= ~WIN_RESTORE_MAX; 508 dwStyle |= WS_MINIMIZE; 509 509 510 510 #if 0 511 if( flags & WIN_NATIVE )512 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )513 swpFlags |= MINMAX_NOSWP;511 if( flags & WIN_NATIVE ) 512 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) ) 513 swpFlags |= MINMAX_NOSWP; 514 514 #endif 515 515 516 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );517 518 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,519 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );520 swpFlags |= SWP_NOCOPYBITS;521 break;522 523 case SW_MAXIMIZE:524 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );525 526 if( dwStyle & WS_MINIMIZE )527 {528 if( flags & WIN_NATIVE )529 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )530 swpFlags |= MINMAX_NOSWP;531 532 WINPOS_ShowIconTitle( wndPtr, FALSE );533 dwStyle &= ~WS_MINIMIZE;534 }535 dwStyle |= WS_MAXIMIZE;536 537 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,538 size.x, size.y );539 break;540 541 case SW_RESTORE:542 if( dwStyle & WS_MINIMIZE )543 {544 if( flags & WIN_NATIVE )545 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )546 swpFlags |= MINMAX_NOSWP;547 548 dwStyle &= ~WS_MINIMIZE;549 WINPOS_ShowIconTitle( wndPtr, FALSE );550 551 if( flags & WIN_RESTORE_MAX)552 {553 /* Restore to maximized position */554 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );555 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL);556 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );557 dwStyle |= WS_MAXIMIZE;558 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );559 break;560 }561 }562 else563 if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);564 else dwStyle &= ~WS_MAXIMIZE;565 566 /* Restore to normal position */567 568 *lpRect = lpPos->rectNormal;569 lpRect->right -= lpRect->left;570 lpRect->bottom -= lpRect->top;571 572 break;516 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos ); 517 518 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y, 519 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 520 swpFlags |= SWP_NOCOPYBITS; 521 break; 522 523 case SW_MAXIMIZE: 524 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL ); 525 526 if( dwStyle & WS_MINIMIZE ) 527 { 528 if( flags & WIN_NATIVE ) 529 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) ) 530 swpFlags |= MINMAX_NOSWP; 531 532 WINPOS_ShowIconTitle( wndPtr, FALSE ); 533 dwStyle &= ~WS_MINIMIZE; 534 } 535 dwStyle |= WS_MAXIMIZE; 536 537 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, 538 size.x, size.y ); 539 break; 540 541 case SW_RESTORE: 542 if( dwStyle & WS_MINIMIZE ) 543 { 544 if( flags & WIN_NATIVE ) 545 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) ) 546 swpFlags |= MINMAX_NOSWP; 547 548 dwStyle &= ~WS_MINIMIZE; 549 WINPOS_ShowIconTitle( wndPtr, FALSE ); 550 551 if( flags & WIN_RESTORE_MAX) 552 { 553 /* Restore to maximized position */ 554 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); 555 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL); 556 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); 557 dwStyle |= WS_MAXIMIZE; 558 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y ); 559 break; 560 } 561 } 562 else 563 if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1); 564 else dwStyle &= ~WS_MAXIMIZE; 565 566 /* Restore to normal position */ 567 568 *lpRect = lpPos->rectNormal; 569 lpRect->right -= lpRect->left; 570 lpRect->bottom -= lpRect->top; 571 572 break; 573 573 } 574 574 } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE; … … 577 577 #endif 578 578 /******************************************************************* 579 * GetMinMaxInfo579 * GetMinMaxInfo 580 580 * 581 581 * Get the minimized and maximized information for a window. 582 582 */ 583 583 void Win32Window::GetMinMaxInfo(POINT *maxSize, POINT *maxPos, 584 POINT *minTrack, POINT *maxTrack )584 POINT *minTrack, POINT *maxTrack ) 585 585 { 586 586 MINMAXINFO MinMax; … … 599 599 else if (HAS_DLGFRAME( dwStyle, dwExStyle )) 600 600 { 601 xinc = GetSystemMetrics(SM_CXDLGFRAME);602 yinc = GetSystemMetrics(SM_CYDLGFRAME);601 xinc = GetSystemMetrics(SM_CXDLGFRAME); 602 yinc = GetSystemMetrics(SM_CYDLGFRAME); 603 603 } 604 604 else 605 605 { 606 xinc = yinc = 0;607 if (HAS_THICKFRAME(dwStyle))608 {609 xinc += GetSystemMetrics(SM_CXFRAME);610 yinc += GetSystemMetrics(SM_CYFRAME);611 }612 if (dwStyle & WS_BORDER)613 {614 xinc += GetSystemMetrics(SM_CXBORDER);615 yinc += GetSystemMetrics(SM_CYBORDER);616 }606 xinc = yinc = 0; 607 if (HAS_THICKFRAME(dwStyle)) 608 { 609 xinc += GetSystemMetrics(SM_CXFRAME); 610 yinc += GetSystemMetrics(SM_CYFRAME); 611 } 612 if (dwStyle & WS_BORDER) 613 { 614 xinc += GetSystemMetrics(SM_CXBORDER); 615 yinc += GetSystemMetrics(SM_CYBORDER); 616 } 617 617 } 618 618 MinMax.ptMaxSize.x += 2 * xinc; … … 622 622 lpPos = (LPINTERNALPOS)GetPropA( hwndSelf, atomInternalPos ); 623 623 if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) ) 624 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );624 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition ); 625 625 else 626 626 { 627 627 #endif 628 MinMax.ptMaxPosition.x = -xinc;629 MinMax.ptMaxPosition.y = -yinc;628 MinMax.ptMaxPosition.x = -xinc; 629 MinMax.ptMaxPosition.y = -yinc; 630 630 // } 631 631 … … 635 635 636 636 dprintf(("GetMinMaxInfo: %ld %ld / %ld %ld / %ld %ld / %ld %ld\n", 637 MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,638 MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,639 MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,640 MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y));637 MinMax.ptMaxSize.x, MinMax.ptMaxSize.y, 638 MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y, 639 MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y, 640 MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y)); 641 641 MinMax.ptMaxTrackSize.x = MAX( MinMax.ptMaxTrackSize.x, 642 MinMax.ptMinTrackSize.x );642 MinMax.ptMinTrackSize.x ); 643 643 MinMax.ptMaxTrackSize.y = MAX( MinMax.ptMaxTrackSize.y, 644 MinMax.ptMinTrackSize.y );644 MinMax.ptMinTrackSize.y ); 645 645 646 646 if (maxSize) *maxSize = MinMax.ptMaxSize; … … 650 650 } 651 651 /*********************************************************************** 652 * WINPOS_SendNCCalcSize652 * WINPOS_SendNCCalcSize 653 653 * 654 654 * Send a WM_NCCALCSIZE message to a window. … … 658 658 */ 659 659 LONG Win32Window::SendNCCalcSize(BOOL calcValidRect, RECT *newWindowRect, RECT *oldWindowRect, 660 RECT *oldClientRect, WINDOWPOS *winpos,661 RECT *newClientRect )660 RECT *oldClientRect, WINDOWPOS *winpos, 661 RECT *newClientRect ) 662 662 { 663 663 NCCALCSIZE_PARAMS params; … … 668 668 if (calcValidRect) 669 669 { 670 winposCopy = *winpos;671 params.rgrc[1] = *oldWindowRect;672 params.rgrc[2] = *oldClientRect;673 params.lppos = &winposCopy;670 winposCopy = *winpos; 671 params.rgrc[1] = *oldWindowRect; 672 params.rgrc[2] = *oldClientRect; 673 params.lppos = &winposCopy; 674 674 } 675 675 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, 676 (LPARAM)¶ms );676 (LPARAM)¶ms ); 677 677 *newClientRect = params.rgrc[0]; 678 678 return result; … … 696 696 { 697 697 if(SendInternalMessageA(WM_CLOSE, 0, 0) == 0) { 698 return 0; //app handles this message698 return 0; //app handles this message 699 699 } 700 700 delete this; … … 730 730 dprintf(("MsgMove to (%d,%d)", x, y)); 731 731 if(fCreated == FALSE) { 732 return 1;732 return 1; 733 733 } 734 734 … … 741 741 switch(cmd) { 742 742 case CMD_MENU: 743 return SendInternalMessageA(WM_COMMAND, MAKELONG(Id, 0), 0);743 return SendInternalMessageA(WM_COMMAND, MAKELONG(Id, 0), 0); 744 744 case CMD_CONTROL: 745 return 0; //todo745 return 0; //todo 746 746 case CMD_ACCELERATOR: 747 dprintf(("accelerator command"));748 return 0; //todo747 dprintf(("accelerator command")); 748 return 0; //todo 749 749 } 750 750 return 0; … … 765 765 766 766 if(fCreated == FALSE) {//Solitaire crashes if it receives a WM_SIZE during CreateWindowEx (normal or our fault?) 767 return 1;767 return 1; 768 768 } 769 769 770 770 if(fMinimize) { 771 fwSizeType = SIZE_MINIMIZED;771 fwSizeType = SIZE_MINIMIZED; 772 772 } 773 773 else 774 774 if(fMaximize) { 775 fwSizeType = SIZE_MAXIMIZED;775 fwSizeType = SIZE_MAXIMIZED; 776 776 } 777 777 else fwSizeType = SIZE_RESTORED; … … 785 785 if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE) 786 786 { 787 if(!fActivate) {788 return 1;789 }787 if(!fActivate) { 788 return 1; 789 } 790 790 } 791 791 return SendInternalMessageA(WM_ACTIVATE, (fActivate) ? WA_ACTIVE : WA_INACTIVE, hwnd); … … 807 807 lParam |= (scancode << 16); 808 808 if(keyflags & KEY_ALTDOWN) 809 lParam |= (1<<29);809 lParam |= (1<<29); 810 810 if(keyflags & KEY_PREVDOWN) 811 lParam |= (1<<30);811 lParam |= (1<<30); 812 812 if(keyflags & KEY_UP) 813 lParam |= (1<<31);813 lParam |= (1<<31); 814 814 if(keyflags & KEY_DEADKEY) { 815 dprintf(("WM_DEADCHAR: %x %x %08x", OS2Hwnd, cmd, lParam));816 return SendInternalMessageA(WM_DEADCHAR, cmd, lParam);815 dprintf(("WM_DEADCHAR: %x %x %08x", OS2Hwnd, cmd, lParam)); 816 return SendInternalMessageA(WM_DEADCHAR, cmd, lParam); 817 817 } 818 818 else { 819 dprintf(("WM_CHAR: %x %x %08x", OS2Hwnd, cmd, lParam));820 return SendInternalMessageA(WM_CHAR, cmd, lParam);819 dprintf(("WM_CHAR: %x %x %08x", OS2Hwnd, cmd, lParam)); 820 return SendInternalMessageA(WM_CHAR, cmd, lParam); 821 821 } 822 822 } … … 826 826 { 827 827 if(hwnd == 0) { 828 //other app lost focus829 SendInternalMessageA(WM_ACTIVATEAPP, TRUE, 0); //TODO: Need thread id from hwnd app828 //other app lost focus 829 SendInternalMessageA(WM_ACTIVATEAPP, TRUE, 0); //TODO: Need thread id from hwnd app 830 830 } 831 831 return SendInternalMessageA(WM_SETFOCUS, hwnd, 0); … … 836 836 { 837 837 if(hwnd == 0) { 838 //other app lost focus839 SendInternalMessageA(WM_ACTIVATEAPP, FALSE, 0); //TODO: Need thread id from hwnd app838 //other app lost focus 839 SendInternalMessageA(WM_ACTIVATEAPP, FALSE, 0); //TODO: Need thread id from hwnd app 840 840 } 841 841 return SendInternalMessageA(WM_KILLFOCUS, hwnd, 0); … … 850 850 dprintf(("MsgButton to (%d,%d)", ncx, ncy)); 851 851 switch(msg) { 852 case BUTTON_LEFTDOWN:853 win32msg = WM_LBUTTONDOWN;854 win32ncmsg = WM_NCLBUTTONDOWN;855 break;856 case BUTTON_LEFTUP:857 win32msg = WM_LBUTTONUP;858 win32ncmsg = WM_NCLBUTTONUP;859 break;860 case BUTTON_LEFTDBLCLICK:861 win32msg = WM_LBUTTONDBLCLK;862 win32ncmsg = WM_NCLBUTTONDBLCLK;863 break;864 case BUTTON_RIGHTUP:865 win32msg = WM_RBUTTONUP;866 win32ncmsg = WM_NCRBUTTONUP;867 break;868 case BUTTON_RIGHTDOWN:869 win32msg = WM_RBUTTONDOWN;870 win32ncmsg = WM_NCRBUTTONDOWN;871 break;872 case BUTTON_RIGHTDBLCLICK:873 win32msg = WM_RBUTTONDBLCLK;874 win32ncmsg = WM_NCRBUTTONDBLCLK;875 break;876 case BUTTON_MIDDLEUP:877 win32msg = WM_MBUTTONUP;878 win32ncmsg = WM_NCMBUTTONUP;879 break;880 case BUTTON_MIDDLEDOWN:881 win32msg = WM_MBUTTONDOWN;882 win32ncmsg = WM_NCMBUTTONDOWN;883 break;884 case BUTTON_MIDDLEDBLCLICK:885 win32msg = WM_MBUTTONDBLCLK;886 win32ncmsg = WM_NCMBUTTONDBLCLK;887 break;888 default:889 dprintf(("Win32Window::Button: invalid msg!!!!"));890 return 1;852 case BUTTON_LEFTDOWN: 853 win32msg = WM_LBUTTONDOWN; 854 win32ncmsg = WM_NCLBUTTONDOWN; 855 break; 856 case BUTTON_LEFTUP: 857 win32msg = WM_LBUTTONUP; 858 win32ncmsg = WM_NCLBUTTONUP; 859 break; 860 case BUTTON_LEFTDBLCLICK: 861 win32msg = WM_LBUTTONDBLCLK; 862 win32ncmsg = WM_NCLBUTTONDBLCLK; 863 break; 864 case BUTTON_RIGHTUP: 865 win32msg = WM_RBUTTONUP; 866 win32ncmsg = WM_NCRBUTTONUP; 867 break; 868 case BUTTON_RIGHTDOWN: 869 win32msg = WM_RBUTTONDOWN; 870 win32ncmsg = WM_NCRBUTTONDOWN; 871 break; 872 case BUTTON_RIGHTDBLCLICK: 873 win32msg = WM_RBUTTONDBLCLK; 874 win32ncmsg = WM_NCRBUTTONDBLCLK; 875 break; 876 case BUTTON_MIDDLEUP: 877 win32msg = WM_MBUTTONUP; 878 win32ncmsg = WM_NCMBUTTONUP; 879 break; 880 case BUTTON_MIDDLEDOWN: 881 win32msg = WM_MBUTTONDOWN; 882 win32ncmsg = WM_NCMBUTTONDOWN; 883 break; 884 case BUTTON_MIDDLEDBLCLICK: 885 win32msg = WM_MBUTTONDBLCLK; 886 win32ncmsg = WM_NCMBUTTONDBLCLK; 887 break; 888 default: 889 dprintf(("Win32Window::Button: invalid msg!!!!")); 890 return 1; 891 891 } 892 892 if(win32msg == WM_MBUTTONDBLCLK || win32msg == WM_RBUTTONDBLCLK || win32msg == WM_LBUTTONDBLCLK) { 893 if(!(windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)) {894 return 1;895 }893 if(!(windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)) { 894 return 1; 895 } 896 896 } 897 897 SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(ncx, ncy)); //TODO: … … 905 905 906 906 if(keystate & WMMOVE_LBUTTON) 907 winstate |= MK_LBUTTON;907 winstate |= MK_LBUTTON; 908 908 if(keystate & WMMOVE_RBUTTON) 909 winstate |= MK_RBUTTON;909 winstate |= MK_RBUTTON; 910 910 if(keystate & WMMOVE_MBUTTON) 911 winstate |= MK_MBUTTON;911 winstate |= MK_MBUTTON; 912 912 if(keystate & WMMOVE_SHIFT) 913 winstate |= MK_SHIFT;913 winstate |= MK_SHIFT; 914 914 if(keystate & WMMOVE_CTRL) 915 winstate |= MK_CONTROL;915 winstate |= MK_CONTROL; 916 916 917 917 return SendInternalMessageA(WM_MOUSEMOVE, keystate, MAKELONG(x, y)); … … 925 925 //****************************************************************************** 926 926 //TODO: Is the clipper region of the window DC equal to the invalidated rectangle? 927 // (or are we simply erasing too much here)927 // (or are we simply erasing too much here) 928 928 //****************************************************************************** 929 929 ULONG Win32Window::MsgEraseBackGround() 930 930 { 931 931 if(isIcon) { 932 return SendInternalMessageA(WM_ICONERASEBKGND, GetDC(getWindowHandle()), 0);932 return SendInternalMessageA(WM_ICONERASEBKGND, GetDC(getWindowHandle()), 0); 933 933 } 934 934 else return SendInternalMessageA(WM_ERASEBKGND, GetDC(getWindowHandle()), 0); … … 939 939 { 940 940 if(isUnicode) { 941 return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);941 return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz); 942 942 } 943 943 else return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz); … … 955 955 { 956 956 if(isUnicode) { 957 SendInternalMessageW(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameW);957 SendInternalMessageW(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameW); 958 958 } 959 959 else { 960 SendInternalMessageA(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameA);960 SendInternalMessageA(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameA); 961 961 } 962 962 return windowNameA; … … 969 969 { 970 970 case WM_GETTEXTLENGTH: 971 return wndNameLength;971 return wndNameLength; 972 972 973 973 case WM_GETTEXT: //TODO: SS_ICON controls 974 strncpy((LPSTR)lParam, windowNameA, wParam);975 return min(wndNameLength, wParam);974 strncpy((LPSTR)lParam, windowNameA, wParam); 975 return min(wndNameLength, wParam); 976 976 977 977 case WM_SETTEXT: 978 return 0;978 return 0; 979 979 980 980 case WM_SETREDRAW: 981 if(wParam)982 SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) | WS_VISIBLE);983 elseSetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) & ~WS_VISIBLE);984 985 return 0; //TODO981 if(wParam) 982 SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) | WS_VISIBLE); 983 else SetWindowLongA (GWL_STYLE, GetWindowLongA (GWL_STYLE) & ~WS_VISIBLE); 984 985 return 0; //TODO 986 986 987 987 case WM_NCCREATE: 988 return(TRUE);988 return(TRUE); 989 989 990 990 case WM_CTLCOLORMSGBOX: … … 995 995 case WM_CTLCOLORSTATIC: 996 996 case WM_CTLCOLORSCROLLBAR: 997 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));998 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));999 return GetSysColorBrush(COLOR_BTNFACE);997 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); 998 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 999 return GetSysColorBrush(COLOR_BTNFACE); 1000 1000 1001 1001 case WM_PARENTNOTIFY: 1002 return 0;1002 return 0; 1003 1003 1004 1004 case WM_MOUSEACTIVATE: 1005 1005 { 1006 DWORD dwStyle = GetWindowLongA(GWL_STYLE);1007 DWORD dwExStyle = GetWindowLongA(GWL_EXSTYLE);1008 dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));1009 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )1010 {1011 if(getParent()) {1012 LRESULT rc = getParent()->SendMessageA(WM_MOUSEACTIVATE, wParam, lParam );1013 if(rc)return rc;1014 }1015 }1016 return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;1006 DWORD dwStyle = GetWindowLongA(GWL_STYLE); 1007 DWORD dwExStyle = GetWindowLongA(GWL_EXSTYLE); 1008 dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam)))); 1009 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) ) 1010 { 1011 if(getParent()) { 1012 LRESULT rc = getParent()->SendMessageA(WM_MOUSEACTIVATE, wParam, lParam ); 1013 if(rc) return rc; 1014 } 1015 } 1016 return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE; 1017 1017 } 1018 1018 case WM_SETCURSOR: 1019 1019 { 1020 DWORD dwStyle = GetWindowLongA(GWL_STYLE);1021 DWORD dwExStyle = GetWindowLongA(GWL_EXSTYLE);1022 dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));1023 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )1024 {1025 if(getParent()) {1026 LRESULT rc = getParent()->SendMessageA(WM_SETCURSOR, wParam, lParam);1027 if(rc)return rc;1028 }1029 }1030 return 1;1020 DWORD dwStyle = GetWindowLongA(GWL_STYLE); 1021 DWORD dwExStyle = GetWindowLongA(GWL_EXSTYLE); 1022 dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam)))); 1023 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) ) 1024 { 1025 if(getParent()) { 1026 LRESULT rc = getParent()->SendMessageA(WM_SETCURSOR, wParam, lParam); 1027 if(rc) return rc; 1028 } 1029 } 1030 return 1; 1031 1031 } 1032 1032 case WM_MOUSEMOVE: 1033 return 0;1033 return 0; 1034 1034 1035 1035 case WM_ERASEBKGND: … … 1040 1040 if (!windowClass->getBackgroundBrush()) return 0; 1041 1041 1042 /* Since WM_ERASEBKGND may receive either a window dc or a */ 1043 /* client dc, the area to be erased has to be retrieved from */1044 /* the device context.*/1045 GetClipBox( (HDC)wParam, &rect );1046 1047 FillRect( (HDC)wParam, &rect, windowClass->getBackgroundBrush());1042 /* Since WM_ERASEBKGND may receive either a window dc or a */ 1043 /* client dc, the area to be erased has to be retrieved from */ 1044 /* the device context. */ 1045 GetClipBox( (HDC)wParam, &rect ); 1046 1047 FillRect( (HDC)wParam, &rect, windowClass->getBackgroundBrush()); 1048 1048 1049 1049 return 1; … … 1059 1059 case WM_NCMBUTTONUP: 1060 1060 case WM_NCMBUTTONDBLCLK: 1061 return 0;//TODO: Send WM_SYSCOMMAND if required1061 return 0; //TODO: Send WM_SYSCOMMAND if required 1062 1062 1063 1063 case WM_NCHITTEST: //TODO: 1064 return 0;1064 return 0; 1065 1065 1066 1066 default: 1067 return 1;1067 return 1; 1068 1068 } 1069 1069 } … … 1075 1075 { 1076 1076 case WM_GETTEXTLENGTH: 1077 return wndNameLength;1077 return wndNameLength; 1078 1078 1079 1079 case WM_GETTEXT: //TODO: SS_ICON controls 1080 lstrcpynW((LPWSTR)lParam, windowNameW, wParam);1081 return min(wndNameLength, wParam);1080 lstrcpynW((LPWSTR)lParam, windowNameW, wParam); 1081 return min(wndNameLength, wParam); 1082 1082 1083 1083 default: 1084 return DefWindowProcA(Msg, wParam, lParam);1084 return DefWindowProcA(Msg, wParam, lParam); 1085 1085 } 1086 1086 } … … 1090 1090 { 1091 1091 if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE) 1092 dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));1092 dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 1093 1093 1094 1094 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg 1095 return(0);1095 return(0); 1096 1096 } 1097 1097 switch(Msg) 1098 1098 { 1099 case WM_CREATE:1100 {1101 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {1102 dprintf(("WM_NCCREATE returned FALSE\n"));1103 return(-1); //don't create window1104 }1105 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == -1) {1106 dprintf(("WM_CREATE returned -1\n"));1107 return(-1); //don't create window1108 }1109 NotifyParent(Msg, wParam, lParam);1110 1111 return(0);1112 }1113 case WM_SETTEXT: //TODO: Nothing happens if passed to DefWindowProc1114 return win32wndproc(getWindowHandle(), WM_SETTEXT, wParam, lParam);1115 1116 case WM_LBUTTONDOWN:1117 case WM_MBUTTONDOWN:1118 case WM_RBUTTONDOWN:1119 NotifyParent(Msg, wParam, lParam);1120 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);1121 1122 case WM_DESTROY:1123 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);1124 NotifyParent(Msg, wParam, lParam);1125 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);1126 default:1127 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);1099 case WM_CREATE: 1100 { 1101 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) { 1102 dprintf(("WM_NCCREATE returned FALSE\n")); 1103 return(-1); //don't create window 1104 } 1105 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == -1) { 1106 dprintf(("WM_CREATE returned -1\n")); 1107 return(-1); //don't create window 1108 } 1109 NotifyParent(Msg, wParam, lParam); 1110 1111 return(0); 1112 } 1113 case WM_SETTEXT: //TODO: Nothing happens if passed to DefWindowProc 1114 return win32wndproc(getWindowHandle(), WM_SETTEXT, wParam, lParam); 1115 1116 case WM_LBUTTONDOWN: 1117 case WM_MBUTTONDOWN: 1118 case WM_RBUTTONDOWN: 1119 NotifyParent(Msg, wParam, lParam); 1120 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 1121 1122 case WM_DESTROY: 1123 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0); 1124 NotifyParent(Msg, wParam, lParam); 1125 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0); 1126 default: 1127 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 1128 1128 } 1129 1129 } … … 1133 1133 { 1134 1134 if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE) 1135 dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));1135 dprintf(("SendMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 1136 1136 1137 1137 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg 1138 return(0);1138 return(0); 1139 1139 } 1140 1140 switch(Msg) 1141 1141 { 1142 case WM_CREATE:1143 {1144 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {1145 dprintf(("WM_NCCREATE returned FALSE\n"));1146 return(0); //don't create window1147 }1148 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {1149 dprintf(("WM_CREATE returned FALSE\n"));1150 return(0); //don't create window1151 }1152 NotifyParent(Msg, wParam, lParam);1153 1154 return(1);1155 }1156 case WM_SETTEXT: //TODO: Nothing happens if passed to DefWindowProc1157 return win32wndproc(getWindowHandle(), WM_SETTEXT, wParam, lParam);1158 1159 case WM_LBUTTONDOWN:1160 case WM_MBUTTONDOWN:1161 case WM_RBUTTONDOWN:1162 NotifyParent(Msg, wParam, lParam);1163 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);1164 1165 case WM_DESTROY:1166 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);1167 NotifyParent(Msg, wParam, lParam);1168 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);1169 1170 default:1171 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);1142 case WM_CREATE: 1143 { 1144 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) { 1145 dprintf(("WM_NCCREATE returned FALSE\n")); 1146 return(0); //don't create window 1147 } 1148 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) { 1149 dprintf(("WM_CREATE returned FALSE\n")); 1150 return(0); //don't create window 1151 } 1152 NotifyParent(Msg, wParam, lParam); 1153 1154 return(1); 1155 } 1156 case WM_SETTEXT: //TODO: Nothing happens if passed to DefWindowProc 1157 return win32wndproc(getWindowHandle(), WM_SETTEXT, wParam, lParam); 1158 1159 case WM_LBUTTONDOWN: 1160 case WM_MBUTTONDOWN: 1161 case WM_RBUTTONDOWN: 1162 NotifyParent(Msg, wParam, lParam); 1163 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 1164 1165 case WM_DESTROY: 1166 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0); 1167 NotifyParent(Msg, wParam, lParam); 1168 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0); 1169 1170 default: 1171 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 1172 1172 } 1173 1173 } … … 1178 1178 { 1179 1179 if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE) 1180 dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));1180 dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 1181 1181 1182 1182 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg 1183 return(0);1183 return(0); 1184 1184 } 1185 1185 switch(Msg) 1186 1186 { 1187 case WM_CREATE:1188 {1189 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {1190 dprintf(("WM_NCCREATE returned FALSE\n"));1191 return(0); //don't create window1192 }1193 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {1194 dprintf(("WM_CREATE returned FALSE\n"));1195 return(0); //don't create window1196 }1197 NotifyParent(Msg, wParam, lParam);1198 1199 return(1);1200 }1201 case WM_LBUTTONDOWN:1202 case WM_MBUTTONDOWN:1203 case WM_RBUTTONDOWN:1204 NotifyParent(Msg, wParam, lParam);1205 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);1206 1207 case WM_DESTROY:1208 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);1209 NotifyParent(Msg, wParam, lParam);1210 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);1211 default:1212 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);1187 case WM_CREATE: 1188 { 1189 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) { 1190 dprintf(("WM_NCCREATE returned FALSE\n")); 1191 return(0); //don't create window 1192 } 1193 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) { 1194 dprintf(("WM_CREATE returned FALSE\n")); 1195 return(0); //don't create window 1196 } 1197 NotifyParent(Msg, wParam, lParam); 1198 1199 return(1); 1200 } 1201 case WM_LBUTTONDOWN: 1202 case WM_MBUTTONDOWN: 1203 case WM_RBUTTONDOWN: 1204 NotifyParent(Msg, wParam, lParam); 1205 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 1206 1207 case WM_DESTROY: 1208 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0); 1209 NotifyParent(Msg, wParam, lParam); 1210 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0); 1211 default: 1212 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 1213 1213 } 1214 1214 } … … 1220 1220 { 1221 1221 if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE) 1222 dprintf(("SendInternalMessageW %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));1222 dprintf(("SendInternalMessageW %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 1223 1223 1224 1224 if(HkCBT::OS2HkCBTProc(getWindowHandle(), Msg, wParam, lParam) == TRUE) {//hook swallowed msg 1225 return(0);1225 return(0); 1226 1226 } 1227 1227 switch(Msg) 1228 1228 { 1229 case WM_CREATE:1230 {1231 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {1232 dprintf(("WM_NCCREATE returned FALSE\n"));1233 return(0); //don't create window1234 }1235 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {1236 dprintf(("WM_CREATE returned FALSE\n"));1237 return(0); //don't create window1238 }1239 NotifyParent(Msg, wParam, lParam);1240 1241 return(1);1242 }1243 case WM_LBUTTONDOWN:1244 case WM_MBUTTONDOWN:1245 case WM_RBUTTONDOWN:1246 NotifyParent(Msg, wParam, lParam);1247 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);1248 1249 case WM_DESTROY:1250 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0);1251 NotifyParent(Msg, wParam, lParam);1252 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);1253 default:1254 return win32wndproc(getWindowHandle(), Msg, wParam, lParam);1229 case WM_CREATE: 1230 { 1231 if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) { 1232 dprintf(("WM_NCCREATE returned FALSE\n")); 1233 return(0); //don't create window 1234 } 1235 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) { 1236 dprintf(("WM_CREATE returned FALSE\n")); 1237 return(0); //don't create window 1238 } 1239 NotifyParent(Msg, wParam, lParam); 1240 1241 return(1); 1242 } 1243 case WM_LBUTTONDOWN: 1244 case WM_MBUTTONDOWN: 1245 case WM_RBUTTONDOWN: 1246 NotifyParent(Msg, wParam, lParam); 1247 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 1248 1249 case WM_DESTROY: 1250 win32wndproc(getWindowHandle(), WM_NCDESTROY, 0, 0); 1251 NotifyParent(Msg, wParam, lParam); 1252 return win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0); 1253 default: 1254 return win32wndproc(getWindowHandle(), Msg, wParam, lParam); 1255 1255 } 1256 1256 } … … 1266 1266 return 0; 1267 1267 } 1268 postmsg->Msg = msg;1268 postmsg->Msg = msg; 1269 1269 postmsg->wParam = wParam; 1270 1270 postmsg->lParam = lParam; … … 1282 1282 return 0; 1283 1283 } 1284 postmsg->Msg = msg;1284 postmsg->Msg = msg; 1285 1285 postmsg->wParam = wParam; 1286 1286 postmsg->lParam = lParam; … … 1297 1297 while(window) 1298 1298 { 1299 if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) )1300 {1301 /* Notify the parent window only */1302 parentwindow = window->getParent();1303 if(parentwindow) {1304 if(Msg == WM_CREATE || Msg == WM_DESTROY) {1305 parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle());1306 }1307 elseparentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam );1308 }1309 }1310 elsebreak;1311 1312 window = parentwindow;1299 if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) ) 1300 { 1301 /* Notify the parent window only */ 1302 parentwindow = window->getParent(); 1303 if(parentwindow) { 1304 if(Msg == WM_CREATE || Msg == WM_DESTROY) { 1305 parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), (LPARAM)window->getWindowHandle()); 1306 } 1307 else parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, window->getWindowId()), lParam ); 1308 } 1309 } 1310 else break; 1311 1312 window = parentwindow; 1313 1313 } 1314 1314 } … … 1317 1317 BOOL Win32Window::SetMenu(HMENU hMenu) 1318 1318 { 1319 PVOID menutemplate;1319 PVOID menutemplate; 1320 1320 Win32Resource *winres = (Win32Resource *)hMenu; 1321 1321 1322 1322 dprintf(("SetMenu %x", hMenu)); 1323 1323 if(HIWORD(winres) == 0) { 1324 dprintf(("Win32Window:: Win32Resource *winres == 0"));1325 SetLastError(ERROR_INVALID_PARAMETER);1326 return FALSE;1324 dprintf(("Win32Window:: Win32Resource *winres == 0")); 1325 SetLastError(ERROR_INVALID_PARAMETER); 1326 return FALSE; 1327 1327 } 1328 1328 menutemplate = winres->lockOS2Resource(); 1329 1329 if(menutemplate == NULL) 1330 1330 { 1331 dprintf(("Win32Window::SetMenu menutemplate == 0"));1332 return FALSE;1331 dprintf(("Win32Window::SetMenu menutemplate == 0")); 1332 return FALSE; 1333 1333 } 1334 1334 OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate); 1335 1335 if(OS2HwndMenu == 0) { 1336 dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));1337 return FALSE;1336 dprintf(("Win32Window::SetMenu OS2HwndMenu == 0")); 1337 return FALSE; 1338 1338 } 1339 1339 menuResource = winres; … … 1345 1345 { 1346 1346 Win32Resource *winres = (Win32Resource *)hAccel; 1347 HANDLE accelhandle;1347 HANDLE accelhandle; 1348 1348 1349 1349 if(HIWORD(hAccel) == 0) { 1350 dprintf(("SetAccelTable: hAccel %x invalid", hAccel));1351 SetLastError(ERROR_INVALID_PARAMETER);1352 return FALSE;1350 dprintf(("SetAccelTable: hAccel %x invalid", hAccel)); 1351 SetLastError(ERROR_INVALID_PARAMETER); 1352 return FALSE; 1353 1353 } 1354 1354 acceltableResource = winres; … … 1372 1372 dprintf(("ShowWindow %x", nCmdShow)); 1373 1373 if(fFirstShow) { 1374 if(isFrameWindow() && IS_OVERLAPPED(getStyle())) {1375 SendMessageA(WM_SIZE, SIZE_RESTORED,1376 MAKELONG(rectClient.right-rectClient.left,1377 rectClient.bottom-rectClient.top));1378 SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );1379 1380 }1381 fFirstShow = FALSE;1374 if(isFrameWindow() && IS_OVERLAPPED(getStyle())) { 1375 SendMessageA(WM_SIZE, SIZE_RESTORED, 1376 MAKELONG(rectClient.right-rectClient.left, 1377 rectClient.bottom-rectClient.top)); 1378 SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 1379 1380 } 1381 fFirstShow = FALSE; 1382 1382 } 1383 1383 switch(nCmdShow) … … 1385 1385 case SW_SHOW: 1386 1386 case SW_SHOWDEFAULT: //todo 1387 showstate = SWPOS_SHOW | SWPOS_ACTIVATE;1388 break;1387 showstate = SWPOS_SHOW | SWPOS_ACTIVATE; 1388 break; 1389 1389 case SW_HIDE: 1390 showstate = SWPOS_HIDE;1391 break;1390 showstate = SWPOS_HIDE; 1391 break; 1392 1392 case SW_RESTORE: 1393 showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;1394 break;1393 showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE; 1394 break; 1395 1395 case SW_MINIMIZE: 1396 showstate = SWPOS_MINIMIZE;1397 break;1396 showstate = SWPOS_MINIMIZE; 1397 break; 1398 1398 case SW_SHOWMAXIMIZED: 1399 showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;1400 break;1399 showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE; 1400 break; 1401 1401 case SW_SHOWMINIMIZED: 1402 showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;1403 break;1402 showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE; 1403 break; 1404 1404 case SW_SHOWMINNOACTIVE: 1405 showstate = SWPOS_MINIMIZE | SWPOS_SHOW;1406 break;1405 showstate = SWPOS_MINIMIZE | SWPOS_SHOW; 1406 break; 1407 1407 case SW_SHOWNA: 1408 showstate = SWPOS_SHOW;1409 break;1408 showstate = SWPOS_SHOW; 1409 break; 1410 1410 case SW_SHOWNOACTIVATE: 1411 showstate = SWPOS_SHOW;1412 break;1411 showstate = SWPOS_SHOW; 1412 break; 1413 1413 case SW_SHOWNORMAL: 1414 showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;1415 break;1414 showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW; 1415 break; 1416 1416 } 1417 1417 return OSLibWinShowWindow(OS2HwndFrame, showstate); … … 1422 1422 { 1423 1423 Win32Window *window; 1424 ULONG setstate = 0;1424 ULONG setstate = 0; 1425 1425 1426 1426 switch(hwndInsertAfter) { 1427 1427 case HWND_BOTTOM: 1428 hwndInsertAfter = HWNDOS_BOTTOM;1429 break;1428 hwndInsertAfter = HWNDOS_BOTTOM; 1429 break; 1430 1430 case HWND_TOPMOST: //TODO 1431 1431 case HWND_NOTOPMOST: //TODO: 1432 1432 case HWND_TOP: 1433 hwndInsertAfter = HWNDOS_TOP;1434 break;1433 hwndInsertAfter = HWNDOS_TOP; 1434 break; 1435 1435 default: 1436 window = GetWindowFromHandle(hwndInsertAfter);1437 if(window) {1438 hwndInsertAfter = window->getOS2WindowHandle();1439 PRECT clientRect = window->getClientRect();1436 window = GetWindowFromHandle(hwndInsertAfter); 1437 if(window) { 1438 hwndInsertAfter = window->getOS2WindowHandle(); 1439 PRECT clientRect = window->getClientRect(); 1440 1440 1441 1441 #if 1 1442 if(x+cx > clientRect->right - clientRect->left) {1443 dprintf(("Adjusting cx from %d to %d", cx, (clientRect->right - clientRect->left) - x));1444 cx = (clientRect->right - clientRect->left) - x;1445 }1446 if(y+cy > clientRect->bottom - clientRect->top) {1447 dprintf(("Adjusting cy from %d to %d", cy, (clientRect->bottom - clientRect->top) - y));1448 cy = (clientRect->bottom - clientRect->top) - y;1449 }1442 if(x+cx > clientRect->right - clientRect->left) { 1443 dprintf(("Adjusting cx from %d to %d", cx, (clientRect->right - clientRect->left) - x)); 1444 cx = (clientRect->right - clientRect->left) - x; 1445 } 1446 if(y+cy > clientRect->bottom - clientRect->top) { 1447 dprintf(("Adjusting cy from %d to %d", cy, (clientRect->bottom - clientRect->top) - y)); 1448 cy = (clientRect->bottom - clientRect->top) - y; 1449 } 1450 1450 #endif 1451 //Correct coordinates if parent is a frame window (border adjustment) 1452 //TODO: Not quite right (Solitaire child window placement slightly wrong) 1453 if (window->isFrameWindow() && !(fuFlags & SWP_NOMOVE)) { 1454 if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() )) 1455 { 1456 x += GetSystemMetrics(SM_CXDLGFRAME); 1457 y -= GetSystemMetrics(SM_CYDLGFRAME); 1458 } 1459 else 1460 { 1461 if (HAS_THICKFRAME(window->getStyle())) 1462 { 1463 x += GetSystemMetrics(SM_CXFRAME); 1464 y -= GetSystemMetrics(SM_CYFRAME); 1465 } 1466 else 1467 if (window->getStyle() & WS_BORDER) 1468 { 1469 x += GetSystemMetrics(SM_CXBORDER); 1470 y -= GetSystemMetrics(SM_CYBORDER); 1471 } 1472 } 1473 } 1474 } 1475 else { 1476 dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter)); 1477 hwndInsertAfter = 0; 1478 } 1479 1480 break; 1451 #if 0 1452 //Correct coordinates if parent is a frame window (border adjustment) 1453 //TODO: Not quite right (Solitaire child window placement slightly wrong) 1454 if (window->isFrameWindow() && !(fuFlags & SWP_NOMOVE)) { 1455 if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() )) 1456 { 1457 x += GetSystemMetrics(SM_CXDLGFRAME); 1458 y -= GetSystemMetrics(SM_CYDLGFRAME); 1459 } 1460 else 1461 { 1462 if (HAS_THICKFRAME(window->getStyle())) 1463 { 1464 x += GetSystemMetrics(SM_CXFRAME); 1465 y -= GetSystemMetrics(SM_CYFRAME); 1466 } 1467 else 1468 if (window->getStyle() & WS_BORDER) 1469 { 1470 x += GetSystemMetrics(SM_CXBORDER); 1471 y -= GetSystemMetrics(SM_CYBORDER); 1472 } 1473 } 1474 } 1475 #endif 1476 } 1477 else { 1478 dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter)); 1479 hwndInsertAfter = 0; 1480 } 1481 1482 break; 1481 1483 1482 1484 } 1483 1485 setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER; 1484 1486 if(fuFlags & SWP_DRAWFRAME) 1485 setstate |= 0; //TODO1487 setstate |= 0; //TODO 1486 1488 if(fuFlags & SWP_FRAMECHANGED) 1487 setstate |= 0; //TODO1489 setstate |= 0; //TODO 1488 1490 if(fuFlags & SWP_HIDEWINDOW) 1489 setstate &= ~SWPOS_ZORDER;1491 setstate &= ~SWPOS_ZORDER; 1490 1492 if(fuFlags & SWP_NOACTIVATE) 1491 setstate &= ~SWPOS_ACTIVATE;1493 setstate &= ~SWPOS_ACTIVATE; 1492 1494 if(fuFlags & SWP_NOCOPYBITS) 1493 setstate |= 0;//TODO1495 setstate |= 0; //TODO 1494 1496 if(fuFlags & SWP_NOMOVE) 1495 setstate &= ~SWPOS_MOVE;1497 setstate &= ~SWPOS_MOVE; 1496 1498 if(fuFlags & SWP_NOSIZE) 1497 setstate &= ~SWPOS_SIZE;1499 setstate &= ~SWPOS_SIZE; 1498 1500 if(fuFlags & SWP_NOREDRAW) 1499 setstate |= SWPOS_NOREDRAW;1501 setstate |= SWPOS_NOREDRAW; 1500 1502 if(fuFlags & SWP_NOZORDER) 1501 setstate &= ~SWPOS_ZORDER;1503 setstate &= ~SWPOS_ZORDER; 1502 1504 if(fuFlags & SWP_SHOWWINDOW) 1503 setstate |= SWPOS_SHOW;1505 setstate |= SWPOS_SHOW; 1504 1506 1505 1507 //TODO send NCCREATE if size changed or SWP_FRAMECHANGED flag specified. … … 1520 1522 return getParent()->getWindowHandle(); 1521 1523 } 1522 else return 0;1524 else return 0; 1523 1525 } 1524 1526 //****************************************************************************** … … 1530 1532 1531 1533 if(getParent()) { 1532 oldhwnd = getParent()->getWindowHandle();1534 oldhwnd = getParent()->getWindowHandle(); 1533 1535 } 1534 1536 else oldhwnd = 0; … … 1536 1538 if(hwndNewParent == 0) {//desktop window = parent 1537 1539 setParent(NULL); 1538 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);1539 return oldhwnd;1540 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP); 1541 return oldhwnd; 1540 1542 } 1541 1543 newparent = GetWindowFromHandle(hwndNewParent); 1542 1544 if(newparent) 1543 1545 { 1544 setParent(newparent);1545 OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle());1546 return oldhwnd;1546 setParent(newparent); 1547 OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle()); 1548 return oldhwnd; 1547 1549 } 1548 1550 SetLastError(ERROR_INVALID_PARAMETER); … … 1556 1558 return getParent()->getWindowHandle() == hwndParent; 1557 1559 } 1558 else return 0;1560 else return 0; 1559 1561 } 1560 1562 //****************************************************************************** … … 1575 1577 if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect)) 1576 1578 {//update region not empty 1577 SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);1579 SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0); 1578 1580 } 1579 1581 return TRUE; … … 1591 1593 { 1592 1594 Win32Window *win32wnd; 1593 ULONG magic;1594 ULONG getcmd = 0;1595 HWND hwndRelated;1595 ULONG magic; 1596 ULONG getcmd = 0; 1597 HWND hwndRelated; 1596 1598 1597 1599 dprintf(("GetWindow %x %d NOT COMPLETE", getWindowHandle(), uCmd)); 1598 1600 switch(uCmd) 1599 1601 { 1600 case GW_CHILD:1601 getcmd = QWOS_TOP;1602 break;1603 case GW_HWNDFIRST:1604 if(getParent()) {1605 getcmd = QWOS_TOP; //top of child windows1606 }1607 else getcmd = QWOS_TOP; //TODO1608 break;1609 case GW_HWNDLAST:1610 if(getParent()) {1611 getcmd = QWOS_BOTTOM; //bottom of child windows1612 }1613 else getcmd = QWOS_BOTTOM; //TODO1614 break;1615 case GW_HWNDNEXT:1616 getcmd = QWOS_NEXT;1617 break;1618 case GW_HWNDPREV:1619 getcmd = QWOS_PREV;1620 break;1621 case GW_OWNER:1622 if(owner) {1623 return owner->getWindowHandle();1624 }1625 else return 0;1602 case GW_CHILD: 1603 getcmd = QWOS_TOP; 1604 break; 1605 case GW_HWNDFIRST: 1606 if(getParent()) { 1607 getcmd = QWOS_TOP; //top of child windows 1608 } 1609 else getcmd = QWOS_TOP; //TODO 1610 break; 1611 case GW_HWNDLAST: 1612 if(getParent()) { 1613 getcmd = QWOS_BOTTOM; //bottom of child windows 1614 } 1615 else getcmd = QWOS_BOTTOM; //TODO 1616 break; 1617 case GW_HWNDNEXT: 1618 getcmd = QWOS_NEXT; 1619 break; 1620 case GW_HWNDPREV: 1621 getcmd = QWOS_PREV; 1622 break; 1623 case GW_OWNER: 1624 if(owner) { 1625 return owner->getWindowHandle(); 1626 } 1627 else return 0; 1626 1628 } 1627 1629 hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd); 1628 1630 if(hwndRelated) 1629 1631 { 1630 win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);1631 magic= OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);1632 if(CheckMagicDword(magic) && win32wnd)1633 {1634 return win32wnd->getWindowHandle();1635 }1632 win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR); 1633 magic = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC); 1634 if(CheckMagicDword(magic) && win32wnd) 1635 { 1636 return win32wnd->getWindowHandle(); 1637 } 1636 1638 } 1637 1639 return 0; … … 1660 1662 HWND Win32Window::GetActiveWindow() 1661 1663 { 1662 HWND hwndActive;1664 HWND hwndActive; 1663 1665 Win32Window *win32wnd; 1664 ULONG magic;1666 ULONG magic; 1665 1667 1666 1668 hwndActive = OSLibWinQueryActiveWindow(); … … 1723 1725 1724 1726 switch(index) { 1725 case GWL_EXSTYLE:1726 oldval = dwExStyle;1727 dwExStyle = value;1728 return oldval;1729 case GWL_STYLE:1730 oldval = dwStyle;1731 dwStyle = value;1732 return oldval;1733 case GWL_WNDPROC:1734 oldval = (LONG)getWindowProc();1735 setWindowProc((WNDPROC)value);1736 return oldval;1737 case GWL_HINSTANCE:1738 oldval = hInstance;1739 hInstance = value;1740 return oldval;1741 case GWL_HWNDPARENT:1742 return SetParent((HWND)value);1743 1744 case GWL_ID:1745 oldval = getWindowId();1746 setWindowId(value);1747 return oldval;1748 case GWL_USERDATA:1749 oldval = userData;1750 userData = value;1751 return oldval;1752 default:1753 if(index >= 0 && index/4 < nrUserWindowLong)1754 {1755 oldval = userWindowLong[index/4];1756 userWindowLong[index/4] = value;1757 return oldval;1758 }1759 SetLastError(ERROR_INVALID_PARAMETER);1760 return 0;1727 case GWL_EXSTYLE: 1728 oldval = dwExStyle; 1729 dwExStyle = value; 1730 return oldval; 1731 case GWL_STYLE: 1732 oldval = dwStyle; 1733 dwStyle = value; 1734 return oldval; 1735 case GWL_WNDPROC: 1736 oldval = (LONG)getWindowProc(); 1737 setWindowProc((WNDPROC)value); 1738 return oldval; 1739 case GWL_HINSTANCE: 1740 oldval = hInstance; 1741 hInstance = value; 1742 return oldval; 1743 case GWL_HWNDPARENT: 1744 return SetParent((HWND)value); 1745 1746 case GWL_ID: 1747 oldval = getWindowId(); 1748 setWindowId(value); 1749 return oldval; 1750 case GWL_USERDATA: 1751 oldval = userData; 1752 userData = value; 1753 return oldval; 1754 default: 1755 if(index >= 0 && index/4 < nrUserWindowLong) 1756 { 1757 oldval = userWindowLong[index/4]; 1758 userWindowLong[index/4] = value; 1759 return oldval; 1760 } 1761 SetLastError(ERROR_INVALID_PARAMETER); 1762 return 0; 1761 1763 } 1762 1764 } … … 1766 1768 { 1767 1769 switch(index) { 1768 case GWL_EXSTYLE:1769 return dwExStyle;1770 case GWL_STYLE:1771 return dwStyle;1772 case GWL_WNDPROC:1773 return (ULONG)getWindowProc();1774 case GWL_HINSTANCE:1775 return hInstance;1776 case GWL_HWNDPARENT:1777 if(getParent()) {1778 return getParent()->getWindowHandle();1779 }1780 elsereturn 0;1781 case GWL_ID:1782 return getWindowId();1783 case GWL_USERDATA:1784 return userData;1785 default:1786 if(index >= 0 && index/4 < nrUserWindowLong)1787 {1788 return userWindowLong[index/4];1789 }1790 SetLastError(ERROR_INVALID_PARAMETER);1791 return 0;1770 case GWL_EXSTYLE: 1771 return dwExStyle; 1772 case GWL_STYLE: 1773 return dwStyle; 1774 case GWL_WNDPROC: 1775 return (ULONG)getWindowProc(); 1776 case GWL_HINSTANCE: 1777 return hInstance; 1778 case GWL_HWNDPARENT: 1779 if(getParent()) { 1780 return getParent()->getWindowHandle(); 1781 } 1782 else return 0; 1783 case GWL_ID: 1784 return getWindowId(); 1785 case GWL_USERDATA: 1786 return userData; 1787 default: 1788 if(index >= 0 && index/4 < nrUserWindowLong) 1789 { 1790 return userWindowLong[index/4]; 1791 } 1792 SetLastError(ERROR_INVALID_PARAMETER); 1793 return 0; 1792 1794 } 1793 1795 } … … 1800 1802 if(index >= 0 && index/4 < nrUserWindowLong) 1801 1803 { 1802 oldval = ((WORD *)userWindowLong)[index/2];1803 ((WORD *)userWindowLong)[index/2] = value;1804 return oldval;1804 oldval = ((WORD *)userWindowLong)[index/2]; 1805 ((WORD *)userWindowLong)[index/2] = value; 1806 return oldval; 1805 1807 } 1806 1808 SetLastError(ERROR_INVALID_PARAMETER); … … 1813 1815 if(index >= 0 && index/4 < nrUserWindowLong) 1814 1816 { 1815 return ((WORD *)userWindowLong)[index/2];1817 return ((WORD *)userWindowLong)[index/2]; 1816 1818 } 1817 1819 SetLastError(ERROR_INVALID_PARAMETER); … … 1838 1840 { 1839 1841 Win32Window *win32wnd; 1840 DWORD magic;1842 DWORD magic; 1841 1843 1842 1844 win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwnd, OFFSET_WIN32WNDPTR);
Note:
See TracChangeset
for help on using the changeset viewer.
