- Timestamp:
- Jul 26, 1999, 11:01:34 AM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/oslibres.cpp
r396 r397 1 /* $Id: oslibres.cpp,v 1. 3 1999-07-25 20:00:52 cbratschiExp $ */1 /* $Id: oslibres.cpp,v 1.4 1999-07-26 09:01:33 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 61 61 HPS hps; 62 62 63 if(iconbitmap == NULL) { 64 dprintf(("OSLibWinSetIcon %x %x: iconbitmap == NULL!!", hwnd, hIcon)); 65 return 0; 66 } 63 67 if(hIcon == 0) { 64 if (!iconbitmap) return 0; //CB: or load a default icon 65 66 //skip xor/and mask 67 bfh = (BITMAPFILEHEADER2 *)((char *)&bafh->bfh2 + sizeof(RGB2)*2 + sizeof(BITMAPFILEHEADER2)); 68 hps = WinGetPS(hwnd); 69 hbmColor = GpiCreateBitmap(hps, &bfh->bmp2, CBM_INIT, 70 (char *)bafh + bfh->offBits, 71 (BITMAPINFO2 *)&bfh->bmp2); 72 if(hbmColor == GPI_ERROR) { 73 dprintf(("OSLibWinSetIcon: GpiCreateBitmap failed!")); 74 WinReleasePS(hps); 75 return 0; 76 } 77 hbmMask = GpiCreateBitmap(hps, &bafh->bfh2.bmp2, CBM_INIT, 78 (char *)bafh + bafh->bfh2.offBits, 79 (BITMAPINFO2 *)&bafh->bfh2.bmp2); 80 if(hbmMask == GPI_ERROR) { 81 dprintf(("OSLibWinSetIcon: GpiCreateBitmap hbmMask failed!")); 82 WinReleasePS(hps); 83 return 0; 84 } 85 86 pointerInfo.fPointer = FALSE; //icon 87 pointerInfo.xHotspot = bfh->xHotspot; 88 pointerInfo.yHotspot = bfh->yHotspot; 89 pointerInfo.hbmColor = hbmColor; 90 pointerInfo.hbmPointer = hbmMask; 91 hIcon = WinCreatePointerIndirect(HWND_DESKTOP, &pointerInfo); 92 if(hIcon == NULL) { 93 dprintf(("WinSetIcon: WinCreatePointerIndirect failed!")); 94 GpiDeleteBitmap(hbmMask); 95 GpiDeleteBitmap(hbmColor); 96 WinReleasePS(hps); 97 } 68 //skip xor/and mask 69 bfh = (BITMAPFILEHEADER2 *)((char *)&bafh->bfh2 + sizeof(RGB2)*2 + sizeof(BITMAPFILEHEADER2)); 70 hps = WinGetPS(hwnd); 71 hbmColor = GpiCreateBitmap(hps, &bfh->bmp2, CBM_INIT, 72 (char *)bafh + bfh->offBits, 73 (BITMAPINFO2 *)&bfh->bmp2); 74 if(hbmColor == GPI_ERROR) { 75 dprintf(("OSLibWinSetIcon: GpiCreateBitmap failed!")); 76 WinReleasePS(hps); 77 return 0; 78 } 79 hbmMask = GpiCreateBitmap(hps, &bafh->bfh2.bmp2, CBM_INIT, 80 (char *)bafh + bafh->bfh2.offBits, 81 (BITMAPINFO2 *)&bafh->bfh2.bmp2); 82 if(hbmMask == GPI_ERROR) { 83 dprintf(("OSLibWinSetIcon: GpiCreateBitmap hbmMask failed!")); 84 WinReleasePS(hps); 85 return 0; 86 } 87 88 pointerInfo.fPointer = FALSE; //icon 89 pointerInfo.xHotspot = bfh->xHotspot; 90 pointerInfo.yHotspot = bfh->yHotspot; 91 pointerInfo.hbmColor = hbmColor; 92 pointerInfo.hbmPointer = hbmMask; 93 hIcon = WinCreatePointerIndirect(HWND_DESKTOP, &pointerInfo); 94 if(hIcon == NULL) { 95 dprintf(("WinSetIcon: WinCreatePointerIndirect failed!")); 96 GpiDeleteBitmap(hbmMask); 97 GpiDeleteBitmap(hbmColor); 98 WinReleasePS(hps); 99 } 98 100 } 99 101 WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0); 102 WinReleasePS(hps); 100 103 return hIcon; 101 104 } -
trunk/src/user32/new/oslibwin.cpp
r385 r397 1 /* $Id: oslibwin.cpp,v 1. 19 1999-07-24 14:01:44 sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.20 1999-07-26 09:01:34 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 48 48 pszName = NULL; 49 49 } 50 if(hwndParent == 0) {50 if(hwndParent == OSLIB_HWND_DESKTOP) { 51 51 hwndParent = HWND_DESKTOP; 52 52 } 53 if(Owner == OSLIB_HWND_DESKTOP) { 54 Owner = HWND_DESKTOP; 55 } 56 53 57 if(dwFrameStyle) { 54 58 dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs … … 56 60 dwFrameStyle |= FCF_TITLEBAR; 57 61 62 dwFrameStyle |= FCF_TASKLIST; 58 63 *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle, 59 64 &dwFrameStyle, WIN32_STDCLASS, … … 76 81 //****************************************************************************** 77 82 //****************************************************************************** 78 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle)83 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle) 79 84 { 80 85 *OSWinStyle = 0; … … 121 126 *OSFrameStyle |= FCF_MAXBUTTON; 122 127 128 if(dwExStyle & WINWS_EX_DLGMODALFRAME) 129 *OSFrameStyle |= FCF_DLGBORDER; 130 123 131 return TRUE; 124 132 } … … 217 225 { 218 226 HWND hwndParent = hwndInsertBehind; 219 220 if(fl & SWP_MOVE) { 227 BOOL rc; 228 229 if(fl & SWP_MOVE) { 221 230 switch(hwndParent) 222 231 { … … 227 236 } 228 237 y = MapOS2ToWin32Y(hwndParent, cy, y); 229 } 230 dprintf(("WinSetWindowPos %x %x %d %d %d %d %x", hwnd, hwndInsertBehind, x, y, cx, cy, fl)); 231 return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl); 238 } 239 rc = WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl); 240 dprintf(("WinSetWindowPos %x %x %d %d %d %d %x returned %d (%x)", hwnd, hwndInsertBehind, x, y, cx, cy, fl, rc, WinGetLastError(GetThreadHAB()))); 241 return rc; 232 242 } 233 243 //****************************************************************************** -
trunk/src/user32/new/oslibwin.h
r385 r397 1 /* $Id: oslibwin.h,v 1.1 7 1999-07-24 14:01:44 sandervl Exp $ */1 /* $Id: oslibwin.h,v 1.18 1999-07-26 09:01:34 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 20 20 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame); 21 21 22 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle);22 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle); 23 23 24 24 BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value); -
trunk/src/user32/new/pmwindow.cpp
r395 r397 1 /* $Id: pmwindow.cpp,v 1.1 6 1999-07-25 17:47:24 sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.17 1999-07-26 09:01:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 231 231 break; 232 232 } 233 dprintf(("OS2: WM_SIZE %x %x (%d,%d) (%d,%d) ", hwnd, swp.fl, swp.x, swp.y, swp.cx, swp.cy));233 dprintf(("OS2: WM_SIZE %x %x (%d,%d) (%d,%d) (%d,%d)", hwnd, swp.fl, swp.x, swp.y, swp.cx, swp.cy, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2))); 234 234 if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), 235 235 (swp.fl & SWP_MINIMIZE) != 0, -
trunk/src/user32/new/win32wnd.cpp
r392 r397 1 /* $Id: win32wnd.cpp,v 1.2 2 1999-07-25 15:51:56sandervl Exp $ */1 /* $Id: win32wnd.cpp,v 1.23 1999-07-26 09:01:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 41 41 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME)) 42 42 43 #define HAS_BORDER(style, exStyle) \ 44 ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle)) 45 43 46 //****************************************************************************** 44 47 //****************************************************************************** … … 235 238 } 236 239 240 if (cs->x < 0) cs->x = 0; 241 if (cs->y < 0) cs->y = 0; 242 237 243 //Allocate window words 238 244 nrUserWindowLong = windowClass->getExtraWndWords(); … … 345 351 DWORD dwOSWinStyle, dwOSFrameStyle; 346 352 347 OSLibWinConvertStyle(cs->style, &dwOSWinStyle, &dwOSFrameStyle); 348 349 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : 0, 353 OSLibWinConvertStyle(cs->style, cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle); 354 355 //TODO: Test 356 #if 1 357 if(cs->style & WS_CHILD) { 358 dwOSFrameStyle = 0; 359 } 360 #endif 361 362 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP, 350 363 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName, 351 (owner) ? owner->getOS2 WindowHandle() : 0,364 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP, 352 365 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 353 366 &OS2HwndFrame); … … 378 391 } 379 392 #endif 393 380 394 /* Set the window menu */ 381 395 if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION ) … … 396 410 SetIcon(windowClass->getIcon()); 397 411 412 if(getParent()) { 413 SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top, 414 rectClient.right-rectClient.left, 415 rectClient.bottom-rectClient.top, 416 SWP_NOACTIVATE); 417 } 418 else { 419 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top, 420 rectClient.right-rectClient.left, 421 rectClient.bottom-rectClient.top, 422 SWP_NOACTIVATE); 423 } 424 //Get the client window rectangle 425 GetClientRect(Win32Hwnd, &rectClient); 426 398 427 /* Send the WM_CREATE message 399 428 * Perhaps we shouldn't allow width/height changes as well. … … 404 433 if(SendInternalMessage(WM_NCCREATE, 0, (LPARAM)cs) ) 405 434 { 435 //doesn't work right, messes up client rectangle 436 #if 0 406 437 SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient ); 438 #endif 407 439 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top); 408 440 dprintf(("Sending WM_CREATE")); … … 415 447 SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 416 448 } 417 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,418 rectClient.right-rectClient.left,419 rectClient.bottom-rectClient.top,420 SWP_NOACTIVATE);421 449 if (cs->style & WS_VISIBLE) ShowWindow( sw ); 422 450 … … 432 460 } 433 461 } 462 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0); 463 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0); 464 DestroyWindow(); 434 465 return FALSE; 435 466 } … … 469 500 else 470 501 flags &= ~WIN_RESTORE_MAX; 471 dwStyle |= WS_MINIMIZE;502 dwStyle |= WS_MINIMIZE; 472 503 473 504 #if 0 … … 680 711 ULONG Win32Window::MsgEnable(BOOL fEnable) 681 712 { 682 return SendInternalMessageA(WM_ENABLE, fEnable, 0);713 return SendInternalMessageA(WM_ENABLE, fEnable, 0); 683 714 } 684 715 //****************************************************************************** … … 687 718 ULONG Win32Window::MsgShow(BOOL fShow) 688 719 { 689 return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);720 return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0); 690 721 } 691 722 //****************************************************************************** … … 693 724 ULONG Win32Window::MsgMove(ULONG x, ULONG y) 694 725 { 695 dprintf(("MsgMove to (%d,%d)", x, y)); 696 return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y)); 726 dprintf(("MsgMove to (%d,%d)", x, y)); 727 if(fCreated == FALSE) { 728 return 1; 729 } 730 731 return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y)); 697 732 } 698 733 //****************************************************************************** … … 1352 1387 ULONG setstate = 0; 1353 1388 1354 switch(hwndInsertAfter) {1389 switch(hwndInsertAfter) { 1355 1390 case HWND_BOTTOM: 1356 1391 hwndInsertAfter = HWNDOS_BOTTOM; … … 1365 1400 if(window) { 1366 1401 hwndInsertAfter = window->getOS2WindowHandle(); 1402 PRECT clientRect = window->getClientRect(); 1403 1404 #if 0 1405 if(x+cx > clientRect->right - clientRect->left) { 1406 cx = (clientRect->right - clientRect->left) - x; 1407 } 1408 if(y+cy > clientRect->bottom - clientRect->top) { 1409 cy = (clientRect->bottom - clientRect->top) - y; 1410 } 1411 #endif 1412 //TODO: Not quite right (Solitaire child window placement slightly wrong) 1413 if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() )) 1414 { 1415 x += GetSystemMetrics(SM_CXDLGFRAME); 1416 y -= GetSystemMetrics(SM_CYDLGFRAME); 1417 } 1418 else 1419 { 1420 if (HAS_THICKFRAME(window->getStyle())) 1421 { 1422 x += GetSystemMetrics(SM_CXFRAME); 1423 y -= GetSystemMetrics(SM_CYFRAME); 1424 } 1425 if (window->getStyle() & WS_BORDER) 1426 { 1427 x += GetSystemMetrics(SM_CXBORDER); 1428 y -= GetSystemMetrics(SM_CYBORDER); 1429 } 1430 } 1367 1431 } 1368 1432 else { … … 1370 1434 hwndInsertAfter = 0; 1371 1435 } 1436 1372 1437 break; 1373 1438 1374 } 1375 setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER; 1376 if(fuFlags & SWP_DRAWFRAME) 1377 setstate |= 0; //TODO 1378 if(fuFlags & SWP_FRAMECHANGED) 1379 setstate |= 0; //TODO 1380 if(fuFlags & SWP_HIDEWINDOW) 1381 setstate &= ~SWPOS_ZORDER; 1382 if(fuFlags & SWP_NOACTIVATE) 1383 setstate &= ~SWPOS_ACTIVATE; 1384 if(fuFlags & SWP_NOCOPYBITS) 1385 setstate |= 0; //TODO 1386 if(fuFlags & SWP_NOMOVE) 1387 setstate &= ~SWPOS_MOVE; 1388 if(fuFlags & SWP_NOSIZE) 1389 setstate &= ~SWPOS_SIZE; 1390 if(fuFlags & SWP_NOREDRAW) 1391 setstate |= SWPOS_NOREDRAW; 1392 if(fuFlags & SWP_NOZORDER) 1393 setstate &= ~SWPOS_ZORDER; 1394 if(fuFlags & SWP_SHOWWINDOW) 1395 setstate |= SWPOS_SHOW; 1396 1397 return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate); 1439 } 1440 setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER; 1441 if(fuFlags & SWP_DRAWFRAME) 1442 setstate |= 0; //TODO 1443 if(fuFlags & SWP_FRAMECHANGED) 1444 setstate |= 0; //TODO 1445 if(fuFlags & SWP_HIDEWINDOW) 1446 setstate &= ~SWPOS_ZORDER; 1447 if(fuFlags & SWP_NOACTIVATE) 1448 setstate &= ~SWPOS_ACTIVATE; 1449 if(fuFlags & SWP_NOCOPYBITS) 1450 setstate |= 0; //TODO 1451 if(fuFlags & SWP_NOMOVE) 1452 setstate &= ~SWPOS_MOVE; 1453 if(fuFlags & SWP_NOSIZE) 1454 setstate &= ~SWPOS_SIZE; 1455 if(fuFlags & SWP_NOREDRAW) 1456 setstate |= SWPOS_NOREDRAW; 1457 if(fuFlags & SWP_NOZORDER) 1458 setstate &= ~SWPOS_ZORDER; 1459 if(fuFlags & SWP_SHOWWINDOW) 1460 setstate |= SWPOS_SHOW; 1461 1462 //TODO send NCCREATE if size changed or SWP_FRAMECHANGED flag specified. 1463 return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate); 1398 1464 } 1399 1465 //****************************************************************************** -
trunk/src/user32/new/win32wnd.h
r392 r397 1 /* $Id: win32wnd.h,v 1. 19 1999-07-25 15:51:56sandervl Exp $ */1 /* $Id: win32wnd.h,v 1.20 1999-07-26 09:01:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 96 96 ULONG getWindowHeight() { return rectClient.bottom - rectClient.top; }; 97 97 BOOL isChild(); 98 PRECT getClientRect() { return &rectClient; }; 99 PRECT getWindowRect() { return &rectWindow; }; 98 100 99 101 DWORD getFlags() { return flags; }; -
trunk/src/user32/new/window.cpp
r395 r397 1 /* $Id: window.cpp,v 1.1 2 1999-07-25 17:47:25sandervl Exp $ */1 /* $Id: window.cpp,v 1.13 1999-07-26 09:01:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 65 65 cs.lpszClass = className; 66 66 cs.dwExStyle = exStyle; 67 dprintf(("CreateWindowExA: (%d,%d) (%d,%d), %x %x", x, y, width, height, style, exStyle)); 67 68 window = new Win32Window( &cs, classAtom, FALSE ); 68 69 if(window == NULL) … … 616 617 BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect) 617 618 { 618 #ifdef DEBUG 619 WriteLog("USER32: GetClientRect of %X\n", hwnd); 620 #endif 619 BOOL rc; 620 621 621 hwnd = Win32Window::Win32ToOS2Handle(hwnd); 622 return OSLibWinQueryWindowRect(hwnd, pRect); 622 rc = OSLibWinQueryWindowRect(hwnd, pRect); 623 dprintf(("USER32: GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom)); 624 return rc; 623 625 } 624 626 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.