#if __ORCAC__ #pragma lint -1 #pragma noroot segment "VNCview GS"; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "vncsession.h" #include "vncview.h" #include "vncdisplay.h" #include "colortables.h" #include "menus.h" #include "clipboard.h" #include "desktopsize.h" #include "mouse.h" #include "keyboard.h" #include "copyrect.h" #include "raw.h" #include "hextile.h" void DoCopyRect (void) { /* For use with GetContentOrigin() */ unsigned long contentOrigin; Point * contentOriginPtr = (void *) &contentOrigin; Rect srcRect; unsigned int *dataPtr; /* Pointer to TCP data that was read */ //printf("Processing CopyRect rectangle\n"); if (! DoReadTCP ((unsigned long) 4)) return; /* Not ready yet; wait */ contentOrigin = GetContentOrigin(vncWindow); HLock(readBufferHndl); dataPtr = (unsigned int *) ((char *) (*readBufferHndl)); srcRect.h1 = SwapBytes2(dataPtr[0]) - contentOriginPtr->h; srcRect.v1 = SwapBytes2(dataPtr[1]) - contentOriginPtr->v; HUnlock(readBufferHndl); srcRect.h2 = srcRect.h1 + rectWidth; srcRect.v2 = srcRect.v1 + rectHeight; /* Check that the source rect is actually visible; if not, ask the server to send the update using some other encoding. */ if (!RectInRgn(&srcRect, GetVisHandle())) { SendFBUpdateRequest(FALSE, rectX, rectY, rectWidth, rectHeight); displayInProgress = FALSE; return; } /* We can use the window pointer as a LocInfo pointer because it starts * with a grafPort structure, which in turn starts with a LocInfo structure. */ PPToPort((struct LocInfo *) vncWindow, &srcRect, rectX - contentOriginPtr->h, rectY - contentOriginPtr->v, modeCopy); displayInProgress = FALSE; NextRect(); /* Prepare for next rect */ }