2016-05-14 00:35:41 +00:00
|
|
|
#if __ORCAC__
|
|
|
|
#pragma lint -1
|
2015-09-24 00:40:17 +00:00
|
|
|
#pragma noroot
|
2016-05-14 02:44:12 +00:00
|
|
|
segment "VNCview GS";
|
2016-05-14 00:35:41 +00:00
|
|
|
#endif
|
2015-09-24 00:40:17 +00:00
|
|
|
|
|
|
|
#include <window.h>
|
|
|
|
#include <quickdraw.h>
|
|
|
|
#include <qdaux.h>
|
|
|
|
#include <desk.h>
|
|
|
|
#include <memory.h>
|
|
|
|
#include <resources.h>
|
|
|
|
#include <tcpip.h>
|
|
|
|
#include <menu.h>
|
|
|
|
#include <control.h>
|
|
|
|
#include <misctool.h>
|
|
|
|
#include <scrap.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <event.h>
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
#include "vncsession.h"
|
|
|
|
#include "vncview.h"
|
|
|
|
#include "vncdisplay.h"
|
2016-09-16 03:25:02 +00:00
|
|
|
#include "readtcp.h"
|
2015-09-24 00:40:17 +00:00
|
|
|
#include "copyrect.h"
|
|
|
|
|
|
|
|
void DoCopyRect (void) {
|
|
|
|
/* For use with GetContentOrigin() */
|
2016-05-29 04:58:04 +00:00
|
|
|
Origin contentOrigin;
|
2015-09-24 01:26:03 +00:00
|
|
|
|
2015-09-24 00:40:17 +00:00
|
|
|
Rect srcRect;
|
2015-09-24 01:26:03 +00:00
|
|
|
unsigned int *dataPtr; /* Pointer to TCP data that was read */
|
2015-09-24 00:40:17 +00:00
|
|
|
|
|
|
|
//printf("Processing CopyRect rectangle\n");
|
|
|
|
|
2015-09-24 01:26:03 +00:00
|
|
|
if (! DoReadTCP ((unsigned long) 4))
|
|
|
|
return; /* Not ready yet; wait */
|
2015-09-24 00:40:17 +00:00
|
|
|
|
2016-05-29 04:58:04 +00:00
|
|
|
contentOrigin.l = GetContentOrigin(vncWindow);
|
2015-09-24 00:40:17 +00:00
|
|
|
|
2016-09-16 02:40:39 +00:00
|
|
|
dataPtr = (unsigned int *) readBufferPtr;
|
2016-05-29 04:58:04 +00:00
|
|
|
srcRect.h1 = SwapBytes2(dataPtr[0]) - contentOrigin.pt.h;
|
|
|
|
srcRect.v1 = SwapBytes2(dataPtr[1]) - contentOrigin.pt.v;
|
2015-09-24 00:40:17 +00:00
|
|
|
|
|
|
|
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())) {
|
2015-09-24 01:26:03 +00:00
|
|
|
SendFBUpdateRequest(FALSE, rectX, rectY, rectWidth, rectHeight);
|
2016-05-28 23:33:31 +00:00
|
|
|
goto done;
|
2015-09-24 01:56:33 +00:00
|
|
|
}
|
2015-09-24 00:40:17 +00:00
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*/
|
2015-09-24 01:26:03 +00:00
|
|
|
PPToPort((struct LocInfo *) vncWindow, &srcRect,
|
2016-05-29 04:58:04 +00:00
|
|
|
rectX - contentOrigin.pt.h, rectY - contentOrigin.pt.v, modeCopy);
|
2015-09-24 00:40:17 +00:00
|
|
|
|
2016-05-28 23:33:31 +00:00
|
|
|
done:
|
2015-09-24 01:26:03 +00:00
|
|
|
NextRect(); /* Prepare for next rect */
|
2015-09-24 01:56:33 +00:00
|
|
|
}
|
2015-09-24 00:40:17 +00:00
|
|
|
|