Ignore:
Timestamp:
Feb 22, 2001, 7:18:59 PM (25 years ago)
Author:
sandervl
Message:

minimize updates + update region fix in NotifyFrameChanged

File:
1 edited

Legend:

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

    r5217 r5246  
    1 /* $Id: pmwindow.cpp,v 1.118 2001-02-20 17:22:05 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.119 2001-02-22 18:18:59 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    4444#include "dbglocal.h"
    4545
     46//define this to use the new code for WM_CALCVALIDRECT handling
     47//#define USE_CALCVALIDRECT
     48
    4649HMQ  hmq = 0;                             /* Message queue handle         */
    4750HAB  hab = 0;
     
    438441        }
    439442
    440         if((pswp->fl & (SWP_MOVE | SWP_SIZE)) && !(win32wnd->getStyle() & WS_MINIMIZE_W))
     443#ifndef USE_CALCVALIDRECT
     444        if((pswp->fl & (SWP_MOVE | SWP_SIZE)))
    441445        {
    442446            //CB: todo: use result for WM_CALCVALIDRECTS
     
    513517        else
    514518        {
     519#endif //USE_CALCVALIDRECT
    515520            if(win32wnd->CanReceiveSizeMsgs())
    516521                win32wnd->MsgPosChanged((LPARAM)&wp);
    517         }
     522#ifndef USE_CALCVALIDRECT
     523        }
     524#endif
    518525
    519526        if(pswp->fl & SWP_ACTIVATE)
     
    568575
    569576    case WM_CALCVALIDRECTS:
     577#ifdef USE_CALCVALIDRECT
     578    {
     579        PRECTL    oldRect = (PRECTL)mp1, newRect = oldRect+1;
     580        PSWP      pswp = (PSWP)mp2;
     581        SWP       swpOld;
     582        WINDOWPOS wp;
     583        RECTL     newClientrect, oldClientRect;
     584        ULONG     nccalcret;
     585//        UINT      res = CVR_ALIGNLEFT | CVR_ALIGNTOP;
     586        UINT      res = 0;
     587
     588        dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle()));
     589
     590        //Get old position info
     591        WinQueryWindowPos(hwnd, &swpOld);
     592
     593        if(win32wnd->getParent()) {
     594             OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(),
     595                                    win32wnd->getParent()->getClientRectPtr()->left,
     596                                    win32wnd->getParent()->getClientRectPtr()->top,
     597                                    hwnd);
     598        }
     599        else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd);
     600
     601        wp.hwnd = win32wnd->getWindowHandle();
     602        if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
     603        {
     604            Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
     605            if(wndAfter) {
     606                 wp.hwndInsertAfter = wndAfter->getWindowHandle();
     607            }
     608            else wp.hwndInsertAfter = HWND_TOP_W;
     609        }
     610
     611        //Get old client rectangle
     612        mapWin32ToOS2Rect(oldRect->yTop - oldRect->yBottom, win32wnd->getClientRectPtr(), (PRECTLOS2)&oldClientRect);
     613
     614        //Note: Also updates the new window rectangle
     615        nccalcret = win32wnd->MsgFormatFrame(&wp);
     616
     617        //Get new client rectangle
     618        mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&newClientrect);
     619
     620        if(nccalcret == 0) {
     621            res = CVR_ALIGNTOP | CVR_ALIGNLEFT;
     622        }
     623        else {
     624            if(nccalcret & WVR_ALIGNTOP_W) {
     625                res |= CVR_ALIGNTOP;
     626            }
     627            else
     628            if(nccalcret & WVR_ALIGNBOTTOM_W) {
     629                res |= CVR_ALIGNBOTTOM;
     630            }
     631
     632            if(nccalcret & WVR_ALIGNLEFT_W) {
     633                res |= CVR_ALIGNLEFT;
     634            }
     635            else
     636            if(nccalcret & WVR_ALIGNRIGHT_W) {
     637                res |= CVR_ALIGNRIGHT;
     638            }
     639
     640            if(nccalcret & WVR_REDRAW_W) {//WVR_REDRAW_W = (WVR_HREDRAW | WVR_VREDRAW)
     641                res |= CVR_REDRAW;
     642            }
     643            else
     644            if(nccalcret & WVR_VALIDRECTS_W) {
     645                //TODO:
     646                //res = 0;
     647            }
     648        }
     649        if(res != 0) {
     650
     651        }
     652
    570653#if 0
    571     {
    572       PRECTL oldRect = (PRECTL)mp1,newRect = oldRect+1;
    573       UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP;
    574 
    575 //CB: todo: use WM_NCCALCSIZE result
    576       if (win32wnd->getWindowClass())
    577       {
    578         DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W);
    579 
    580         if ((dwStyle & CS_HREDRAW_W) && (newRect->xRight-newRect->xLeft != oldRect->xRight-oldRect->xLeft))
    581             res |= CVR_REDRAW;
    582         else
    583         if ((dwStyle & CS_VREDRAW_W) && (newRect->yTop-newRect->yBottom != oldRect->yTop-oldRect->yBottom))
    584             res |= CVR_REDRAW;
    585       }
    586       else res |= CVR_REDRAW;
    587 
    588       return (MRESULT)res;
     654            if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy)))
     655            {
     656                //redraw the frame (to prevent unnecessary client updates)
     657                BOOL redrawAll = FALSE;
     658
     659                if (win32wnd->getWindowClass())
     660                {
     661                    DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W);
     662
     663                    if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx))
     664                        redrawAll = TRUE;
     665                    else
     666                    if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy))
     667                        redrawAll = TRUE;
     668                }
     669                else redrawAll = TRUE;
     670
     671                if (redrawAll)
     672                {
     673                    //CB: redraw all children for now
     674                    //    -> problems with update region if we don't do it
     675                    //       todo: rewrite whole handling
     676                    WinInvalidateRect(hwnd,NULL,TRUE);
     677                }
     678                else
     679                {
     680                    HPS hps = WinGetPS(hwnd);
     681                    RECTL frame,client,arcl[4];
     682
     683                    WinQueryWindowRect(hwnd,&frame);
     684
     685                    //top
     686                    arcl[0].xLeft = 0;
     687                    arcl[0].xRight = frame.xRight;
     688                    arcl[0].yBottom = rect.yTop;
     689                    arcl[0].yTop = frame.yTop;
     690                    //right
     691                    arcl[1].xLeft = rect.xRight;
     692                    arcl[1].xRight = frame.xRight;
     693                    arcl[1].yBottom = 0;
     694                    arcl[1].yTop = frame.yTop;
     695                    //left
     696                    arcl[2].xLeft = 0;
     697                    arcl[2].xRight = rect.xLeft;
     698                    arcl[2].yBottom = 0;
     699                    arcl[2].yTop = frame.yTop;
     700                    //bottom
     701                    arcl[3].xLeft = 0;
     702                    arcl[3].xRight = frame.xRight;
     703                    arcl[3].yBottom = 0;
     704                    arcl[3].yTop = rect.yBottom;
     705
     706                    HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl);
     707
     708                    WinInvalidateRegion(hwnd,hrgn,FALSE);
     709                    GpiDestroyRegion(hps,hrgn);
     710                    WinReleasePS(hps);
     711                }
     712            }
     713
     714        }
     715#endif
     716
     717        return (MRESULT)res;
    589718    }
    590719#else
Note: See TracChangeset for help on using the changeset viewer.