⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vnchooks.cc

📁 Informix Table extraction queries have been optimized
💻 CC
📖 第 1 页 / 共 4 页
字号:
// ClearToBackground - changed region is the given rectangle, clipped by// clipList, but only if generateExposures is false.static void vncHooksClearToBackground(WindowPtr pWin, int x, int y, int w,                                      int h, Bool generateExposures){  SCREEN_UNWRAP(pWin->drawable.pScreen, ClearToBackground);  BoxRec box;  box.x1 = x + pWin->drawable.x;  box.y1 = y + pWin->drawable.y;  box.x2 = w ? (box.x1 + w) : (pWin->drawable.x + pWin->drawable.width);  box.y2 = h ? (box.y1 + h) : (pWin->drawable.y + pWin->drawable.height);  RegionHelper changed(pScreen, &box, 0);  REGION_INTERSECT(pScreen, changed.reg, changed.reg, &pWin->clipList);  (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);  if (!generateExposures) {    vncHooksScreen->desktop->add_changed(changed.reg);  }  SCREEN_REWRAP(ClearToBackground);}// RestoreAreas - changed region is the given regionstatic RegionPtr vncHooksRestoreAreas(WindowPtr pWin, RegionPtr pRegion){  SCREEN_UNWRAP(pWin->drawable.pScreen, RestoreAreas);  RegionHelper changed(pScreen, pRegion);  RegionPtr result = (*pScreen->RestoreAreas) (pWin, pRegion);  vncHooksScreen->desktop->add_changed(changed.reg);  SCREEN_REWRAP(RestoreAreas);  return result;}// InstallColormap - get the new colormapstatic void vncHooksInstallColormap(ColormapPtr pColormap){  SCREEN_UNWRAP(pColormap->pScreen, InstallColormap);  (*pScreen->InstallColormap) (pColormap);  vncHooksScreen->desktop->setColormap(pColormap);  SCREEN_REWRAP(InstallColormap);}// StoreColors - get the colormap changesstatic void vncHooksStoreColors(ColormapPtr pColormap, int ndef,                                xColorItem* pdef){  SCREEN_UNWRAP(pColormap->pScreen, StoreColors);  (*pScreen->StoreColors) (pColormap, ndef, pdef);  vncHooksScreen->desktop->setColourMapEntries(pColormap, ndef, pdef);  SCREEN_REWRAP(StoreColors);}// DisplayCursor - get the cursor shapestatic Bool vncHooksDisplayCursor(ScreenPtr pScreen_, CursorPtr cursor){  SCREEN_UNWRAP(pScreen_, DisplayCursor);  Bool ret = (*pScreen->DisplayCursor) (pScreen, cursor);  vncHooksScreen->desktop->setCursor(cursor);  SCREEN_REWRAP(DisplayCursor);  return ret;}// BlockHandler - ignore any changes during the block handler - it's likely// these are just drawing the cursor.static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,                                 pointer pReadmask){  SCREEN_UNWRAP(screenInfo.screens[i], BlockHandler);  vncHooksScreen->desktop->ignoreHooks(true);  (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);  vncHooksScreen->desktop->ignoreHooks(false);  SCREEN_REWRAP(BlockHandler);}///////////////////////////////////////////////////////////////////////////////// GC "funcs"//// GCFuncUnwrapper is a helper class which unwraps the GC funcs and ops in its// constructor and rewraps them in its destructor.class GCFuncUnwrapper {public:  GCFuncUnwrapper(GCPtr pGC_) : pGC(pGC_) {    vncHooksGC = (vncHooksGCPtr)pGC->devPrivates[vncHooksGCIndex].ptr;    pGC->funcs = vncHooksGC->wrappedFuncs;    if (vncHooksGC->wrappedOps)      pGC->ops = vncHooksGC->wrappedOps;  }  ~GCFuncUnwrapper() {    vncHooksGC->wrappedFuncs = pGC->funcs;    pGC->funcs = &vncHooksGCFuncs;    if (vncHooksGC->wrappedOps) {      vncHooksGC->wrappedOps = pGC->ops;      pGC->ops = &vncHooksGCOps;    }  }  GCPtr pGC;  vncHooksGCPtr vncHooksGC;};// ValidateGC - wrap the "ops" if a viewable windowstatic void vncHooksValidateGC(GCPtr pGC, unsigned long changes,                               DrawablePtr pDrawable){  GCFuncUnwrapper u(pGC);  DBGPRINT((stderr,"vncHooksValidateGC called\n"));  (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);      u.vncHooksGC->wrappedOps = 0;  if (pDrawable->type == DRAWABLE_WINDOW && ((WindowPtr)pDrawable)->viewable) {    WindowPtr pWin = (WindowPtr)pDrawable;    RegionPtr pRegion = &pWin->clipList;    if (pGC->subWindowMode == IncludeInferiors)      pRegion = &pWin->borderClip;    if (REGION_NOTEMPTY(pDrawable->pScreen, pRegion)) {      u.vncHooksGC->wrappedOps = pGC->ops;      DBGPRINT((stderr,"vncHooksValidateGC: wrapped GC ops\n"));    }  }}// Other GC funcs - just unwrap and call onstatic void vncHooksChangeGC(GCPtr pGC, unsigned long mask) {  GCFuncUnwrapper u(pGC);  (*pGC->funcs->ChangeGC) (pGC, mask);}static void vncHooksCopyGC(GCPtr src, unsigned long mask, GCPtr dst) {  GCFuncUnwrapper u(dst);  (*dst->funcs->CopyGC) (src, mask, dst);}static void vncHooksDestroyGC(GCPtr pGC) {  GCFuncUnwrapper u(pGC);  (*pGC->funcs->DestroyGC) (pGC);}static void vncHooksChangeClip(GCPtr pGC, int type, pointer pValue, int nrects){  GCFuncUnwrapper u(pGC);  (*pGC->funcs->ChangeClip) (pGC, type, pValue, nrects);}static void vncHooksDestroyClip(GCPtr pGC) {  GCFuncUnwrapper u(pGC);  (*pGC->funcs->DestroyClip) (pGC);}static void vncHooksCopyClip(GCPtr dst, GCPtr src) {  GCFuncUnwrapper u(dst);  (*dst->funcs->CopyClip) (dst, src);}///////////////////////////////////////////////////////////////////////////////// GC "ops"//// GCOpUnwrapper is a helper class which unwraps the GC funcs and ops in its// constructor and rewraps them in its destructor.class GCOpUnwrapper {public:  GCOpUnwrapper(DrawablePtr pDrawable, GCPtr pGC_)    : pGC(pGC_), pScreen(pDrawable->pScreen)  {    vncHooksGC = (vncHooksGCPtr)pGC->devPrivates[vncHooksGCIndex].ptr;    oldFuncs = pGC->funcs;    pGC->funcs = vncHooksGC->wrappedFuncs;    pGC->ops = vncHooksGC->wrappedOps;  }  ~GCOpUnwrapper() {    vncHooksGC->wrappedOps = pGC->ops;    pGC->funcs = oldFuncs;    pGC->ops = &vncHooksGCOps;  }  GCPtr pGC;  vncHooksGCPtr vncHooksGC;  GCFuncs* oldFuncs;  ScreenPtr pScreen;};#define GC_OP_UNWRAPPER(pDrawable, pGC, name)                             \  GCOpUnwrapper u(pDrawable, pGC);                                        \  ScreenPtr pScreen = (pDrawable)->pScreen;                               \  vncHooksScreenPtr vncHooksScreen                                        \    = ((vncHooksScreenPtr)pScreen->devPrivates[vncHooksScreenIndex].ptr); \  DBGPRINT((stderr,"vncHooks" #name " called\n"));// FillSpans - changed region is the whole of borderClip.  This is pessimistic,// but I believe this function is rarely used so it doesn't matter.static void vncHooksFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,                              DDXPointPtr pptInit, int *pwidthInit,                              int fSorted){  GC_OP_UNWRAPPER(pDrawable, pGC, FillSpans);  RegionHelper changed(pScreen, &((WindowPtr)pDrawable)->borderClip);  (*pGC->ops->FillSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);  vncHooksScreen->desktop->add_changed(changed.reg);}// SetSpans - changed region is the whole of borderClip.  This is pessimistic,// but I believe this function is rarely used so it doesn't matter.static void vncHooksSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,                             DDXPointPtr ppt, int *pwidth, int nspans,                             int fSorted){  GC_OP_UNWRAPPER(pDrawable, pGC, SetSpans);  RegionHelper changed(pScreen, &((WindowPtr)pDrawable)->borderClip);  (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);  vncHooksScreen->desktop->add_changed(changed.reg);}// PutImage - changed region is the given rectangle, clipped by pCompositeClipstatic void vncHooksPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,                             int x, int y, int w, int h, int leftPad,                             int format, char *pBits){  GC_OP_UNWRAPPER(pDrawable, pGC, PutImage);  BoxRec box;  box.x1 = x + pDrawable->x;  box.y1 = y + pDrawable->y;  box.x2 = box.x1 + w;  box.y2 = box.y1 + h;  RegionHelper changed(pScreen, &box, 0);  REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC));  (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format,                         pBits);  vncHooksScreen->desktop->add_changed(changed.reg);}// CopyArea - destination of the copy is the dest rectangle, clipped by// pCompositeClip.  Any parts of the destination which cannot be copied from// the source (could be all of it) go into the changed region.static RegionPtr vncHooksCopyArea(DrawablePtr pSrc, DrawablePtr pDst,                                  GCPtr pGC, int srcx, int srcy, int w, int h,                                  int dstx, int dsty){  GC_OP_UNWRAPPER(pDst, pGC, CopyArea);  BoxRec box;  box.x1 = dstx + pDst->x;  box.y1 = dsty + pDst->y;  box.x2 = box.x1 + w;  box.y2 = box.y1 + h;  RegionHelper dst(pScreen, &box, 0);  REGION_INTERSECT(pScreen, dst.reg, dst.reg, COMPOSITE_CLIP(pGC));  RegionHelper src(pScreen);  if ((pSrc->type == DRAWABLE_WINDOW) && (pSrc->pScreen == pScreen)) {    box.x1 = srcx + pSrc->x;    box.y1 = srcy + pSrc->y;    box.x2 = box.x1 + w;    box.y2 = box.y1 + h;    src.init(&box, 0);    REGION_INTERSECT(pScreen, src.reg, src.reg, &((WindowPtr)pSrc)->clipList);    REGION_TRANSLATE(pScreen, src.reg,                     dstx + pDst->x - srcx - pSrc->x,                     dsty + pDst->y - srcy - pSrc->y);  } else {    src.init(NullBox, 0);  }  RegionHelper changed(pScreen, NullBox, 0);  REGION_SUBTRACT(pScreen, changed.reg, dst.reg, src.reg);  REGION_INTERSECT(pScreen, dst.reg, dst.reg, src.reg);  RegionPtr rgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h,                                         dstx, dsty);  if (REGION_NOTEMPTY(pScreen, dst.reg))    vncHooksScreen->desktop->add_copied(dst.reg,                                        dstx + pDst->x - srcx - pSrc->x,                                        dsty + pDst->y - srcy - pSrc->y);  if (REGION_NOTEMPTY(pScreen, changed.reg))    vncHooksScreen->desktop->add_changed(changed.reg);  return rgn;}// CopyPlane - changed region is the destination rectangle, clipped by// pCompositeClipstatic RegionPtr vncHooksCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,                                   GCPtr pGC, int srcx, int srcy, int w, int h,                                   int dstx, int dsty, unsigned long plane){  GC_OP_UNWRAPPER(pDst, pGC, CopyPlane);  BoxRec box;  box.x1 = dstx + pDst->x;  box.y1 = dsty + pDst->y;  box.x2 = box.x1 + w;  box.y2 = box.y1 + h;  RegionHelper changed(pScreen, &box, 0);  REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC));  RegionPtr rgn = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h,                                          dstx, dsty, plane);  vncHooksScreen->desktop->add_changed(changed.reg);  return rgn;}// PolyPoint - changed region is the bounding rect, clipped by pCompositeClipstatic void vncHooksPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,                              int npt, xPoint *pts){  GC_OP_UNWRAPPER(pDrawable, pGC, PolyPoint);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -