Changeset 962 for trunk/src


Ignore:
Timestamp:
Sep 16, 1999, 8:00:44 PM (26 years ago)
Author:
dengert
Message:

some more DC related functions

Location:
trunk/src/user32
Files:
3 edited

Legend:

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

    r949 r962  
    1 /* $Id: dc.cpp,v 1.1 1999-09-15 23:18:49 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.2 1999-09-16 18:00:43 dengert Exp $ */
    22
    33/*
     
    4646    RECT  rcPaint;
    4747    BOOL  fRestore;
    48     BOOL  fIncUpdate;
     48    BOOL  IncUpdate;
    4949    BYTE  rgbReserved[32];
    5050} PAINTSTRUCT_W, *PPAINTSTRUCT_W, *LPPAINTSTRUCT_W;
     
    116116#define DCX_LOCKWINDOWUPDATE_W          0x00000400L
    117117#define DCX_VALIDATE_W                  0x00200000L
     118
     119#define RDW_INVALIDATE_W       0x0001
     120#define RDW_INTERNALPAINT_W    0x0002
     121#define RDW_ERASE_W            0x0004
     122#define RDW_VALIDATE_W         0x0008
     123#define RDW_NOINTERNALPAINT_W  0x0010
     124#define RDW_NOERASE_W          0x0020
     125#define RDW_NOCHILDREN_W       0x0040
     126#define RDW_ALLCHILDREN_W      0x0080
     127#define RDW_UPDATENOW_W        0x0100
     128#define RDW_ERASENOW_W         0x0200
     129#define RDW_FRAME_W            0x0400
     130#define RDW_NOFRAME_W          0x0800
    118131
    119132typedef struct _RGNDATAHEADER_W {
     
    10381051   return (rc);
    10391052}
     1053
     1054BOOL WIN32API UpdateWindow (HWND hwnd)
     1055{
     1056   if (!hwnd)
     1057       return FALSE;
     1058
     1059   USHORT sel = RestoreOS2FS();
     1060   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
     1061
     1062dprintf (("User32: UpdateWindow hwnd %x -> wnd %x", hwnd, wnd));
     1063
     1064   if (WinQueryUpdateRect (wnd->getOS2WindowHandle(), NULL))
     1065       sendEraseBkgnd (wnd);
     1066
     1067   wnd->MsgPaint(0);
     1068
     1069   SetFS(sel);
     1070   return (TRUE);
     1071}
     1072
     1073// This implementation of RedrawWindow supports
     1074// RDW_ERASE
     1075// RDW_NOERASE
     1076// RDW_INTERNALPAINT
     1077// RDW_NOINTERNALPAINT
     1078// RDW_INVALIDATE
     1079// RDW_VALIDATE
     1080// RDW_ERASENOW
     1081// RDW_UPDATENOW
     1082
     1083BOOL WIN32API RedrawWindow (HWND hwnd, const RECT *pRect, HRGN hrgn, DWORD redraw)
     1084{
     1085   Win32BaseWindow *wnd;
     1086
     1087   if (redraw & (RDW_FRAME_W | RDW_NOFRAME_W))
     1088   {
     1089//      SET_ERROR_WIN( ERROR_NOT_SUPPORTED_W );
     1090      return FALSE;
     1091   }
     1092
     1093   USHORT sel = RestoreOS2FS();
     1094 dprintf(("USER32: RedrawWindow %X, %X %X %X", hwnd, pRect, hrgn, redraw));
     1095
     1096   if (hwnd == NULLHANDLE) {
     1097      hwnd = HWND_DESKTOP;
     1098      wnd  = NULL;
     1099   }
     1100   else
     1101   {
     1102      wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
     1103
     1104      if (!wnd)
     1105      {
     1106//         SET_ERROR_LAST();
     1107         SetFS(sel);
     1108         return FALSE;
     1109      }
     1110      hwnd = wnd->getOS2WindowHandle();
     1111   }
     1112
     1113   BOOL  IncludeChildren = redraw & RDW_ALLCHILDREN_W ? TRUE : FALSE;
     1114   BOOL  success = TRUE;
     1115   HPS   hpsTemp = NULLHANDLE;
     1116   HRGN  hrgnTemp = NULLHANDLE;
     1117   RECTL rectl;
     1118
     1119   if (redraw & RDW_UPDATENOW_W) redraw &= ~RDW_ERASENOW_W;
     1120
     1121#if 0
     1122   if (redraw & RDW_NOERASE_W)
     1123      setEraseBkgnd (FALSE);
     1124
     1125   if (redraw & RDW_UPDATENOW_W)
     1126      setSupressErase (TRUE, FALSE);
     1127   else if (redraw & RDW_ERASENOW_W)
     1128      setSupressErase (FALSE, FALSE);
     1129   else
     1130   {
     1131      QMSG qmsg;
     1132      BOOL bErase;
     1133
     1134      bErase = (WinPeekMsg (HABX, &qmsg, hwnd, WM_PAINT, WM_PAINT, PM_REMOVE)
     1135                && (redraw & RDW_NOERASE_W) == 0);
     1136
     1137      setSupressErase (FALSE, !bErase);
     1138   }
     1139
     1140   if (redraw & (RDW_NOINTERNALPAINT_W | RDW_INTERNALPAINT_W))
     1141   {
     1142      QMSG qmsg;
     1143
     1144      WinPeekMsg( (HAB)0, &qmsg, hwnd, WM_VIRTUAL_INTERNALPAINT,
     1145                  WM_VIRTUAL_INTERNALPAINT, PM_REMOVE );
     1146   }
     1147#endif
     1148
     1149   if (hrgn)
     1150   {
     1151      ULONG BytesNeeded;
     1152      PRGNDATA_W RgnData;
     1153      PRECTL pr;
     1154      int i;
     1155      LONG height = wnd ? wnd->getWindowHeight() : OSLibQueryScreenHeight();
     1156
     1157      if (!hrgn)
     1158         goto error;
     1159
     1160      BytesNeeded = _O32_GetRegionData (hrgn, 0, NULL);
     1161      RgnData = (PRGNDATA_W)_alloca (BytesNeeded);
     1162      if (RgnData == NULL)
     1163          goto error;
     1164      _O32_GetRegionData (hrgn, BytesNeeded, RgnData);
     1165
     1166      pr = (PRECTL)(RgnData->Buffer);
     1167      for (i = RgnData->rdh.nCount; i > 0; i--, pr++) {
     1168         LONG temp = pr->yTop;
     1169         pr->yTop = height - pr->yBottom;
     1170         pr->yBottom = height - temp;
     1171      }
     1172
     1173      hpsTemp = WinGetScreenPS (HWND_DESKTOP);
     1174      hrgnTemp = GpiCreateRegion (hpsTemp, RgnData->rdh.nCount, (PRECTL)(RgnData->Buffer));
     1175      if (!hrgnTemp) goto error;
     1176   }
     1177   else if (pRect)
     1178   {
     1179      LONG height = wnd ? wnd->getWindowHeight() : OSLibQueryScreenHeight();
     1180
     1181      PMRECT_FROM_WINRECT (rectl, *pRect);
     1182      rectl.yTop    = height - rectl.yTop;
     1183      rectl.yBottom = height - rectl.yBottom;
     1184   }
     1185
     1186   if (redraw & RDW_INVALIDATE_W)
     1187   {
     1188//      if (redraw & RDW_ERASE_W)
     1189//         setEraseBkgnd (TRUE, TRUE);
     1190
     1191      if (!pRect && !hrgn)
     1192         success = WinInvalidateRect (hwnd, NULL, IncludeChildren);
     1193      else if (hrgn)
     1194         success = WinInvalidateRegion (hwnd, hrgnTemp, IncludeChildren);
     1195      else
     1196         success = WinInvalidateRect (hwnd, &rectl, IncludeChildren);
     1197      if (!success) goto error;
     1198   }
     1199   else if (redraw & RDW_VALIDATE_W)
     1200   {
     1201      if (WinQueryUpdateRect (hwnd, NULL))
     1202      {
     1203         if (!pRect && !hrgn)
     1204            success = WinValidateRect (hwnd, NULL, IncludeChildren);
     1205         else if (hrgn)
     1206            success = WinValidateRegion (hwnd, hrgnTemp, IncludeChildren);
     1207         else
     1208            success = WinValidateRect (hwnd, &rectl, IncludeChildren);
     1209         if (!success) goto error;
     1210      }
     1211   }
     1212
     1213   if (WinQueryUpdateRect (hwnd, NULL))
     1214   {
     1215      if (redraw & RDW_UPDATENOW_W)
     1216         wnd->MsgPaint (0, FALSE);
     1217
     1218//      else if ((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W))
     1219//         setEraseBkgnd (FALSE, !sendEraseBkgnd (wnd));
     1220   }
     1221   else if ((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W))
     1222   {
     1223      if (redraw & RDW_UPDATENOW_W)
     1224         wnd->MsgPaint (0, FALSE);
     1225//      else
     1226//         WinPostMsg( hwnd, WM_VIRTUAL_INTERNALPAINT, MPVOID, MPVOID );
     1227   }
     1228
     1229error:
     1230   /* clean up */
     1231   if (hrgnTemp)
     1232      GpiDestroyRegion (hpsTemp, hrgnTemp);
     1233
     1234   if (hpsTemp)
     1235      WinReleasePS (hpsTemp);
     1236
     1237//   if ((redraw & RDW_INVALIDATE_W) == 0)
     1238//      setSupressErase (FALSE, FALSE);
     1239//   else if ((redraw & RDW_ERASENOW_W) == RDW_ERASENOW_W)
     1240//      setSupressErase (FALSE, TRUE);
     1241
     1242//   if (!success)
     1243//      SET_ERROR_LAST();
     1244
     1245   SetFS(sel);
     1246   return (success);
     1247}
     1248
     1249BOOL WIN32API InvalidateRect (HWND hwnd, const RECT *pRect, BOOL erase)
     1250{
     1251   USHORT sel = RestoreOS2FS();
     1252//   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
     1253   BOOL result;
     1254
     1255// todo !!
     1256//   if ( isFrame without client )
     1257//      erase = TRUE;
     1258
     1259   result = RedrawWindow (hwnd, pRect, NULLHANDLE,
     1260                          RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
     1261                          (erase ? RDW_ERASE_W : 0) |
     1262                          (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0));
     1263   SetFS(sel);
     1264   return (result);
     1265}
     1266
     1267BOOL WIN32API InvalidateRgn (HWND hwnd, HRGN hrgn, BOOL erase)
     1268{
     1269   USHORT sel = RestoreOS2FS();
     1270//   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
     1271   BOOL result;
     1272
     1273// todo !!
     1274//   if ( isFrame without client )
     1275//      erase = TRUE;
     1276
     1277   result = RedrawWindow (hwnd, NULL, hrgn,
     1278                          RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
     1279                          (erase ? RDW_ERASE_W : 0) |
     1280                          (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0));
     1281   SetFS(sel);
     1282   return (result);
     1283}
     1284
    10401285//******************************************************************************
    10411286//******************************************************************************
  • trunk/src/user32/user32.cpp

    r949 r962  
    1 /* $Id: user32.cpp,v 1.25 1999-09-15 23:18:57 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.26 1999-09-16 18:00:44 dengert Exp $ */
    22
    33/*
     
    10401040//******************************************************************************
    10411041//******************************************************************************
     1042#if 0
    10421043BOOL WIN32API InvalidateRgn( HWND arg1, HRGN arg2, BOOL  arg3)
    10431044{
     
    10471048    return O32_InvalidateRgn(arg1, arg2, arg3);
    10481049}
     1050#endif
    10491051//******************************************************************************
    10501052//******************************************************************************
  • trunk/src/user32/window.cpp

    r949 r962  
    1 /* $Id: window.cpp,v 1.1 1999-09-15 23:19:02 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.2 1999-09-16 18:00:43 dengert Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    300300//******************************************************************************
    301301//******************************************************************************
     302#if 0
    302303BOOL WIN32API UpdateWindow(HWND hwnd)
    303304{
     
    312313    return window->UpdateWindow();
    313314}
     315#endif
    314316//******************************************************************************
    315317//******************************************************************************
     
    518520//******************************************************************************
    519521//******************************************************************************
     522
     523#if 0
    520524BOOL WIN32API RedrawWindow( HWND arg1, const RECT * arg2, HRGN arg3, UINT arg4)
    521525{
     
    531535  return(rc);
    532536}
     537#endif
    533538//******************************************************************************
    534539//******************************************************************************
     
    993998  curpid = GetCurrentProcessId();
    994999
    995   henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);         
     1000  henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);
    9961001  while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
    9971002  {
    998         OSLibWinQueryWindowProcess(hwndNext, &pid, &tid);
    999         if(!(curpid == pid && dwThreadId == tid))
    1000                 continue;
    1001 
    1002         window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
    1003         if(window == NULL) {
    1004                 //OS/2 window or non-frame window, so skip it
    1005                 continue;
    1006         }
    1007         if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE)
    1008                 break;
     1003        OSLibWinQueryWindowProcess(hwndNext, &pid, &tid);
     1004        if(!(curpid == pid && dwThreadId == tid))
     1005                continue;
     1006
     1007        window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
     1008        if(window == NULL) {
     1009                //OS/2 window or non-frame window, so skip it
     1010                continue;
     1011        }
     1012        if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE)
     1013                break;
    10091014  }
    10101015  OSLibWinEndEnumWindows (henum);
     
    10281033  }
    10291034
    1030   henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);         
     1035  henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);
    10311036  while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
    10321037  {
    1033         window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
    1034         if(window == NULL) {
    1035                 //OS/2 window or non-frame window, so skip it
    1036                 continue;
    1037         }
    1038         if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE)
    1039         {
    1040                 rc = FALSE;
    1041                 break;
    1042         }
     1038        window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
     1039        if(window == NULL) {
     1040                //OS/2 window or non-frame window, so skip it
     1041                continue;
     1042        }
     1043        if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE)
     1044        {
     1045                rc = FALSE;
     1046                break;
     1047        }
    10431048  }
    10441049  OSLibWinEndEnumWindows(henum);
     
    10571062
    10581063  do {
    1059         henum = OSLibWinBeginEnumWindows(hwndParent);         
    1060         while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
    1061         {
    1062                 window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
    1063                 if(window == NULL) {
    1064                         //OS/2 window or non-frame window, so skip it
    1065                         continue;
    1066                 }
    1067                 if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE) {
    1068                         goto Abort;
    1069                 }
    1070         }
    1071         if(hwndParent == OSLIB_HWND_OBJECT)
    1072                 break;
    1073         hwndParent = OSLIB_HWND_OBJECT;
    1074         OSLibWinEndEnumWindows(henum);
     1064        henum = OSLibWinBeginEnumWindows(hwndParent);
     1065        while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
     1066        {
     1067                window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
     1068                if(window == NULL) {
     1069                        //OS/2 window or non-frame window, so skip it
     1070                        continue;
     1071                }
     1072                if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE) {
     1073                        goto Abort;
     1074                }
     1075        }
     1076        if(hwndParent == OSLIB_HWND_OBJECT)
     1077                break;
     1078        hwndParent = OSLIB_HWND_OBJECT;
     1079        OSLibWinEndEnumWindows(henum);
    10751080  }
    10761081  while(TRUE);
     
    10931098//******************************************************************************
    10941099//******************************************************************************
     1100#if 0
    10951101BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase)
    10961102{
     
    11091115    else return OSLibWinInvalidateRect(hWnd,NULL,bErase);
    11101116}
     1117#endif
    11111118//******************************************************************************
    11121119//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.