Changeset 715 for trunk/src


Ignore:
Timestamp:
Aug 27, 1999, 7:50:57 PM (26 years ago)
Author:
dengert
Message:

window creation, positioning, sizing

Location:
trunk/src/user32/new
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/oslibwin.cpp

    r693 r715  
    1 /* $Id: oslibwin.cpp,v 1.24 1999-08-25 15:08:50 dengert Exp $ */
     1/* $Id: oslibwin.cpp,v 1.25 1999-08-27 17:50:56 dengert Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    6464                dwFrameStyle |= FCF_TITLEBAR;
    6565
    66         dwFrameStyle |= FCF_TASKLIST;
     66        dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER | FCF_NOBYTEALIGN;
    6767        *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
    6868                                       &dwFrameStyle, WIN32_STDCLASS,
     
    403403//******************************************************************************
    404404//******************************************************************************
    405 void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, ULONG parentHeight)
     405void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
    406406{
    407407   HWND hWindow            = pswp->hwnd;
     
    412412   long cy                 = pswp->cy;
    413413   UINT fuFlags            = (UINT)pswp->fl;
     414   ULONG parentHeight;
    414415
    415416   HWND  hWinAfter;
     
    457458   if ( fuFlags & (SWP_MOVE | SWP_SIZE) )
    458459   {
     460      if (hParent == NULLHANDLE)
     461      {
     462        ULONG Offset;
     463        POINTL pt = {0, 0};
     464
     465        Offset = OSLibGetWindowHeight(hFrame) - cy;
     466        parentHeight = ScreenHeight;
     467
     468        cx += 2 * x;
     469        cy += Offset;
     470        WinMapWindowPoints (hFrame, HWND_DESKTOP, &pt, 1);
     471        x = pt.x;
     472        y = pt.y;
     473
     474        pswpOld->cx += 2 * pswpOld->x;
     475        pswpOld->cy += Offset;
     476        pswpOld->x   = pt.x;
     477        pswpOld->y   = pt.y;
     478      }
     479      else
     480      {
     481        parentHeight = OSLibGetWindowHeight(hParent);
     482      }
     483
    459484      if (fuFlags & SWP_SIZE)
    460485      {
     
    485510      // relative to top left of parent.
    486511      //********************************************************
    487       y = parentHeight - y - cy;
    488 
    489       LONG oldY = parentHeight - pswpOld->y - pswpOld->cy;
     512      y          = parentHeight - y - cy;
     513      LONG oldY  = parentHeight - pswpOld->y - pswpOld->cy;
    490514
    491515      // Set the SWP_NOMOVE_W flag if the window has not moved in windows
     
    498522         flags |= SWP_NOSIZE_W;
    499523   }
     524
     525   if (hParent == NULLHANDLE)
     526   {
     527       pswpOld->x  = x + pswp->x;
     528       pswpOld->y  = y + cy - pswp->y - pswp->cy;
     529   }
     530   else {
     531       pswpOld->x  = pswp->x;
     532       pswpOld->y  = parentHeight - pswp->y - cy;
     533   }
     534   pswpOld->cx = pswp->cx;
     535   pswpOld->cy = pswp->cy;
     536
     537dprintf(("window (%d,%d)(%d,%d)  client (%d,%d)(%d,%d)",
     538         x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
    500539
    501540   // Fill in the WINDOWPOS structure with the now calculated PM values.
     
    510549//******************************************************************************
    511550//******************************************************************************
    512 void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, ULONG parentHeight)
     551void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
    513552{
    514553   HWND hWnd              = pwpos->hwnd;
     
    519558   long cy                = pwpos->cy;
    520559   UINT fuFlags           = pwpos->flags;
     560   ULONG parentHeight;
    521561
    522562   HWND  hWinAfter;
     
    571611   if ( flags & (SWP_MOVE | SWP_SIZE) )
    572612   {
     613      if (hParent == NULLHANDLE)
     614        parentHeight = ScreenHeight;
     615      else
     616        parentHeight = OSLibGetWindowHeight(hParent);
     617
    573618      //**********************************************************
    574619      // We'll need both a y and cy for the Y inversion code.
     
    617662   }
    618663
    619    // Fill in the WINDOWPOS structure with the now calculated PM values.
     664   // Fill in the SWP structure with the now calculated PM values.
    620665   pswp->fl               = flags;
    621666   pswp->cy               = cy;
  • trunk/src/user32/new/oslibwin.h

    r693 r715  
    1 /* $Id: oslibwin.h,v 1.21 1999-08-25 15:08:50 dengert Exp $ */
     1/* $Id: oslibwin.h,v 1.22 1999-08-27 17:50:56 dengert Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    234234
    235235BOOL  OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp);
    236 void  OSLibMapSWPtoWINDOWPOS(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, ULONG parentHeight);
    237 void  OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, ULONG parentHeight);
     236void  OSLibMapSWPtoWINDOWPOS(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame);
     237void  OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame);
    238238
    239239#endif //__OSLIBWIN_H__
  • trunk/src/user32/new/pmwindow.cpp

    r693 r715  
    1 /* $Id: pmwindow.cpp,v 1.21 1999-08-25 15:08:50 dengert Exp $ */
     1/* $Id: pmwindow.cpp,v 1.22 1999-08-27 17:50:56 dengert Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    179179      WINDOWPOS wp;
    180180      ULONG    parentHeight = 0;
     181      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
    181182
    182183        dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    183184
     185        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
     186
    184187        WinQueryWindowPos(hwnd, &swpOld);
    185188
    186189        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    187             parentHeight = (win32wnd->isChild()) ?
    188                 OSLibGetWindowHeight(win32wnd->getParent()->getOS2WindowHandle())
    189               : OSLibQueryScreenHeight();
    190         }
    191         OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, parentHeight);
     190            if (win32wnd->isChild())
     191                hParent = win32wnd->getParent()->getOS2WindowHandle();
     192            else
     193                hFrame = win32wnd->getOS2FrameWindowHandle();
     194        }
     195        OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, hFrame);
     196
    192197        wp.hwnd = win32wnd->getWindowHandle();
    193198        if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
     
    202207    case WM_WINDOWPOSCHANGED:
    203208    {
    204       PSWP      pswp = (PSWP)mp1;
     209      PSWP      pswp  = (PSWP)mp1;
     210      PSWP      pswpo = pswp + 1;
    205211      WINDOWPOS wp;
    206212      ULONG     parentHeight = 0;
     213      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
    207214
    208215        dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     216
     217        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
     218
    209219        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    210             parentHeight = (win32wnd->isChild()) ?
    211                 OSLibGetWindowHeight(win32wnd->getParent()->getOS2WindowHandle())
    212               : OSLibQueryScreenHeight();
    213         }
    214         OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswp+1, parentHeight);
     220            if (win32wnd->isChild())
     221                hParent = win32wnd->getParent()->getOS2WindowHandle();
     222            else
     223                hFrame = win32wnd->getOS2FrameWindowHandle();
     224        }
     225        OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswpo, hParent, hFrame);
     226
     227        win32wnd->setWindowRect(wp.x, wp.y, wp.x + wp.cx, wp.y + wp.cy);
     228        win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
     229
    215230        wp.hwnd = win32wnd->getWindowHandle();
    216231        if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
  • trunk/src/user32/new/win32wnd.cpp

    r693 r715  
    1 /* $Id: win32wnd.cpp,v 1.30 1999-08-25 15:08:50 dengert Exp $ */
     1/* $Id: win32wnd.cpp,v 1.31 1999-08-27 17:50:56 dengert Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    256256  {
    257257        SetParent(cs->hwndParent);
     258        owner = GetWindowFromHandle(cs->hwndParent);
     259        if(owner == NULL)
     260        {
     261            dprintf(("HMHandleTranslateToOS2 couldn't find owner window %x!!!", cs->hwndParent));
     262            return FALSE;
     263        }
    258264  }
    259265  else
     
    367373  OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    368374                                 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
    369                                  (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP,
     375                                 (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    370376                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    371377                                 &OS2HwndFrame);
     
    10681074
    10691075        if (!(wpos->flags & SWP_NOCLIENTMOVE))
    1070             SendMessageA(WM_MOVE, 0, MAKELONG(wpos->x, wpos->y));
     1076            SendMessageA(WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));
    10711077
    10721078        if (!(wpos->flags & SWP_NOCLIENTSIZE))
     
    10751081            else if (dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED;
    10761082
    1077             SendMessageA(WM_SIZE, wp, MAKELONG(wpos->cx,wpos->cy));
     1083           SendMessageA(WM_SIZE, wp, MAKELONG(rectClient.right  - rectClient.left,
     1084                                              rectClient.bottom - rectClient.top));
    10781085        }
    10791086        return 0;
     
    14691476   BOOL rc = FALSE;
    14701477   Win32Window *window;
     1478   HWND hParent = 0;
    14711479
    14721480   dprintf (("SetWindowPos %x %x (%d,%d)(%d,%d) %x", Win32Hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
     
    14841492   WINDOWPOS wpos;
    14851493   SWP swp, swpOld;
    1486    ULONG parentHeight;
    14871494
    14881495   //****************************
     
    15011508   //**********************************************
    15021509   if(~fuFlags & (SWP_NOMOVE | SWP_NOSIZE)) {
    1503        OSLibWinQueryWindowPos(OS2Hwnd, &swpOld);
    1504        parentHeight = isChild() ?
    1505            OSLibGetWindowHeight(getParent()->getOS2WindowHandle())
    1506          : OSLibQueryScreenHeight();
     1510       if (isChild())
     1511       {
     1512           hParent = getParent()->getOS2WindowHandle();
     1513           OSLibWinQueryWindowPos(OS2Hwnd, &swpOld);
     1514       } else
     1515           OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld);
    15071516   }
    1508    OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, parentHeight);
     1517   OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, hParent, OS2HwndFrame);
    15091518
    15101519   /* MapSWP can clear the SWP_MOVE and SWP_SIZE flags if the window is not
  • trunk/src/user32/new/win32wnd.h

    r693 r715  
    1 /* $Id: win32wnd.h,v 1.25 1999-08-25 15:08:51 dengert Exp $ */
     1/* $Id: win32wnd.h,v 1.26 1999-08-27 17:50:57 dengert Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    102102         PRECT  getClientRect()                 { return &rectClient; };
    103103         PRECT  getWindowRect()                 { return &rectWindow; };
     104void   setClientRect(LONG left, LONG top, LONG right, LONG bottom)
     105{ rectClient.left  = left;  rectClient.top    = top;
     106  rectClient.right = right; rectClient.bottom = bottom;
     107};
     108void   setWindowRect(LONG left, LONG top, LONG right, LONG bottom)
     109{ rectWindow.left  = left;  rectWindow.top    = top;
     110  rectWindow.right = right; rectWindow.bottom = bottom;
     111};
     112         void   setWindowRect(PRECT rect)       { rectWindow = *rect; };
    104113
    105114         DWORD  getFlags()                      { return flags; };
Note: See TracChangeset for help on using the changeset viewer.