Changeset 2421 for trunk/src


Ignore:
Timestamp:
Jan 12, 2000, 6:37:29 PM (26 years ago)
Author:
cbratschi
Message:

fixed WM_CALCVALIDRECTS, added region for WM_NCPAINT

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

Legend:

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

    r2353 r2421  
    1 /* $Id: dc.cpp,v 1.10 2000-01-07 17:38:46 cbratschi Exp $ */
     1/* $Id: dc.cpp,v 1.11 2000-01-12 17:37:28 cbratschi Exp $ */
    22
    33/*
     
    553553   if (updateRegionExists)
    554554   {
     555      //CB: for PM empty rect is valid
     556      if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE;
    555557      //SvL: Hack for memory.exe (doesn't get repainted properly otherwise)
    556558//      if (wnd->isOwnDC() && wnd->getOwnDC())
     
    604606
    605607   if (updateRegionExists)
     608   {
     609     //CB: for PM empty rect is valid
     610     if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE;
    606611     mapOS2ToWin32Rect(hwnd,(PRECTLOS2)&rectl,pRect);
    607    else
    608      pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
     612   } else
     613       pRect->left = pRect->top = pRect->right = pRect->bottom = 0;
    609614
    610615   return updateRegionExists;
     
    722727      ULONG BytesNeeded;
    723728      PRGNDATA_W RgnData;
    724       PRECTL pr;
     729      PRECT pr;
    725730      int i;
    726       LONG height = OSLibQueryScreenHeight();
     731      RECTL rectl;
    727732
    728733      if (!hrgn)
     
    736741
    737742      i = RgnData->rdh.nCount;
    738       pr = (PRECTL)(RgnData->Buffer);
     743      pr = (PRECT)(RgnData->Buffer);
    739744
    740745      success = TRUE;
    741746      if (flags & DCX_EXCLUDERGN_W)
     747      {
     748#if 0 //CB: todo
    742749         for (; (i > 0) && success; i--, pr++) {
    743750            LONG y = pr->yBottom;
     
    747754            success &= GpiExcludeClipRectangle (pHps->hps, pr);
    748755         }
    749       else
    750          for (; (i > 0) && success; i--, pr++) {
    751             LONG y = pr->yBottom;
    752 
    753             pr->yBottom = height - pr->yTop;
    754             pr->yTop    = height - y;
    755             success &= GpiIntersectClipRectangle (pHps->hps, pr);
    756          }
     756#endif
     757      } else //DCX_INTERSECTRGN_W
     758      {
     759        O32_SelectClipRgn(pHps->hps,hrgn); //CB: works so far
     760      }
    757761      if (!success)
    758762         goto error;
  • trunk/src/user32/new/dc.h

    r2290 r2421  
    1 /* $Id: dc.h,v 1.3 2000-01-01 14:54:51 cbratschi Exp $ */
     1/* $Id: dc.h,v 1.4 2000-01-12 17:37:29 cbratschi Exp $ */
    22/*
    33 * public dc functions
     
    343343
    344344    return yyrc;
    345 } 
     345}
    346346
    347347BOOL OPEN32API _O32_CreateCaret (HWND hwnd, HBITMAP hbm, int width, int height);
     
    353353
    354354    yyrc = _O32_CreateCaret(a, b, c, d);
     355    SetFS(sel);
     356
     357    return yyrc;
     358}
     359
     360BOOL OPEN32API _O32_SelectClipRgn(HDC hdc,HRGN hrgn);
     361
     362inline BOOL O32_SelectClipRgn(HDC hdc,HRGN hrgn)
     363{
     364 BOOL yyrc;
     365 USHORT sel = RestoreOS2FS();
     366
     367    yyrc = _O32_SelectClipRgn(hdc,hrgn);
    355368    SetFS(sel);
    356369
     
    426439   // from pmddi.h:
    427440   /* CopyClipRegion */
    428    
     441
    429442   #define COPYCRGN_ALLINTERSECT        0L
    430443   #define COPYCRGN_VISRGN              1L
     
    432445
    433446   /* SetupDC */
    434    
     447
    435448   #define SETUPDC_VISRGN               0x00000001L
    436449   #define SETUPDC_ORIGIN               0x00000002L
  • trunk/src/user32/new/pmframe.cpp

    r2418 r2421  
    1 /* $Id: pmframe.cpp,v 1.12 2000-01-12 15:14:16 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.13 2000-01-12 17:37:29 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    107107  {
    108108    case WM_FORMATFRAME:
    109         break;
     109        break;
    110110
    111111    case WM_MINMAXFRAME:
     
    118118      {
    119119        win32wnd->setStyle((win32wnd->getStyle() & ~WS_MINIMIZE_W) | WS_MAXIMIZE_W);
    120       } 
     120      }
    121121      else if ((swp->fl & SWP_MINIMIZE) == SWP_MINIMIZE)
    122122      {
    123123        win32wnd->setStyle((win32wnd->getStyle() & ~WS_MAXIMIZE_W) | WS_MINIMIZE_W);
    124       } 
     124      }
    125125      else if ((swp->fl & SWP_RESTORE) == SWP_RESTORE)
    126126      {
     
    262262
    263263        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
    264         {
    265                 swpClient.hwnd = win32wnd->getOS2WindowHandle();
    266                 swpClient.hwndInsertBehind = 0;
    267                 swpClient.x  = 0;
    268                 swpClient.y  = 0;
    269                 swpClient.cx = 0;
    270                 swpClient.cy = 0;
    271                 swpClient.fl = pswp->fl & ~SWP_ZORDER;
    272                 WinSetMultWindowPos(thdb->hab, &swpClient, 1);
    273                 goto PosChangedEnd;
    274         }
     264        {
     265                swpClient.hwnd = win32wnd->getOS2WindowHandle();
     266                swpClient.hwndInsertBehind = 0;
     267                swpClient.x  = 0;
     268                swpClient.y  = 0;
     269                swpClient.cx = 0;
     270                swpClient.cy = 0;
     271                swpClient.fl = pswp->fl & ~SWP_ZORDER;
     272                WinSetMultWindowPos(thdb->hab, &swpClient, 1);
     273                goto PosChangedEnd;
     274        }
    275275
    276276        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     
    285285
    286286        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         }
     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        }
    303303
    304304        if(win32wnd->CanReceiveSizeMsgs())
     
    307307        //update child positions: rectWindow is in window coordinates
    308308        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    309                 FrameUpdateChildPositions(win32wnd->getOS2WindowHandle());
    310         }
     309                FrameUpdateChildPositions(win32wnd->getOS2WindowHandle());
     310        }
    311311
    312312PosChangedEnd:
     
    317317    case WM_CALCVALIDRECTS:
    318318    {
    319       PRECTL oldRect = (PRECTL)mp1,newRect = oldRect+1;
    320       UINT res = 0; //= CVR_ALIGNLEFT | CVR_ALIGNTOP;
    321 
    322 //CB: todo: use WM_NCCALCSIZE result
    323       if (win32wnd->getWindowClass())
    324       {
    325         DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W);
    326 
    327         if ((dwStyle & CS_HREDRAW_W) && (newRect->xRight-newRect->xLeft != oldRect->xRight-oldRect->xLeft))
    328           res |= CVR_REDRAW;
    329         else if ((dwStyle & CS_VREDRAW_W) && (newRect->yTop-newRect->yBottom != oldRect->yTop-oldRect->yBottom))
    330           res |= CVR_REDRAW;
    331       } else res |= CVR_REDRAW;
    332 
    333       //CB: PM sets client window position
    334 //      RestoreOS2TIB();
    335 //      OldFrameProc(hwnd,msg,mp1,mp2);
    336 //      SetWin32TIB();
    337 
    338319      RestoreOS2TIB();
    339       return (MRESULT)res;
     320      return (MRESULT)CVR_REDRAW; //always redraw frame
    340321    }
    341322
     
    357338            if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER);
    358339          }
    359         } 
     340        }
    360341        else
    361342        {
     
    404385  SWP swpClient = {0};
    405386
    406         win32wnd->MsgFormatFrame();
    407         //CB: todo: use result for WM_CALCVALIDRECTS
    408         mapWin32ToOS2Rect(WinQueryWindow(win32wnd->getOS2FrameWindowHandle(),QW_PARENT),win32wnd->getOS2FrameWindowHandle(),win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
    409 
    410         swpClient.hwnd = win32wnd->getOS2WindowHandle();
    411         swpClient.hwndInsertBehind = 0;
    412         swpClient.x  = rect.xLeft;
    413         swpClient.y  = rect.yBottom;
    414         swpClient.cx = rect.xRight-rect.xLeft;
    415         swpClient.cy = rect.yTop-rect.yBottom;
    416         swpClient.fl = SWP_MOVE | SWP_SIZE;
    417         WinSetMultWindowPos(GetThreadHAB(), &swpClient, 1);
     387        win32wnd->MsgFormatFrame();
     388        //CB: todo: use result for WM_CALCVALIDRECTS
     389        mapWin32ToOS2Rect(WinQueryWindow(win32wnd->getOS2FrameWindowHandle(),QW_PARENT),win32wnd->getOS2FrameWindowHandle(),win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
     390
     391        swpClient.hwnd = win32wnd->getOS2WindowHandle();
     392        swpClient.hwndInsertBehind = 0;
     393        swpClient.x  = rect.xLeft;
     394        swpClient.y  = rect.yBottom;
     395        swpClient.cx = rect.xRight-rect.xLeft;
     396        swpClient.cy = rect.yTop-rect.yBottom;
     397        swpClient.fl = SWP_MOVE | SWP_SIZE;
     398        WinSetMultWindowPos(GetThreadHAB(), &swpClient, 1);
    418399}
    419400//******************************************************************************
  • trunk/src/user32/new/pmwindow.cpp

    r2415 r2421  
    1 /* $Id: pmwindow.cpp,v 1.36 2000-01-12 12:40:46 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.37 2000-01-12 17:37:29 cbratschi Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    297297    case WM_CALCVALIDRECTS:
    298298    {
    299         dprintf(("OS2: WM_CALCVALIDRECTS"));
    300         goto RunDefWndProc;
     299      PRECTL oldRect = (PRECTL)mp1,newRect = oldRect+1;
     300      UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP;
     301
     302//CB: todo: use WM_NCCALCSIZE result
     303      if (win32wnd->getWindowClass())
     304      {
     305        DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W);
     306
     307        if ((dwStyle & CS_HREDRAW_W) && (newRect->xRight-newRect->xLeft != oldRect->xRight-oldRect->xLeft))
     308          res |= CVR_REDRAW;
     309        else if ((dwStyle & CS_VREDRAW_W) && (newRect->yTop-newRect->yBottom != oldRect->yTop-oldRect->yBottom))
     310          res |= CVR_REDRAW;
     311      } else res |= CVR_REDRAW;
     312
     313      RestoreOS2TIB();
     314      WinDefWindowProc(hwnd,msg,mp1,mp2);
     315      RestoreOS2TIB();
     316      return (MRESULT)res;
    301317    }
    302318
  • trunk/src/user32/new/win32wbase.cpp

    r2418 r2421  
    1 /* $Id: win32wbase.cpp,v 1.36 2000-01-12 15:14:16 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.37 2000-01-12 17:37:29 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    10341034    RECT client = rectClient;
    10351035
    1036 //CB: bug in dc.cpp!!!
    1037     if ((rect.left == rect.right) || (rect.bottom == rect.top)) return 0;
    10381036    mapWin32Rect(getParent() ? getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,OS2HwndFrame,&client);
    10391037    if ((rect.left >= client.left) && (rect.left < client.right) &&
     
    10421040        (rect.bottom >= client.top) && (rect.bottom < client.bottom))
    10431041      return 0;
     1042
    10441043    hrgn = CreateRectRgnIndirect(&rect);
    10451044    if (!hrgn) return 0;
    1046 //CB: bug in GetDCEx with region!!!
    1047     rc = SendInternalMessageA(WM_NCPAINT,/*hrgn*/0,0);
    1048 //dprintf(("CB: %d %d %d %d",rect.left,rect.top,rect.bottom,rect.right));
     1045    rc = SendInternalMessageA(WM_NCPAINT,hrgn,0);
    10491046    DeleteObject(hrgn);
    1050     //CB: todo: check if intersection with client, what does PM's frame???
    10511047
    10521048    return rc;
Note: See TracChangeset for help on using the changeset viewer.