Changeset 397 for trunk/src


Ignore:
Timestamp:
Jul 26, 1999, 11:01:34 AM (26 years ago)
Author:
sandervl
Message:

* empty log message *

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 cbratschi Exp $ */
     1/* $Id: oslibres.cpp,v 1.4 1999-07-26 09:01:33 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    6161 HPS         hps;
    6262
     63    if(iconbitmap == NULL) {
     64        dprintf(("OSLibWinSetIcon %x %x: iconbitmap == NULL!!", hwnd, hIcon));
     65        return 0;
     66    }
    6367    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            }
    98100    }
    99101    WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0);
     102    WinReleasePS(hps);
    100103    return hIcon;
    101104}
  • 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 $ */
    22/*
    33 * Window API wrappers for OS/2
     
    4848        pszName = NULL;
    4949  }
    50   if(hwndParent == 0) {
     50  if(hwndParent == OSLIB_HWND_DESKTOP) {
    5151        hwndParent = HWND_DESKTOP;
    5252  }
     53  if(Owner == OSLIB_HWND_DESKTOP) {
     54        Owner = HWND_DESKTOP;
     55  }
     56
    5357  if(dwFrameStyle) {
    5458        dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs
     
    5660                dwFrameStyle |= FCF_TITLEBAR;
    5761
     62        dwFrameStyle |= FCF_TASKLIST;
    5863        *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
    5964                                       &dwFrameStyle, WIN32_STDCLASS,
     
    7681//******************************************************************************
    7782//******************************************************************************
    78 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle)
     83BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle)
    7984{
    8085  *OSWinStyle   = 0;
     
    121126        *OSFrameStyle |= FCF_MAXBUTTON;
    122127
     128  if(dwExStyle & WINWS_EX_DLGMODALFRAME)
     129        *OSFrameStyle |= FCF_DLGBORDER;
     130
    123131  return TRUE;
    124132}
     
    217225{
    218226 HWND hwndParent = hwndInsertBehind;
    219 
    220   if(fl & SWP_MOVE) {
     227 BOOL rc;
     228
     229    if(fl & SWP_MOVE) {
    221230        switch(hwndParent)
    222231        {
     
    227236        }
    228237        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;
    232242}
    233243//******************************************************************************
  • trunk/src/user32/new/oslibwin.h

    r385 r397  
    1 /* $Id: oslibwin.h,v 1.17 1999-07-24 14:01:44 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.18 1999-07-26 09:01:34 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    2020                           char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame);
    2121
    22 BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle);
     22BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle);
    2323
    2424BOOL  OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value);
  • trunk/src/user32/new/pmwindow.cpp

    r395 r397  
    1 /* $Id: pmwindow.cpp,v 1.16 1999-07-25 17:47:24 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.17 1999-07-26 09:01:34 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    231231                break;
    232232        }
    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)));
    234234        if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2),
    235235                                (swp.fl & SWP_MINIMIZE) != 0,
  • trunk/src/user32/new/win32wnd.cpp

    r392 r397  
    1 /* $Id: win32wnd.cpp,v 1.22 1999-07-25 15:51:56 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.23 1999-07-26 09:01:34 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    4141     !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
    4242
     43#define HAS_BORDER(style, exStyle) \
     44    ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle))
     45
    4346//******************************************************************************
    4447//******************************************************************************
     
    235238  }
    236239
     240  if (cs->x < 0) cs->x = 0;
     241  if (cs->y < 0) cs->y = 0;
     242
    237243  //Allocate window words
    238244  nrUserWindowLong = windowClass->getExtraWndWords();
     
    345351  DWORD dwOSWinStyle, dwOSFrameStyle;
    346352
    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,
    350363                                 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
    351                                  (owner) ? owner->getOS2WindowHandle() : 0,
     364                                 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP,
    352365                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    353366                                 &OS2HwndFrame);
     
    378391  }
    379392#endif
     393
    380394  /* Set the window menu */
    381395  if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
     
    396410        SetIcon(windowClass->getIcon());
    397411
     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
    398427  /* Send the WM_CREATE message
    399428   * Perhaps we shouldn't allow width/height changes as well.
     
    404433  if(SendInternalMessage(WM_NCCREATE, 0, (LPARAM)cs) )
    405434  {
     435  //doesn't work right, messes up client rectangle
     436#if 0
    406437        SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient );
     438#endif
    407439        OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);
    408440        dprintf(("Sending WM_CREATE"));
     
    415447                SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );
    416448            }
    417             SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
    418                          rectClient.right-rectClient.left,
    419                          rectClient.bottom-rectClient.top,
    420                          SWP_NOACTIVATE);
    421449            if (cs->style & WS_VISIBLE) ShowWindow( sw );
    422450
     
    432460        }
    433461  }
     462  OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0);
     463  OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0);
     464  DestroyWindow();
    434465  return FALSE;
    435466}
     
    469500                 else
    470501             flags &= ~WIN_RESTORE_MAX;
    471          dwStyle |= WS_MINIMIZE;
     502             dwStyle |= WS_MINIMIZE;
    472503
    473504#if 0
     
    680711ULONG Win32Window::MsgEnable(BOOL fEnable)
    681712{
    682   return SendInternalMessageA(WM_ENABLE, fEnable, 0);
     713    return SendInternalMessageA(WM_ENABLE, fEnable, 0);
    683714}
    684715//******************************************************************************
     
    687718ULONG Win32Window::MsgShow(BOOL fShow)
    688719{
    689   return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
     720    return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
    690721}
    691722//******************************************************************************
     
    693724ULONG Win32Window::MsgMove(ULONG x, ULONG y)
    694725{
    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));
    697732}
    698733//******************************************************************************
     
    13521387 ULONG        setstate = 0;
    13531388
    1354   switch(hwndInsertAfter) {
     1389    switch(hwndInsertAfter) {
    13551390    case HWND_BOTTOM:
    13561391        hwndInsertAfter = HWNDOS_BOTTOM;
     
    13651400        if(window) {
    13661401            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            }
    13671431        }
    13681432        else {
     
    13701434            hwndInsertAfter = 0;
    13711435        }
     1436
    13721437        break;
    13731438
    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);
    13981464}
    13991465//******************************************************************************
  • trunk/src/user32/new/win32wnd.h

    r392 r397  
    1 /* $Id: win32wnd.h,v 1.19 1999-07-25 15:51:56 sandervl Exp $ */
     1/* $Id: win32wnd.h,v 1.20 1999-07-26 09:01:34 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    9696         ULONG  getWindowHeight()               { return rectClient.bottom - rectClient.top; };
    9797         BOOL   isChild();
     98         PRECT  getClientRect()                 { return &rectClient; };
     99         PRECT  getWindowRect()                 { return &rectWindow; };
    98100
    99101         DWORD  getFlags()                      { return flags; };
  • trunk/src/user32/new/window.cpp

    r395 r397  
    1 /* $Id: window.cpp,v 1.12 1999-07-25 17:47:25 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.13 1999-07-26 09:01:34 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    6565    cs.lpszClass      = className;
    6666    cs.dwExStyle      = exStyle;
     67    dprintf(("CreateWindowExA: (%d,%d) (%d,%d), %x %x", x, y, width, height, style, exStyle));
    6768    window = new Win32Window( &cs, classAtom, FALSE );
    6869    if(window == NULL)
     
    616617BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect)
    617618{
    618 #ifdef DEBUG
    619     WriteLog("USER32:  GetClientRect of %X\n", hwnd);
    620 #endif
     619 BOOL rc;
     620
    621621    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;
    623625}
    624626//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.