Ignore:
Timestamp:
Jan 12, 2000, 11:07:28 PM (26 years ago)
Author:
cbratschi
Message:

fixed WM_CALCVALIDRECTS

File:
1 edited

Legend:

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

    r2421 r2425  
    1 /* $Id: pmframe.cpp,v 1.13 2000-01-12 17:37:29 cbratschi Exp $ */
     1/* $Id: pmframe.cpp,v 1.14 2000-01-12 22:07:28 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    212212        if(!win32wnd->CanReceiveSizeMsgs())
    213213           break;
    214 
     214//CB: todo: adjust maximized window rect (how does WINE it?)
    215215        WinQueryWindowPos(hwnd, &swpOld);
    216216        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     
    252252    case WM_WINDOWPOSCHANGED:
    253253    {
    254       PSWP      pswp   = (PSWP)mp1;
     254      PSWP      pswp   = (PSWP)mp1,pswpOld = pswp+1;
    255255      SWP       swpOld = *(pswp + 1);
    256256      WINDOWPOS wp;
     
    284284        OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
    285285
    286         if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    287                 win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
    288 
    289                 win32wnd->MsgFormatFrame();
    290                 //CB: todo: use result for WM_CALCVALIDRECTS
    291                 mapWin32ToOS2Rect(WinQueryWindow(hwnd,QW_PARENT),hwnd,win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
    292 
    293                 swpClient.hwnd = win32wnd->getOS2WindowHandle();
    294                 swpClient.hwndInsertBehind = 0;
    295                 swpClient.x  = rect.xLeft;
    296                 swpClient.y  = rect.yBottom;
    297                 swpClient.cx = rect.xRight-rect.xLeft;
    298                 swpClient.cy = rect.yTop-rect.yBottom;
    299                 //TODO: Get rid of SWP_SHOW; needed for winhlp32 button bar for now
    300                 swpClient.fl = (pswp->fl & ~SWP_ZORDER) | SWP_MOVE | SWP_SHOW;
    301                 WinSetMultWindowPos(thdb->hab, &swpClient, 1);
    302         }
    303 
    304         if(win32wnd->CanReceiveSizeMsgs())
    305           win32wnd->MsgPosChanged((LPARAM)&wp);
    306 
    307         //update child positions: rectWindow is in window coordinates
    308         if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    309                 FrameUpdateChildPositions(win32wnd->getOS2WindowHandle());
     286        if(pswp->fl & (SWP_MOVE | SWP_SIZE))
     287        {
     288          win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
     289
     290          win32wnd->MsgFormatFrame();
     291          //CB: todo: use result for WM_CALCVALIDRECTS
     292          mapWin32ToOS2Rect(WinQueryWindow(hwnd,QW_PARENT),hwnd,win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
     293
     294          swpClient.hwnd = win32wnd->getOS2WindowHandle();
     295          swpClient.hwndInsertBehind = 0;
     296          swpClient.x  = rect.xLeft;
     297          swpClient.y  = rect.yBottom;
     298          swpClient.cx = rect.xRight-rect.xLeft;
     299          swpClient.cy = rect.yTop-rect.yBottom;
     300          //TODO: Get rid of SWP_SHOW; needed for winhlp32 button bar for now
     301          swpClient.fl = (pswp->fl & ~SWP_ZORDER) | SWP_MOVE | SWP_SHOW;
     302          WinSetMultWindowPos(thdb->hab, &swpClient, 1);
     303
     304          //update child positions: rectWindow is in window coordinates
     305          if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     306                  FrameUpdateChildPositions(win32wnd->getOS2WindowHandle());
     307          }
     308
     309          if(win32wnd->CanReceiveSizeMsgs())
     310            win32wnd->MsgPosChanged((LPARAM)&wp);
     311
     312          if ((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy)))
     313          {
     314            //redraw the frame (to prevent unnecessary client updates)
     315            BOOL redrawAll = FALSE;
     316
     317            if (win32wnd->getWindowClass())
     318            {
     319              DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W);
     320
     321              if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx))
     322                redrawAll = TRUE;
     323              else if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy))
     324                redrawAll = TRUE;
     325            } else redrawAll = TRUE;
     326
     327            if (redrawAll)
     328            {
     329              WinInvalidateRect(hwnd,NULL,TRUE);
     330            } else
     331            {
     332              HPS hps = WinGetPS(hwnd);
     333              RECTL frame,client,arcl[4];
     334
     335              WinQueryWindowRect(hwnd,&frame);
     336               //top
     337              arcl[0].xLeft = 0;
     338              arcl[0].xRight = frame.xRight;
     339              arcl[0].yBottom = rect.yTop;
     340              arcl[0].yTop = frame.yTop;
     341               //right
     342              arcl[1].xLeft = rect.xRight;
     343              arcl[1].xRight = frame.xRight;
     344              arcl[1].yBottom = 0;
     345              arcl[1].yTop = frame.yTop;
     346               //left
     347              arcl[2].xLeft = 0;
     348              arcl[2].xRight = rect.xLeft;
     349              arcl[2].yBottom = 0;
     350              arcl[2].yTop = frame.yTop;
     351               //bottom
     352              arcl[3].xLeft = 0;
     353              arcl[3].xRight = frame.xRight;
     354              arcl[3].yBottom = 0;
     355              arcl[3].yTop = rect.yBottom;
     356
     357              HRGN hrgn = GpiCreateRegion(hps,3,(PRECTL)&arcl);
     358
     359              WinInvalidateRegion(hwnd,hrgn,FALSE);
     360              GpiDestroyRegion(hps,hrgn);
     361              WinReleasePS(hps);
     362            }
     363          }
     364        } else
     365        {
     366          //update child positions: rectWindow is in window coordinates
     367          if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     368                  FrameUpdateChildPositions(win32wnd->getOS2WindowHandle());
     369          }
     370
     371          if(win32wnd->CanReceiveSizeMsgs())
     372            win32wnd->MsgPosChanged((LPARAM)&wp);
    310373        }
    311374
     
    317380    case WM_CALCVALIDRECTS:
    318381    {
     382      //don't redraw here or PM redraw the whole frame (done in WM_WINDOWPOSCHANGED)
    319383      RestoreOS2TIB();
    320       return (MRESULT)CVR_REDRAW; //always redraw frame
     384      return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP);
    321385    }
    322386
Note: See TracChangeset for help on using the changeset viewer.