Ignore:
Timestamp:
Oct 20, 1999, 3:46:29 PM (26 years ago)
Author:
sandervl
Message:

position change bugfixes

File:
1 edited

Legend:

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

    r1337 r1376  
    1 /* $Id: oslibwin.cpp,v 1.31 1999-10-17 16:42:38 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.32 1999-10-20 13:46:26 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    484484   ULONG parentHeight;
    485485
    486    HWND  hWinAfter;
    487    ULONG flags = 0;
     486   HWND   hWinAfter;
     487   ULONG  flags = 0;
     488   SWP    swpFrame;
     489   POINTL point;
    488490
    489491   HWND  hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
    490492
    491    if (hWndInsertAfter == HWND_TOP)
    492       hWinAfter = HWND_TOP_W;
    493    else if (hWndInsertAfter == HWND_BOTTOM)
    494       hWinAfter = HWND_BOTTOM_W;
    495    else
    496       hWinAfter = (HWND) hWndInsertAfter;
    497 
    498    //***********************************
    499    // convert PM flags to Windows flags
    500    //***********************************
    501    if (!(fuFlags & SWP_SIZE))       flags |= SWP_NOSIZE_W;
    502    if (!(fuFlags & SWP_MOVE))       flags |= SWP_NOMOVE_W;
    503    if (!(fuFlags & SWP_ZORDER))     flags |= SWP_NOZORDER_W;
    504    if (  fuFlags & SWP_NOREDRAW)    flags |= SWP_NOREDRAW_W;
    505    if (!(fuFlags & SWP_ACTIVATE))   flags |= SWP_NOACTIVATE_W;
    506    if (  fuFlags & SWP_SHOW)        flags |= SWP_SHOWWINDOW_W;
    507    if (  fuFlags & SWP_HIDE)        flags |= SWP_HIDEWINDOW_W;
    508 
    509    if (fuFlags & (SWP_MOVE | SWP_SIZE))
    510    {
    511       if (hParent == NULLHANDLE)
    512       {
    513         ULONG Offset;
    514         POINTL pt = {0, 0};
    515 
    516         Offset = OSLibGetWindowHeight(hFrame) - cy;
    517         parentHeight = ScreenHeight;
    518 
    519         cx += 2 * x;
    520         cy += Offset;
    521         WinMapWindowPoints (hFrame, HWND_DESKTOP, &pt, 1);
    522         x = pt.x;
    523         y = pt.y;
    524 
    525         pswpOld->cx += 2 * pswpOld->x;
    526         pswpOld->cy += Offset;
    527         pswpOld->x   = pt.x;
    528         pswpOld->y   = pt.y;
    529       }
    530       else
    531       {
    532         parentHeight = OSLibGetWindowHeight(hParent);
    533       }
    534 
    535       if (fuFlags & SWP_SIZE)
    536       {
    537          if (cy != pswpOld->cy)
    538          {
    539             flags &= ~SWP_NOMOVE_W;
    540          }
    541       }
    542       else
    543       {
    544          cx = pswpOld->cx;
    545          cy = pswpOld->cy;
    546       }
    547 
    548       if ((fuFlags & SWP_MOVE) == 0)
    549       {
    550          x = pswpOld->x;
    551          y = pswpOld->y;
    552       }
    553 
    554       y         = parentHeight - y - cy;
    555       LONG oldY = parentHeight - pswpOld->y - pswpOld->cy;
    556 
    557       if ((pswpOld->x == x) && (oldY == y))
    558          flags |= SWP_NOMOVE_W;
    559 
    560       if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
    561          flags |= SWP_NOSIZE_W;
    562    }
    563 
    564    if (hParent == NULLHANDLE)
    565    {
    566        pswpOld->x  = x + pswp->x;
    567        pswpOld->y  = y + cy - pswp->y - pswp->cy;
    568    }
    569    else {
    570        pswpOld->x  = pswp->x;
    571        pswpOld->y  = parentHeight - pswp->y - cy;
    572    }
    573    pswpOld->cx = pswp->cx;
    574    pswpOld->cy = pswp->cy;
    575 
    576 dprintf(("window (%d,%d)(%d,%d)  client (%d,%d)(%d,%d)",
    577          x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
    578 
    579    pwpos->flags            = (UINT)flags;
    580    pwpos->cy               = (int)cy;
    581    pwpos->cx               = (int)cx;
    582    pwpos->x                = (int)x;
    583    pwpos->y                = (int)y;
    584    pwpos->hwndInsertAfter  = hWinAfter;
    585    pwpos->hwnd             = hWindow;
     493    if (hWndInsertAfter == HWND_TOP)
     494        hWinAfter = HWND_TOP_W;
     495    else if (hWndInsertAfter == HWND_BOTTOM)
     496        hWinAfter = HWND_BOTTOM_W;
     497    else
     498        hWinAfter = (HWND) hWndInsertAfter;
     499
     500    //***********************************
     501    // convert PM flags to Windows flags
     502    //***********************************
     503    if (!(fuFlags & SWP_SIZE))       flags |= SWP_NOSIZE_W;
     504    if (!(fuFlags & SWP_MOVE))       flags |= SWP_NOMOVE_W;
     505    if (!(fuFlags & SWP_ZORDER))     flags |= SWP_NOZORDER_W;
     506    if (  fuFlags & SWP_NOREDRAW)    flags |= SWP_NOREDRAW_W;
     507    if (!(fuFlags & SWP_ACTIVATE))   flags |= SWP_NOACTIVATE_W;
     508    if (  fuFlags & SWP_SHOW)        flags |= SWP_SHOWWINDOW_W;
     509    if (  fuFlags & SWP_HIDE)        flags |= SWP_HIDEWINDOW_W;
     510
     511    WinQueryWindowPos(hFrame, &swpFrame);
     512
     513    if(fuFlags & (SWP_MOVE | SWP_SIZE))
     514    {
     515        point.x = swpFrame.x;
     516        point.y = swpFrame.y;
     517        if(hParent)
     518        {
     519                WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
     520        }
     521        point.y = OSLibQueryScreenHeight() - point.y - swpFrame.cy;
     522
     523        cy = swpFrame.cy;
     524        cx = swpFrame.cx;
     525        x  = point.x;
     526        y  = point.y;
     527
     528        if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
     529            flags |= SWP_NOMOVE_W;
     530
     531        if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
     532            flags |= SWP_NOSIZE_W;
     533
     534        if (fuFlags & SWP_SIZE)
     535        {
     536            if (pswp->cy != pswpOld->cy)
     537            {
     538                flags &= ~SWP_NOMOVE_W;
     539            }
     540        }
     541    }
     542
     543    pswpOld->x  = pswp->x;
     544    pswpOld->y  = swpFrame.cy - pswp->y - pswp->cy;
     545    pswpOld->cx = pswp->cx;
     546    pswpOld->cy = pswp->cy;
     547
     548    dprintf(("window (%d,%d)(%d,%d)  client (%d,%d)(%d,%d)",
     549             x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
     550
     551    pwpos->flags            = (UINT)flags;
     552    pwpos->cy               = cy;
     553    pwpos->cx               = cx;
     554    pwpos->x                = x;
     555    pwpos->y                = y;
     556    pwpos->hwndInsertAfter  = hWinAfter;
     557    pwpos->hwnd             = hWindow;
    586558}
    587559//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.