Ignore:
Timestamp:
Sep 21, 1999, 7:05:36 PM (26 years ago)
Author:
dengert
Message:

erase background/paint stuff enhanced

File:
1 edited

Legend:

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

    r963 r1000  
    1 /* $Id: oslibwin.cpp,v 1.2 1999-09-17 18:49:53 dengert Exp $ */
     1/* $Id: oslibwin.cpp,v 1.3 1999-09-21 17:04:26 dengert Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    157157//******************************************************************************
    158158//******************************************************************************
     159ULONG OSLibSendMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
     160{
     161  return (ULONG)WinSendMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
     162}
     163//******************************************************************************
     164//******************************************************************************
    159165//******************************************************************************
    160166//******************************************************************************
     
    423429   ULONG flags = 0;
    424430
    425    //***************************************************
    426    // Map constant HWNDs (e.g. HWND_DESKTOP, HWND_TOP)
    427    //***************************************************
    428431   HWND  hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
    429432
    430    if ( hWndInsertAfter == HWND_TOP )
     433   if (hWndInsertAfter == HWND_TOP)
    431434      hWinAfter = HWND_TOP_W;
    432    else if ( hWndInsertAfter == HWND_BOTTOM )
     435   else if (hWndInsertAfter == HWND_BOTTOM)
    433436      hWinAfter = HWND_BOTTOM_W;
    434437   else
     
    446449   if (  fuFlags & SWP_HIDE)        flags |= SWP_HIDEWINDOW_W;
    447450
    448    //**************************************************************************
    449    // When moving or sizing we'll have to do some calculations for Y inversion.
    450    //
    451    // If moving - invert Y coord.
    452    //
    453    // If sizing - if the height is changing, have to move the window to
    454    //             maintain correct windows position.  If we just size then the
    455    //             TR corner will extend.  The Windows behaviour should be to
    456    //             extend the BR corner.
    457    //
    458    // If this is a child window then we'll have to move within the client
    459    // area of the parent.
    460    //
    461    // If this is an overlapped or popup window we'll have to move around
    462    // within the desktop.
    463    //**************************************************************************
    464    if ( fuFlags & (SWP_MOVE | SWP_SIZE) )
     451   if (fuFlags & (SWP_MOVE | SWP_SIZE))
    465452   {
    466453      if (hParent == NULLHANDLE)
     
    490477      if (fuFlags & SWP_SIZE)
    491478      {
    492          // If height is changing we MUST move to maintain top-left alignment
    493479         if (cy != pswpOld->cy)
    494480         {
     
    502488      }
    503489
    504       //**********************************************************
    505       // We'll need both a y and cy for the Y inversion code.
    506       // If either wasn't passed in, calculate the current value.
    507       //**********************************************************
    508490      if ((fuFlags & SWP_MOVE) == 0)
    509491      {
     
    512494      }
    513495
    514       //********************************************************
    515       // Y inversion here... old Y is top left corner of window
    516       // relative to top left of parent.
    517       //********************************************************
    518       y          = parentHeight - y - cy;
    519       LONG oldY  = parentHeight - pswpOld->y - pswpOld->cy;
    520 
    521       // Set the SWP_NOMOVE_W flag if the window has not moved in windows
    522       // coordinates.
    523       if ( ( pswpOld->x == x ) && ( oldY == y ) )
     496      y         = parentHeight - y - cy;
     497      LONG oldY = parentHeight - pswpOld->y - pswpOld->cy;
     498
     499      if ((pswpOld->x == x) && (oldY == y))
    524500         flags |= SWP_NOMOVE_W;
    525501
    526       // Set the SWP_NOSIZE_W flag if the window is not really being sized.
    527       if ( ( pswpOld->cx == cx ) && ( pswpOld->cy == cy ) )
     502      if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
    528503         flags |= SWP_NOSIZE_W;
    529504   }
     
    544519         x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
    545520
    546    // Fill in the WINDOWPOS structure with the now calculated PM values.
    547521   pwpos->flags            = (UINT)flags;
    548522   pwpos->cy               = (int)cy;
     
    557531void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
    558532{
    559    HWND hWnd              = pwpos->hwnd;
    560    HWND hWndInsertAfter   = pwpos->hwndInsertAfter;
    561    long x                 = pwpos->x;
    562    long y                 = pwpos->y;
    563    long cx                = pwpos->cx;
    564    long cy                = pwpos->cy;
    565    UINT fuFlags           = pwpos->flags;
     533   HWND hWnd            = pwpos->hwnd;
     534   HWND hWndInsertAfter = pwpos->hwndInsertAfter;
     535   long x               = pwpos->x;
     536   long y               = pwpos->y;
     537   long cx              = pwpos->cx;
     538   long cy              = pwpos->cy;
     539   UINT fuFlags         = pwpos->flags;
    566540   ULONG parentHeight;
    567541
    568542   HWND  hWinAfter;
    569543   ULONG flags = 0;
    570 
    571    //***************************************************
    572    // Map constant HWNDs (e.g. HWND_DESKTOP, HWND_TOP)
    573    //***************************************************
    574544   HWND  hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
    575545
    576    if ( hWndInsertAfter == HWND_TOPMOST_W )
     546   if (hWndInsertAfter == HWND_TOPMOST_W)
    577547//      hWinAfter = HWND_TOPMOST;
    578548      hWinAfter = HWND_TOP;
    579    else if ( hWndInsertAfter == HWND_NOTOPMOST_W )
     549   else if (hWndInsertAfter == HWND_NOTOPMOST_W)
    580550//      hWinAfter = HWND_NOTOPMOST;
    581551      hWinAfter = HWND_TOP;
    582    else if ( hWndInsertAfter == HWND_TOP_W )
     552   else if (hWndInsertAfter == HWND_TOP_W)
    583553      hWinAfter = HWND_TOP;
    584    else if ( hWndInsertAfter == HWND_BOTTOM_W )
     554   else if (hWndInsertAfter == HWND_BOTTOM_W)
    585555      hWinAfter = HWND_BOTTOM;
    586556   else
    587557      hWinAfter = (HWND) hWndInsertAfter;
    588558
    589    //***********************************
    590    // convert Windows flags to PM flags
    591    //***********************************
    592    if ( ! ( fuFlags & SWP_NOSIZE_W     ) ) flags |= SWP_SIZE;
    593    if ( ! ( fuFlags & SWP_NOMOVE_W     ) ) flags |= SWP_MOVE;
    594    if ( ! ( fuFlags & SWP_NOZORDER_W   ) ) flags |= SWP_ZORDER;
    595    if (     fuFlags & SWP_NOREDRAW_W   )   flags |= SWP_NOREDRAW;
    596    if ( ! ( fuFlags & SWP_NOACTIVATE_W ) ) flags |= SWP_ACTIVATE;
    597    if (     fuFlags & SWP_SHOWWINDOW_W )   flags |= SWP_SHOW;
    598    if (     fuFlags & SWP_HIDEWINDOW_W )   flags |= SWP_HIDE;
    599    /* no PM equivalent for SWP_FRAMECHANGED_W, SWP_NOCOPYBITS_W and SWP_NOOWNERZORDER_W */
    600 
    601    //**************************************************************************
    602    // When moving or sizing we'll have to do some calculations for Y inversion.
    603    //
    604    // If moving - invert Y coord.
    605    //
    606    // If sizing - if the height is changing, have to move the window to
    607    //             maintain correct windows position.  If we just size then the
    608    //             TR corner will extend.  The Windows behaviour should be to
    609    //             extend the BR corner.
    610    //
    611    // If this is a child window then we'll have to move within the client
    612    // area of the parent.
    613    //
    614    // If this is an overlapped or popup window we'll have to move around
    615    // within the desktop.
    616    //**************************************************************************
    617    if ( flags & (SWP_MOVE | SWP_SIZE) )
     559   if (!(fuFlags & SWP_NOSIZE_W    )) flags |= SWP_SIZE;
     560   if (!(fuFlags & SWP_NOMOVE_W    )) flags |= SWP_MOVE;
     561   if (!(fuFlags & SWP_NOZORDER_W  )) flags |= SWP_ZORDER;
     562   if (  fuFlags & SWP_NOREDRAW_W  )  flags |= SWP_NOREDRAW;
     563   if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
     564   if (  fuFlags & SWP_SHOWWINDOW_W)  flags |= SWP_SHOW;
     565   if (  fuFlags & SWP_HIDEWINDOW_W)  flags |= SWP_HIDE;
     566
     567   if (flags & (SWP_MOVE | SWP_SIZE))
    618568   {
    619569      if (hParent == NULLHANDLE)
     
    622572        parentHeight = OSLibGetWindowHeight(hParent);
    623573
    624       //**********************************************************
    625       // We'll need both a y and cy for the Y inversion code.
    626       // If either wasn't passed in, calculate the current value.
    627       //**********************************************************
    628574      if ((flags & SWP_MOVE) == 0)
    629575      {
     
    631577         y = pswpOld->y;
    632578
    633          // If the window is at (x,0) with a height of zero then this calculation
    634          // won't quite work.  Instead of calculating the Windows y coord, we set
    635          // it at (x,0).
    636          if (!(y == 0 && pswpOld->cy == 0))
     579         if (!((y == 0) && (pswpOld->cy == 0)))
    637580         {
    638             // convert Y coordinate back to Windows's for later conversion with new size
    639581            y = parentHeight - y - pswpOld->cy;
    640582         }
     
    643585      if (flags & SWP_SIZE)
    644586      {
    645          // If height is changing we MUST move to maintain top-left alignment
    646587         if (cy != pswpOld->cy)
    647588            flags |= SWP_MOVE;
     
    653594      }
    654595
    655       //********************************************************
    656       // Y inversion here... old Y is top left corner of window
    657       // relative to top left of parent.
    658       //********************************************************
    659596      y = parentHeight - y - cy;
    660597
    661       // Clear the SWP_MOVE flag if the window is not really being moved.
    662       if ( ( pswpOld->x == x ) && ( pswpOld->y == y ) )
     598      if ((pswpOld->x == x) && (pswpOld->y == y))
    663599         flags &= ~SWP_MOVE;
    664600
    665       // Clear the SWP_SIZE flag if the window is not really being sized.
    666       if ( ( pswpOld->cx == cx ) && ( pswpOld->cy == cy ) )
     601      if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
    667602         flags &= ~SWP_SIZE;
    668603   }
    669604
    670    // Fill in the SWP structure with the now calculated PM values.
    671605   pswp->fl               = flags;
    672606   pswp->cy               = cy;
Note: See TracChangeset for help on using the changeset viewer.