mirror of
https://github.com/sheumann/VNCviewGS.git
synced 2024-11-23 08:36:05 +00:00
Consistently use spaces for indentation
This commit is contained in:
parent
f44c7089d2
commit
ab3210adb0
58
clipboard.cc
58
clipboard.cc
@ -32,15 +32,15 @@
|
||||
/* Update the Scrap Manager clipboard with new data sent from server.
|
||||
*/
|
||||
void DoServerCutText (void) {
|
||||
unsigned long textLen;
|
||||
unsigned long textLen;
|
||||
unsigned long i;
|
||||
|
||||
if (! DoWaitingReadTCP (3)) { /* Read & ignore padding */
|
||||
DoClose(vncWindow);
|
||||
if (! DoWaitingReadTCP (3)) { /* Read & ignore padding */
|
||||
DoClose(vncWindow);
|
||||
return;
|
||||
}
|
||||
if (! DoWaitingReadTCP (4)) {
|
||||
DoClose(vncWindow);
|
||||
if (! DoWaitingReadTCP (4)) {
|
||||
DoClose(vncWindow);
|
||||
return;
|
||||
}
|
||||
HLock(readBufferHndl);
|
||||
@ -48,65 +48,65 @@ void DoServerCutText (void) {
|
||||
HUnlock(readBufferHndl);
|
||||
|
||||
if (! DoWaitingReadTCP(textLen)) {
|
||||
DoClose(vncWindow);
|
||||
DoClose(vncWindow);
|
||||
return;
|
||||
};
|
||||
if (allowClipboardTransfers) {
|
||||
if (allowClipboardTransfers) {
|
||||
ZeroScrap();
|
||||
HLock(readBufferHndl);
|
||||
|
||||
/* Convert lf->cr; Use pointer arithmetic so we can go over 64k */
|
||||
for (i = 0; i < textLen; i++)
|
||||
if (*((*(char **)readBufferHndl)+i) == '\n')
|
||||
if (*((*(char **)readBufferHndl)+i) == '\n')
|
||||
*((*(char **)readBufferHndl)+i) = '\r';
|
||||
|
||||
/* Below function call requires <scrap.h> to be fixed */
|
||||
/* Below function call requires <scrap.h> to be fixed */
|
||||
PutScrap(textLen, textScrap, (Pointer) *readBufferHndl);
|
||||
/* Potential errors (e.g. out of memory) ignored */
|
||||
HUnlock(readBufferHndl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DoSendClipboard (void) {
|
||||
static struct clientCutText {
|
||||
unsigned char messageType;
|
||||
static struct clientCutText {
|
||||
unsigned char messageType;
|
||||
unsigned char padding1;
|
||||
unsigned int padding2;
|
||||
unsigned long length;
|
||||
} clientCutTextStruct = { 6 /* Message type 6 */ };
|
||||
} clientCutTextStruct = { 6 /* Message type 6 */ };
|
||||
|
||||
Handle scrapHandle;
|
||||
unsigned long i;
|
||||
|
||||
/* Only proceed if we're connected to the server and not view-only */
|
||||
if (vncConnected && !viewOnlyMode) {
|
||||
clientCutTextStruct.length = GetScrapSize(textScrap);
|
||||
/* Only proceed if we're connected to the server and not view-only */
|
||||
if (vncConnected && !viewOnlyMode) {
|
||||
clientCutTextStruct.length = GetScrapSize(textScrap);
|
||||
|
||||
if (clientCutTextStruct.length == 0)
|
||||
return;
|
||||
|
||||
return;
|
||||
|
||||
clientCutTextStruct.length = SwapBytes4(clientCutTextStruct.length);
|
||||
|
||||
|
||||
scrapHandle = NewHandle(1, userid(), 0x0000, NULL);
|
||||
GetScrap(scrapHandle, textScrap);
|
||||
if (toolerror())
|
||||
goto end; /* abort if error */
|
||||
if (TCPIPWriteTCP(hostIpid, &clientCutTextStruct.messageType,
|
||||
sizeof(clientCutTextStruct), FALSE, FALSE))
|
||||
goto end; /* abort if error */
|
||||
goto end; /* abort if error */
|
||||
if (TCPIPWriteTCP(hostIpid, &clientCutTextStruct.messageType,
|
||||
sizeof(clientCutTextStruct), FALSE, FALSE))
|
||||
goto end; /* abort if error */
|
||||
if (toolerror())
|
||||
goto end;
|
||||
|
||||
clientCutTextStruct.length = SwapBytes4(clientCutTextStruct.length);
|
||||
goto end;
|
||||
|
||||
clientCutTextStruct.length = SwapBytes4(clientCutTextStruct.length);
|
||||
|
||||
HLock(scrapHandle);
|
||||
/* Convert cr->lf; Use pointer arithmetic so we can go over 64k */
|
||||
for (i = 0; i < clientCutTextStruct.length; i++)
|
||||
if (*((*(char **)scrapHandle)+i) == '\r')
|
||||
if (*((*(char **)scrapHandle)+i) == '\r')
|
||||
*((*(char **)scrapHandle)+i) = '\n';
|
||||
|
||||
TCPIPWriteTCP(hostIpid, (Pointer) *scrapHandle,
|
||||
clientCutTextStruct.length, TRUE, FALSE);
|
||||
TCPIPWriteTCP(hostIpid, (Pointer) *scrapHandle,
|
||||
clientCutTextStruct.length, TRUE, FALSE);
|
||||
/* Can't handle errors usefully here */
|
||||
HUnlock(scrapHandle);
|
||||
|
||||
|
@ -98,8 +98,8 @@ BOOLEAN MakeBigColorTables (unsigned int iters)
|
||||
{
|
||||
static unsigned int i = 0;
|
||||
unsigned int iMax = i + iters;
|
||||
if (iMax < i) /* Deal with wraparound */
|
||||
iMax = 0;
|
||||
if (iMax < i) /* Deal with wraparound */
|
||||
iMax = 0;
|
||||
|
||||
/* The addressing scheme here depends on the IIgs's little-endianness */
|
||||
do {
|
||||
@ -110,9 +110,9 @@ BOOLEAN MakeBigColorTables (unsigned int iters)
|
||||
} while (i != iMax);
|
||||
|
||||
if (iMax == 0)
|
||||
return TRUE; /* Done */
|
||||
return TRUE; /* Done */
|
||||
else
|
||||
return FALSE; /* In progress */
|
||||
return FALSE; /* In progress */
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
22
copyrect.cc
22
copyrect.cc
@ -31,21 +31,21 @@
|
||||
|
||||
void DoCopyRect (void) {
|
||||
/* For use with GetContentOrigin() */
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
|
||||
Rect srcRect;
|
||||
unsigned int *dataPtr; /* Pointer to TCP data that was read */
|
||||
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 */
|
||||
if (! DoReadTCP ((unsigned long) 4))
|
||||
return; /* Not ready yet; wait */
|
||||
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
|
||||
HLock(readBufferHndl);
|
||||
dataPtr = (unsigned int *) ((char *) (*readBufferHndl));
|
||||
dataPtr = (unsigned int *) ((char *) (*readBufferHndl));
|
||||
srcRect.h1 = SwapBytes2(dataPtr[0]) - contentOriginPtr->h;
|
||||
srcRect.v1 = SwapBytes2(dataPtr[1]) - contentOriginPtr->v;
|
||||
HUnlock(readBufferHndl);
|
||||
@ -57,7 +57,7 @@ void DoCopyRect (void) {
|
||||
to send the update using some other encoding.
|
||||
*/
|
||||
if (!RectInRgn(&srcRect, GetVisHandle())) {
|
||||
SendFBUpdateRequest(FALSE, rectX, rectY, rectWidth, rectHeight);
|
||||
SendFBUpdateRequest(FALSE, rectX, rectY, rectWidth, rectHeight);
|
||||
displayInProgress = FALSE;
|
||||
return;
|
||||
}
|
||||
@ -65,11 +65,11 @@ void DoCopyRect (void) {
|
||||
/* 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);
|
||||
PPToPort((struct LocInfo *) vncWindow, &srcRect,
|
||||
rectX - contentOriginPtr->h, rectY - contentOriginPtr->v, modeCopy);
|
||||
|
||||
displayInProgress = FALSE;
|
||||
|
||||
NextRect(); /* Prepare for next rect */
|
||||
NextRect(); /* Prepare for next rect */
|
||||
}
|
||||
|
||||
|
@ -33,9 +33,9 @@
|
||||
extern pascal void SetContentOrigin2(Word, Word, Word, GrafPortPtr) inline(0x570E,dispatcher);
|
||||
|
||||
void DoDesktopSize (void) {
|
||||
#define screenTooBigError 2010
|
||||
#define screenTooBigError 2010
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
unsigned int newX, newY;
|
||||
Boolean changeOrigin = FALSE;
|
||||
unsigned int oldWinHeight, oldWinWidth;
|
||||
@ -45,7 +45,7 @@ void DoDesktopSize (void) {
|
||||
|
||||
if ((fbWidth > 16384) || (fbHeight > 16384)) {
|
||||
AlertWindow(awResource, NULL, screenTooBigError);
|
||||
DoClose(vncWindow);
|
||||
DoClose(vncWindow);
|
||||
}
|
||||
|
||||
oldWinHeight = winHeight;
|
||||
@ -53,11 +53,11 @@ void DoDesktopSize (void) {
|
||||
winHeight = 174;
|
||||
winWidth = (hRez == 640) ? 613 : 302;
|
||||
if (fbWidth < winWidth)
|
||||
winWidth = fbWidth;
|
||||
winWidth = fbWidth;
|
||||
if (fbHeight < winHeight)
|
||||
winHeight = fbHeight;
|
||||
winHeight = fbHeight;
|
||||
if (oldWinHeight != winHeight || oldWinWidth != winWidth)
|
||||
SizeWindow(winWidth, winHeight, vncWindow);
|
||||
SizeWindow(winWidth, winHeight, vncWindow);
|
||||
|
||||
/* Scroll if area displayed is going away */
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
@ -65,11 +65,11 @@ void DoDesktopSize (void) {
|
||||
newY = contentOriginPtr->v;
|
||||
|
||||
if (contentOriginPtr->h + winWidth > fbWidth) {
|
||||
newX = fbWidth - winWidth;
|
||||
newX = fbWidth - winWidth;
|
||||
changeOrigin = TRUE;
|
||||
}
|
||||
if (contentOriginPtr->v + winHeight > fbHeight) {
|
||||
newY = fbHeight - winHeight;
|
||||
newY = fbHeight - winHeight;
|
||||
changeOrigin = TRUE;
|
||||
}
|
||||
SetContentOrigin2(1, newX, newY, vncWindow);
|
||||
@ -79,6 +79,6 @@ void DoDesktopSize (void) {
|
||||
|
||||
displayInProgress = FALSE;
|
||||
|
||||
NextRect(); /* Prepare for next rect */
|
||||
}
|
||||
NextRect(); /* Prepare for next rect */
|
||||
}
|
||||
|
||||
|
306
hextile.cc
306
hextile.cc
@ -29,7 +29,7 @@
|
||||
#include "raw.h"
|
||||
#include "hextile.h"
|
||||
|
||||
unsigned int hexXTiles, hexYTiles; /* For in-process hextile processing */
|
||||
unsigned int hexXTiles, hexYTiles; /* For in-process hextile processing */
|
||||
unsigned int hexXTileNum, hexYTileNum;
|
||||
unsigned int hexTileWidth, hexTileHeight;
|
||||
unsigned char hexBackground, hexForeground;
|
||||
@ -37,40 +37,40 @@ unsigned char hexBackground, hexForeground;
|
||||
static BOOLEAN extraByteAdvance;
|
||||
|
||||
/* Used in Hextile encoding */
|
||||
#define Raw 0x01
|
||||
#define BackgroundSpecified 0x02
|
||||
#define ForegroundSpecified 0x04
|
||||
#define AnySubrects 0x08
|
||||
#define SubrectsColoured 0x10
|
||||
|
||||
#define hexWaitingForSubencoding 1
|
||||
#define hexWaitingForMoreInfo 2
|
||||
#define hexWaitingForSubrect 4
|
||||
#define hexWaitingForRawData 8
|
||||
#define Raw 0x01
|
||||
#define BackgroundSpecified 0x02
|
||||
#define ForegroundSpecified 0x04
|
||||
#define AnySubrects 0x08
|
||||
#define SubrectsColoured 0x10
|
||||
|
||||
#define hexWaitingForSubencoding 1
|
||||
#define hexWaitingForMoreInfo 2
|
||||
#define hexWaitingForSubrect 4
|
||||
#define hexWaitingForRawData 8
|
||||
|
||||
void HexNextTile (void) {
|
||||
hexXTileNum++;
|
||||
if (hexXTileNum == hexXTiles) {
|
||||
hexYTileNum++;
|
||||
if (hexYTileNum == hexYTiles) { /* Done with this Hextile rect */
|
||||
displayInProgress = FALSE;
|
||||
if (hexYTileNum == hexYTiles) { /* Done with this Hextile rect */
|
||||
displayInProgress = FALSE;
|
||||
NextRect();
|
||||
return;
|
||||
}
|
||||
hexXTileNum = 0;
|
||||
hexXTileNum = 0;
|
||||
}
|
||||
|
||||
hexTileWidth = (hexXTileNum == hexXTiles - 1) ?
|
||||
rectWidth - 16 * (hexXTiles - 1) : 16;
|
||||
rectWidth - 16 * (hexXTiles - 1) : 16;
|
||||
hexTileHeight = (hexYTileNum == hexYTiles - 1) ?
|
||||
rectHeight - 16 * (hexYTiles - 1) : 16;
|
||||
rectHeight - 16 * (hexYTiles - 1) : 16;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void HexRawDraw (Point *contentOriginPtr, int rectWidth, int rectHeight) {
|
||||
unsigned int i, j; /* Loop indices */
|
||||
unsigned int i, j; /* Loop indices */
|
||||
unsigned int n = 0;
|
||||
unsigned char *dataPtr;
|
||||
unsigned char *dataPtr;
|
||||
unsigned char pixels[128];
|
||||
|
||||
static Rect srcRect = {0,0,0,0};
|
||||
@ -83,53 +83,53 @@ void HexRawDraw (Point *contentOriginPtr, int rectWidth, int rectHeight) {
|
||||
extraByteAdvance = FALSE;
|
||||
|
||||
for (j = 0; j < rectHeight; j++) {
|
||||
for (i = 0; i < rectWidth; i++) {
|
||||
if (hRez == 640) {
|
||||
switch (i & 0x03) {
|
||||
case 0x00: /* pixels 0, 4, 8, ... */
|
||||
pixels[n] = pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0xC0;
|
||||
break;
|
||||
case 0x01: /* pixels 1, 5, 9, ... */
|
||||
pixels[n] += pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0x30;
|
||||
break;
|
||||
case 0x02: /* pixels 2, 6, 10, ... */
|
||||
pixels[n] += pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0x0C;
|
||||
break;
|
||||
case 0x03: /* pixels 3, 7, 11, ... */
|
||||
pixels[n] += pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0x03;
|
||||
n++;
|
||||
} /* switch */
|
||||
} /* if */
|
||||
else { /* 320 mode */
|
||||
switch(i & 0x01) {
|
||||
case 0x00: /* pixels 0, 2, 4, ... */
|
||||
pixels[n] = pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0xF0;
|
||||
break;
|
||||
case 0x01: /* pixels 1, 3, 5, ... */
|
||||
pixels[n] += pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0x0F;
|
||||
n++;
|
||||
} /* switch */
|
||||
} /* else */
|
||||
} /* i loop */
|
||||
for (i = 0; i < rectWidth; i++) {
|
||||
if (hRez == 640) {
|
||||
switch (i & 0x03) {
|
||||
case 0x00: /* pixels 0, 4, 8, ... */
|
||||
pixels[n] = pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0xC0;
|
||||
break;
|
||||
case 0x01: /* pixels 1, 5, 9, ... */
|
||||
pixels[n] += pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0x30;
|
||||
break;
|
||||
case 0x02: /* pixels 2, 6, 10, ... */
|
||||
pixels[n] += pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0x0C;
|
||||
break;
|
||||
case 0x03: /* pixels 3, 7, 11, ... */
|
||||
pixels[n] += pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0x03;
|
||||
n++;
|
||||
} /* switch */
|
||||
} /* if */
|
||||
else { /* 320 mode */
|
||||
switch(i & 0x01) {
|
||||
case 0x00: /* pixels 0, 2, 4, ... */
|
||||
pixels[n] = pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0xF0;
|
||||
break;
|
||||
case 0x01: /* pixels 1, 3, 5, ... */
|
||||
pixels[n] += pixTransTbl[ *(dataPtr +
|
||||
(unsigned long) j*rectWidth + i)
|
||||
] & 0x0F;
|
||||
n++;
|
||||
} /* switch */
|
||||
} /* else */
|
||||
} /* i loop */
|
||||
|
||||
/* When not ending a line on a byte boundary, the index isn't updated,
|
||||
* so we do it here.
|
||||
*/
|
||||
if (extraByteAdvance)
|
||||
n++;
|
||||
} /* j loop */
|
||||
/* When not ending a line on a byte boundary, the index isn't updated,
|
||||
* so we do it here.
|
||||
*/
|
||||
if (extraByteAdvance)
|
||||
n++;
|
||||
} /* j loop */
|
||||
|
||||
srcLocInfo.ptrToPixImage = (void *) pixels;
|
||||
srcLocInfo.boundsRect.v2 = rectHeight;
|
||||
@ -137,65 +137,65 @@ void HexRawDraw (Point *contentOriginPtr, int rectWidth, int rectHeight) {
|
||||
* padding must be accounted for here.
|
||||
*/
|
||||
if (hRez == 640) {
|
||||
switch (rectWidth & 0x03) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth;
|
||||
srcLocInfo.width = rectWidth/4; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+3;
|
||||
srcLocInfo.width = rectWidth/4 + 1; break;
|
||||
case 0x02: srcLocInfo.boundsRect.h2 = rectWidth+2;
|
||||
srcLocInfo.width = rectWidth/4 + 1; break;
|
||||
case 0x03: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
srcLocInfo.width = rectWidth/4 + 1;
|
||||
}
|
||||
switch (rectWidth & 0x03) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth;
|
||||
srcLocInfo.width = rectWidth/4; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+3;
|
||||
srcLocInfo.width = rectWidth/4 + 1; break;
|
||||
case 0x02: srcLocInfo.boundsRect.h2 = rectWidth+2;
|
||||
srcLocInfo.width = rectWidth/4 + 1; break;
|
||||
case 0x03: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
srcLocInfo.width = rectWidth/4 + 1;
|
||||
}
|
||||
}
|
||||
else { /* hRez == 320 */
|
||||
switch (rectWidth & 0x01) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth;
|
||||
srcLocInfo.width = rectWidth/2; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
srcLocInfo.width = rectWidth/2 + 1;
|
||||
}
|
||||
}
|
||||
switch (rectWidth & 0x01) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth;
|
||||
srcLocInfo.width = rectWidth/2; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
srcLocInfo.width = rectWidth/2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
srcRect.v2 = hexTileHeight;
|
||||
srcRect.h2 = hexTileWidth;
|
||||
|
||||
PPToPort(&srcLocInfo, &srcRect,
|
||||
rectX + hexXTileNum * 16 - contentOriginPtr->h,
|
||||
PPToPort(&srcLocInfo, &srcRect,
|
||||
rectX + hexXTileNum * 16 - contentOriginPtr->h,
|
||||
rectY + hexYTileNum * 16 - contentOriginPtr->v, modeCopy);
|
||||
}
|
||||
|
||||
/* The macros below are used in HexDispatch() */
|
||||
#define HexDispatch_NextTile() do { \
|
||||
#define HexDispatch_NextTile() do { \
|
||||
HexNextTile(); \
|
||||
HUnlock(readBufferHndl); \
|
||||
HUnlock(readBufferHndl); \
|
||||
/* Set up for next time */ \
|
||||
status = hexWaitingForSubencoding; \
|
||||
bytesNeeded = 1; \
|
||||
return; \
|
||||
return; \
|
||||
} while (0)
|
||||
|
||||
#define HexDispatch_DrawRect(color, X, Y, width, height) do { \
|
||||
SetSolidPenPat((color)); \
|
||||
#define HexDispatch_DrawRect(color, X, Y, width, height) do { \
|
||||
SetSolidPenPat((color)); \
|
||||
drawingRect.h1 = rectX + hexXTileNum * 16 + (X) - contentOriginPtr->h; \
|
||||
drawingRect.v1 = rectY + hexYTileNum * 16 + (Y) - contentOriginPtr->v; \
|
||||
drawingRect.h2 = rectX + hexXTileNum * 16 + (X) + (width) - contentOriginPtr->h; \
|
||||
drawingRect.v2 = rectY + hexYTileNum * 16 + (Y) + (height) - contentOriginPtr->v; \
|
||||
PaintRect(&drawingRect); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define HexDispatch_DrawBackground() \
|
||||
HexDispatch_DrawRect(hexBackground, 0, 0, hexTileWidth, hexTileHeight)
|
||||
HexDispatch_DrawRect(hexBackground, 0, 0, hexTileWidth, hexTileHeight)
|
||||
|
||||
void HexDispatch (void) {
|
||||
static unsigned char status = hexWaitingForSubencoding;
|
||||
static unsigned char status = hexWaitingForSubencoding;
|
||||
static unsigned long bytesNeeded = 1;
|
||||
static unsigned char subencoding;
|
||||
static unsigned int numSubrects;
|
||||
int i;
|
||||
/* For use with GetContentOrigin() */
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
int tileBytes;
|
||||
unsigned int srX, srY, srWidth, srHeight;
|
||||
Rect drawingRect;
|
||||
@ -209,93 +209,93 @@ void HexDispatch (void) {
|
||||
while (DoReadTCP(bytesNeeded)) {
|
||||
HLock(readBufferHndl);
|
||||
dataPtr = *(unsigned char **) readBufferHndl;
|
||||
/* If we're here, readBufferHndl contains bytesNeeded bytes of data. */
|
||||
switch (status) {
|
||||
case hexWaitingForSubencoding:
|
||||
/* If we're here, readBufferHndl contains bytesNeeded bytes of data. */
|
||||
switch (status) {
|
||||
case hexWaitingForSubencoding:
|
||||
subencoding = *dataPtr;
|
||||
if (subencoding & Raw) {
|
||||
bytesNeeded = hexTileWidth * hexTileHeight;
|
||||
if (subencoding & Raw) {
|
||||
bytesNeeded = hexTileWidth * hexTileHeight;
|
||||
status = hexWaitingForRawData;
|
||||
}
|
||||
else {
|
||||
bytesNeeded = 0;
|
||||
if (subencoding & BackgroundSpecified)
|
||||
bytesNeeded++;
|
||||
if (subencoding & ForegroundSpecified)
|
||||
bytesNeeded++;
|
||||
if (subencoding & AnySubrects)
|
||||
bytesNeeded++;
|
||||
else if (bytesNeeded == 0) {
|
||||
/* No more data - just draw background */
|
||||
}
|
||||
else {
|
||||
bytesNeeded = 0;
|
||||
if (subencoding & BackgroundSpecified)
|
||||
bytesNeeded++;
|
||||
if (subencoding & ForegroundSpecified)
|
||||
bytesNeeded++;
|
||||
if (subencoding & AnySubrects)
|
||||
bytesNeeded++;
|
||||
else if (bytesNeeded == 0) {
|
||||
/* No more data - just draw background */
|
||||
HexDispatch_DrawBackground();
|
||||
HexDispatch_NextTile();
|
||||
HexDispatch_NextTile();
|
||||
}
|
||||
status = hexWaitingForMoreInfo;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case hexWaitingForRawData:
|
||||
HexRawDraw(contentOriginPtr, hexTileWidth, hexTileHeight);
|
||||
case hexWaitingForRawData:
|
||||
HexRawDraw(contentOriginPtr, hexTileWidth, hexTileHeight);
|
||||
HexDispatch_NextTile();
|
||||
break;
|
||||
break;
|
||||
|
||||
case hexWaitingForMoreInfo:
|
||||
if (subencoding & BackgroundSpecified) {
|
||||
hexBackground = pixTransTbl[*(dataPtr++)];
|
||||
}
|
||||
if (subencoding & ForegroundSpecified) {
|
||||
if (subencoding & BackgroundSpecified) {
|
||||
hexBackground = pixTransTbl[*(dataPtr++)];
|
||||
}
|
||||
if (subencoding & ForegroundSpecified) {
|
||||
hexForeground = pixTransTbl[*(dataPtr++)];
|
||||
}
|
||||
if (subencoding & AnySubrects) {
|
||||
numSubrects = *dataPtr;
|
||||
if (numSubrects) {
|
||||
status = hexWaitingForSubrect;
|
||||
bytesNeeded = numSubrects * ((subencoding & SubrectsColoured) ? 3 : 2);
|
||||
break;
|
||||
}
|
||||
if (subencoding & AnySubrects) {
|
||||
numSubrects = *dataPtr;
|
||||
if (numSubrects) {
|
||||
status = hexWaitingForSubrect;
|
||||
bytesNeeded = numSubrects * ((subencoding & SubrectsColoured) ? 3 : 2);
|
||||
break;
|
||||
}
|
||||
else
|
||||
HexDispatch_NextTile();
|
||||
}
|
||||
else { /* no subrects */
|
||||
HexDispatch_DrawBackground();
|
||||
else
|
||||
HexDispatch_NextTile();
|
||||
}
|
||||
else { /* no subrects */
|
||||
HexDispatch_DrawBackground();
|
||||
HexDispatch_NextTile();
|
||||
}
|
||||
}
|
||||
|
||||
case hexWaitingForSubrect: {
|
||||
HexDispatch_DrawBackground();
|
||||
case hexWaitingForSubrect: {
|
||||
HexDispatch_DrawBackground();
|
||||
while (numSubrects-- > 0) {
|
||||
if (subencoding & SubrectsColoured) {
|
||||
hexForeground = pixTransTbl[*(dataPtr++)];
|
||||
}
|
||||
srX = *dataPtr >> 4;
|
||||
srY = *(dataPtr++) & 0x0F;
|
||||
srWidth = (*dataPtr >> 4) + 1;
|
||||
srHeight = (*(dataPtr++) & 0x0F) + 1;
|
||||
HexDispatch_DrawRect(hexForeground, srX, srY, srWidth, srHeight);
|
||||
}
|
||||
HexDispatch_NextTile();
|
||||
}
|
||||
}
|
||||
HUnlock(readBufferHndl);
|
||||
if (subencoding & SubrectsColoured) {
|
||||
hexForeground = pixTransTbl[*(dataPtr++)];
|
||||
}
|
||||
srX = *dataPtr >> 4;
|
||||
srY = *(dataPtr++) & 0x0F;
|
||||
srWidth = (*dataPtr >> 4) + 1;
|
||||
srHeight = (*(dataPtr++) & 0x0F) + 1;
|
||||
HexDispatch_DrawRect(hexForeground, srX, srY, srWidth, srHeight);
|
||||
}
|
||||
HexDispatch_NextTile();
|
||||
}
|
||||
}
|
||||
HUnlock(readBufferHndl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Called when we initially get a Hextile rect; set up to process it */
|
||||
void DoHextileRect (void) {
|
||||
hexXTiles = (rectWidth + 15) / 16;
|
||||
hexXTiles = (rectWidth + 15) / 16;
|
||||
hexYTiles = (rectHeight + 15) / 16;
|
||||
|
||||
hexXTileNum = 0;
|
||||
hexYTileNum = 0;
|
||||
|
||||
displayInProgress = TRUE;
|
||||
|
||||
|
||||
hexTileWidth = (hexYTileNum == hexXTiles - 1) ?
|
||||
rectWidth - 16 * (hexXTiles - 1) : 16;
|
||||
rectWidth - 16 * (hexXTiles - 1) : 16;
|
||||
hexTileHeight = (hexYTileNum == hexYTiles - 1) ?
|
||||
rectHeight - 16 * (hexYTiles - 1) : 16;
|
||||
rectHeight - 16 * (hexYTiles - 1) : 16;
|
||||
|
||||
/* Set up for Hextile drawing */
|
||||
srcRect.v1 = 0;
|
||||
srcRect.h1 = 0;
|
||||
}
|
||||
}
|
||||
|
78
keyboard.cc
78
keyboard.cc
@ -33,36 +33,36 @@
|
||||
*/
|
||||
void SendKeyEvent (BOOLEAN keyDownFlag, unsigned long key)
|
||||
{
|
||||
struct KeyEvent {
|
||||
unsigned char messageType;
|
||||
struct KeyEvent {
|
||||
unsigned char messageType;
|
||||
unsigned char keyDownFlag;
|
||||
unsigned int padding;
|
||||
unsigned long key;
|
||||
} keyEvent = { 4 /* Message Type 4 */,
|
||||
0,
|
||||
} keyEvent = { 4 /* Message Type 4 */,
|
||||
0,
|
||||
0 /* Zero the padding */
|
||||
};
|
||||
};
|
||||
|
||||
keyEvent.keyDownFlag = !!keyDownFlag;
|
||||
keyEvent.key = SwapBytes4(key);
|
||||
TCPIPWriteTCP(hostIpid, &keyEvent.messageType, sizeof(keyEvent),
|
||||
TRUE, FALSE);
|
||||
/* No error checking here -- Can't respond to one usefully. */
|
||||
TRUE, FALSE);
|
||||
/* No error checking here -- Can't respond to one usefully. */
|
||||
}
|
||||
|
||||
|
||||
/* Process a key down event and send it on to the server. */
|
||||
void ProcessKeyEvent (void)
|
||||
{
|
||||
unsigned long key = myEvent.message & 0x0000007F;
|
||||
unsigned long key = myEvent.message & 0x0000007F;
|
||||
|
||||
if (viewOnlyMode)
|
||||
return;
|
||||
return;
|
||||
|
||||
/* Deal with extended keys that are mapped as keypad keys */
|
||||
if (myEvent.modifiers & keyPad) {
|
||||
switch (key) {
|
||||
case 0x7A: key = 0xFFBE; break; /* F1 */
|
||||
switch (key) {
|
||||
case 0x7A: key = 0xFFBE; break; /* F1 */
|
||||
case 0x78: key = 0xFFBF; break; /* F2 */
|
||||
case 0x63: key = 0xFFC0; break; /* F3 */
|
||||
case 0x76: key = 0xFFC1; break; /* F4 */
|
||||
@ -74,7 +74,7 @@ void ProcessKeyEvent (void)
|
||||
case 0x6D: key = 0xFFC7; break; /* F10 */
|
||||
case 0x67: key = 0xFFC8; break; /* F11 */
|
||||
case 0x6F: key = 0xFFC9; break; /* F12 */
|
||||
case 0x69: key = 0xFF15; break; /* F13 / PrintScr -> SysRq */
|
||||
case 0x69: key = 0xFF15; break; /* F13 / PrintScr -> SysRq */
|
||||
case 0x6B: key = 0xFF14; break; /* F14 / ScrLock -> ScrLock */
|
||||
case 0x71: key = 0xFF13; break; /* F15 / Pause -> Pause */
|
||||
case 0x72: key = 0xFF63; break; /* Help / Insert -> Insert */
|
||||
@ -83,32 +83,32 @@ void ProcessKeyEvent (void)
|
||||
case 0x77: key = 0xFF57; break; /* End */
|
||||
case 0x74: key = 0xFF55; break; /* Page Up */
|
||||
case 0x79: key = 0xFF56; break; /* Page Down */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (key == 0x7f)
|
||||
key = 0xFF08; /* Delete -> BackSpace */
|
||||
key = 0xFF08; /* Delete -> BackSpace */
|
||||
|
||||
if (key < 0x20) {
|
||||
if (myEvent.modifiers & controlKey) {
|
||||
if (((myEvent.modifiers & shiftKey) ||
|
||||
(myEvent.modifiers & capsLock))
|
||||
&& !((myEvent.modifiers & shiftKey) &&
|
||||
(myEvent.modifiers & capsLock)))
|
||||
key += 0x40; /* Undo effect of control on upper-case char. */
|
||||
else
|
||||
key += 0x60; /* Undo effect of control */
|
||||
}
|
||||
if (myEvent.modifiers & controlKey) {
|
||||
if (((myEvent.modifiers & shiftKey) ||
|
||||
(myEvent.modifiers & capsLock))
|
||||
&& !((myEvent.modifiers & shiftKey) &&
|
||||
(myEvent.modifiers & capsLock)))
|
||||
key += 0x40; /* Undo effect of control on upper-case char. */
|
||||
else
|
||||
key += 0x60; /* Undo effect of control */
|
||||
}
|
||||
else switch (key) {
|
||||
case 0x1B: key = 0xFF1B; break; /* Escape */
|
||||
case 0x09: key = 0xFF09; break; /* Tab */
|
||||
case 0x0D: key = 0xFF0D; break; /* Return / Enter */
|
||||
case 0x08: key = 0xFF51; break; /* Left arrow */
|
||||
case 0x0B: key = 0xFF52; break; /* Up arrow */
|
||||
case 0x15: key = 0xFF53; break; /* Right arrow */
|
||||
case 0x0A: key = 0xFF54; break; /* Down arrow */
|
||||
case 0x18: key = 0xFF0B; break; /* Clear / NumLock -> Clear */
|
||||
}
|
||||
case 0x1B: key = 0xFF1B; break; /* Escape */
|
||||
case 0x09: key = 0xFF09; break; /* Tab */
|
||||
case 0x0D: key = 0xFF0D; break; /* Return / Enter */
|
||||
case 0x08: key = 0xFF51; break; /* Left arrow */
|
||||
case 0x0B: key = 0xFF52; break; /* Up arrow */
|
||||
case 0x15: key = 0xFF53; break; /* Right arrow */
|
||||
case 0x0A: key = 0xFF54; break; /* Down arrow */
|
||||
case 0x18: key = 0xFF0B; break; /* Clear / NumLock -> Clear */
|
||||
}
|
||||
}
|
||||
|
||||
/* Test if we seem to have a valid character and return if we don't.
|
||||
@ -117,7 +117,7 @@ void ProcessKeyEvent (void)
|
||||
if we ever start generating valid keycodes outside of these ranges.
|
||||
*/
|
||||
if ((key & 0xFF80) != 0xFF00 && (key & 0xFF80) != 0x0000)
|
||||
return;
|
||||
return;
|
||||
|
||||
SendKeyEvent(TRUE, key);
|
||||
SendKeyEvent(FALSE, key);
|
||||
@ -125,28 +125,28 @@ void ProcessKeyEvent (void)
|
||||
|
||||
/* Send modifier keys that have changed since last update */
|
||||
void SendModifiers (void) {
|
||||
static unsigned int oldModifiers = 0x00FF; /* So it runs 1st time */
|
||||
static unsigned int oldModifiers = 0x00FF; /* So it runs 1st time */
|
||||
unsigned int modifiers;
|
||||
|
||||
modifiers = myEvent.modifiers & 0x1B00;
|
||||
|
||||
/* If unchanged, do nothing. */
|
||||
if (modifiers == oldModifiers)
|
||||
return;
|
||||
return;
|
||||
|
||||
/* Apple key is sent as "meta" */
|
||||
if ((modifiers & appleKey) != (oldModifiers & appleKey))
|
||||
SendKeyEvent(modifiers & appleKey, 0xFFE7);
|
||||
SendKeyEvent(modifiers & appleKey, 0xFFE7);
|
||||
|
||||
if ((modifiers & shiftKey) != (oldModifiers & shiftKey))
|
||||
SendKeyEvent(modifiers & shiftKey, 0xFFE1);
|
||||
SendKeyEvent(modifiers & shiftKey, 0xFFE1);
|
||||
|
||||
/* Option key is sent as "alt," as per its labelling on some keyboards */
|
||||
if ((modifiers & optionKey) != (oldModifiers & optionKey))
|
||||
SendKeyEvent(modifiers & optionKey, 0xFFE9);
|
||||
SendKeyEvent(modifiers & optionKey, 0xFFE9);
|
||||
|
||||
if ((modifiers & controlKey) != (oldModifiers & controlKey))
|
||||
SendKeyEvent(modifiers & controlKey, 0xFFE3);
|
||||
SendKeyEvent(modifiers & controlKey, 0xFFE3);
|
||||
|
||||
oldModifiers = modifiers;
|
||||
}
|
||||
|
24
make
24
make
@ -7,21 +7,21 @@ clearmem
|
||||
|
||||
for {header} in vncview vncsession vncdisplay colortables menus \
|
||||
desktopsize mouse keyboard copyrect raw hextile clipboard
|
||||
unset exit
|
||||
unset exit
|
||||
newer VNCview.GS {header}.h
|
||||
if {status} != 0
|
||||
set exit on
|
||||
delete -P -W =.a
|
||||
end
|
||||
if {status} != 0
|
||||
set exit on
|
||||
delete -P -W =.a
|
||||
end
|
||||
end
|
||||
|
||||
for file in vncview vncsession vncdisplay colortables \
|
||||
desktopsize mouse keyboard copyrect raw hextile clipboard
|
||||
unset exit
|
||||
unset exit
|
||||
newer {file}.a {file}.cc
|
||||
if {status} != 0
|
||||
set exit on
|
||||
compile +O {file}.cc keep={file}
|
||||
set exit on
|
||||
compile +O {file}.cc keep={file}
|
||||
set link true
|
||||
end
|
||||
end
|
||||
@ -29,14 +29,14 @@ end
|
||||
unset exit
|
||||
newer vncview.rezfork vncview.rez
|
||||
if {status} != 0
|
||||
set exit on
|
||||
compile vncview.rez keep=vncview.rezfork
|
||||
set exit on
|
||||
compile vncview.rez keep=vncview.rezfork
|
||||
copy -C -P -R vncview.rezfork VNCview.GS
|
||||
end
|
||||
|
||||
if {link} == true
|
||||
link vncview vncsession vncdisplay colortables \
|
||||
link vncview vncsession vncdisplay colortables \
|
||||
desktopsize mouse keyboard copyrect raw hextile clipboard \
|
||||
keep=VNCview.GS
|
||||
filetype VNCview.GS S16 $DB03
|
||||
filetype VNCview.GS S16 $DB03
|
||||
end
|
||||
|
28
menus.h
28
menus.h
@ -1,19 +1,19 @@
|
||||
#define appleMenu 1
|
||||
#define fileMenu 2
|
||||
#define editMenu 3
|
||||
#define appleMenu 1
|
||||
#define fileMenu 2
|
||||
#define editMenu 3
|
||||
|
||||
#define appleAbout 257
|
||||
#define appleAbout 257
|
||||
|
||||
#define fileNewConnection 260
|
||||
#define fileClose 255
|
||||
#define fileQuit 256
|
||||
#define fileClose 255
|
||||
#define fileQuit 256
|
||||
|
||||
#define editUndo 250
|
||||
#define editCut 251
|
||||
#define editCopy 252
|
||||
#define editPaste 253
|
||||
#define editClear 254
|
||||
#define editSendClipboard 262
|
||||
#define editShowClipboard 261
|
||||
#define editUndo 250
|
||||
#define editCut 251
|
||||
#define editCopy 252
|
||||
#define editPaste 253
|
||||
#define editClear 254
|
||||
#define editSendClipboard 262
|
||||
#define editShowClipboard 261
|
||||
|
||||
#define noKB 100
|
||||
#define noKB 100
|
||||
|
130
mouse.cc
130
mouse.cc
@ -29,29 +29,29 @@
|
||||
#include "raw.h"
|
||||
#include "hextile.h"
|
||||
|
||||
unsigned char * cursor = NULL; /* Cursor from server */
|
||||
unsigned char * cursor = NULL; /* Cursor from server */
|
||||
|
||||
/* Send a DoPointerEvent reflecting the status of the mouse to the server */
|
||||
/* This routine also maintains the appropriate cursor when using local cursor */
|
||||
void DoPointerEvent (void) {
|
||||
static struct {
|
||||
unsigned char messageType;
|
||||
static struct {
|
||||
unsigned char messageType;
|
||||
unsigned char buttonMask;
|
||||
unsigned int xPos;
|
||||
unsigned int yPos;
|
||||
} pointerEventStruct = { 5 /* message type */ };
|
||||
|
||||
Point mouseCoords;
|
||||
unsigned long contentOrigin;
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
RegionHndl contentRgnHndl;
|
||||
unsigned int oldButtonMask;
|
||||
GrafPortPtr winPtr;
|
||||
unsigned long key1 = 0x0000; /* Keys to release & re-press, if any */
|
||||
unsigned long key1 = 0x0000; /* Keys to release & re-press, if any */
|
||||
unsigned long key2 = 0x0000;
|
||||
|
||||
if (viewOnlyMode)
|
||||
return;
|
||||
return;
|
||||
|
||||
mouseCoords = myEvent.where;
|
||||
|
||||
@ -61,15 +61,15 @@ void DoPointerEvent (void) {
|
||||
* updates if it isn't.
|
||||
*/
|
||||
if (FindWindow(&winPtr, myEvent.where.h, myEvent.where.v) != wInContent ||
|
||||
winPtr != vncWindow) {
|
||||
if (cursor && GetCursorAdr() == cursor)
|
||||
InitCursor();
|
||||
return;
|
||||
winPtr != vncWindow) {
|
||||
if (cursor && GetCursorAdr() == cursor)
|
||||
InitCursor();
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalToLocal(&mouseCoords);
|
||||
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
mouseCoords.h += contentOriginPtr->h;
|
||||
mouseCoords.v += contentOriginPtr->v;
|
||||
|
||||
@ -80,51 +80,51 @@ void DoPointerEvent (void) {
|
||||
oldButtonMask = pointerEventStruct.buttonMask;
|
||||
pointerEventStruct.buttonMask = 0x00;
|
||||
|
||||
if ((myEvent.modifiers & btn0State) == 0x00) { /* Mouse button pressed */
|
||||
if (emulate3ButtonMouse) {
|
||||
if (myEvent.modifiers & optionKey) {
|
||||
pointerEventStruct.buttonMask = 0x02;
|
||||
key1 = 0xFFE9;
|
||||
}
|
||||
if (myEvent.modifiers & appleKey) {
|
||||
pointerEventStruct.buttonMask |= 0x04;
|
||||
key2 = 0xFFE7;
|
||||
}
|
||||
}
|
||||
if ((myEvent.modifiers & btn0State) == 0x00) { /* Mouse button pressed */
|
||||
if (emulate3ButtonMouse) {
|
||||
if (myEvent.modifiers & optionKey) {
|
||||
pointerEventStruct.buttonMask = 0x02;
|
||||
key1 = 0xFFE9;
|
||||
}
|
||||
if (myEvent.modifiers & appleKey) {
|
||||
pointerEventStruct.buttonMask |= 0x04;
|
||||
key2 = 0xFFE7;
|
||||
}
|
||||
}
|
||||
|
||||
/* If no modifiers, just send a normal left click. */
|
||||
if (pointerEventStruct.buttonMask == 0x00)
|
||||
pointerEventStruct.buttonMask = 0x01;
|
||||
/* If no modifiers, just send a normal left click. */
|
||||
if (pointerEventStruct.buttonMask == 0x00)
|
||||
pointerEventStruct.buttonMask = 0x01;
|
||||
}
|
||||
if ((myEvent.modifiers & btn1State) == 0x00) /* If 2nd (right) */
|
||||
pointerEventStruct.buttonMask |= 0x04; /* button is pressed */
|
||||
if ((myEvent.modifiers & btn1State) == 0x00) /* If 2nd (right) */
|
||||
pointerEventStruct.buttonMask |= 0x04; /* button is pressed */
|
||||
|
||||
/* Don't waste bandwidth by sending update if mouse hasn't changed.
|
||||
* This may occasionally result in an initial mouse update not being
|
||||
* sent. If this occurs, the user can simply move the mouse slightly
|
||||
* in order to send it.
|
||||
*/
|
||||
if ( (pointerEventStruct.xPos == mouseCoords.h) &&
|
||||
(pointerEventStruct.yPos == mouseCoords.v) &&
|
||||
if ( (pointerEventStruct.xPos == mouseCoords.h) &&
|
||||
(pointerEventStruct.yPos == mouseCoords.v) &&
|
||||
(pointerEventStruct.buttonMask == oldButtonMask) )
|
||||
return;
|
||||
return;
|
||||
|
||||
pointerEventStruct.xPos = mouseCoords.h;
|
||||
pointerEventStruct.xPos = mouseCoords.h;
|
||||
pointerEventStruct.yPos = mouseCoords.v;
|
||||
|
||||
if (key1)
|
||||
SendKeyEvent(FALSE, key1);
|
||||
SendKeyEvent(FALSE, key1);
|
||||
if (key2)
|
||||
SendKeyEvent(FALSE, key2);
|
||||
SendKeyEvent(FALSE, key2);
|
||||
|
||||
TCPIPWriteTCP(hostIpid, (Pointer) &pointerEventStruct.messageType,
|
||||
sizeof(pointerEventStruct), TRUE, FALSE);
|
||||
sizeof(pointerEventStruct), TRUE, FALSE);
|
||||
/* Can't do useful error checking here */
|
||||
|
||||
if (key1)
|
||||
SendKeyEvent(TRUE, key1);
|
||||
SendKeyEvent(TRUE, key1);
|
||||
if (key2)
|
||||
SendKeyEvent(TRUE, key2);
|
||||
SendKeyEvent(TRUE, key2);
|
||||
|
||||
//printf("Sent mouse update: x = %u, y = %u\n", mouseCoords.h, mouseCoords.v);
|
||||
//printf(" xPos = %x, yPos = %x, buttons = %x\n", pointerEventStruct.xPos, pointerEventStruct.yPos, (int) pointerEventStruct.buttonMask);
|
||||
@ -134,7 +134,7 @@ void DoPointerEvent (void) {
|
||||
*/
|
||||
|
||||
if (cursor && GetCursorAdr() != cursor)
|
||||
SetCursor(cursor);
|
||||
SetCursor(cursor);
|
||||
}
|
||||
|
||||
void DoCursor (void) {
|
||||
@ -147,16 +147,16 @@ void DoCursor (void) {
|
||||
unsigned int *hotSpotYPtr, *hotSpotXPtr;
|
||||
unsigned long bitmaskByte;
|
||||
unsigned long bitmaskLineBytes, lineWords;
|
||||
unsigned int line, n, j; /* Loop counters */
|
||||
unsigned int line, n, j; /* Loop counters */
|
||||
unsigned char *maskLine, *imageLine;
|
||||
unsigned char *oldCursor = cursor; /* So we can free() it later */
|
||||
unsigned char *oldCursor = cursor; /* So we can free() it later */
|
||||
unsigned int outBytes640;
|
||||
unsigned long outBytes320;
|
||||
|
||||
bitmaskLineBytes = (rectWidth + 7) / 8;
|
||||
|
||||
if (!DoReadTCP(rectWidth*rectHeight + bitmaskLineBytes*rectHeight))
|
||||
return; /* Try again later */
|
||||
return; /* Try again later */
|
||||
|
||||
HLock(readBufferHndl);
|
||||
|
||||
@ -164,17 +164,17 @@ void DoCursor (void) {
|
||||
bitmask = (unsigned char *)(*readBufferHndl) + rectWidth*rectHeight;
|
||||
|
||||
if (hRez == 640)
|
||||
lineWords = (rectWidth + 7) / 8 + 1;
|
||||
lineWords = (rectWidth + 7) / 8 + 1;
|
||||
else /* hRez == 320 */
|
||||
lineWords = (rectWidth + 3) / 4 + 1;
|
||||
|
||||
cursor = malloc(8 + 4 * lineWords * rectHeight);
|
||||
/* Sub-optimal error handling */
|
||||
if (cursor == NULL)
|
||||
return;
|
||||
return;
|
||||
/* Don't overflow loop indices */
|
||||
if ((lineWords > UINT_MAX) || (rectHeight > UINT_MAX))
|
||||
return;
|
||||
if ((lineWords > UINT_MAX) || (rectHeight > UINT_MAX))
|
||||
return;
|
||||
cursorHeightPtr = (unsigned int *)(void *)cursor;
|
||||
cursorWidthPtr = cursorHeightPtr + 1;
|
||||
cursorImage = cursor + 4;
|
||||
@ -193,16 +193,16 @@ void DoCursor (void) {
|
||||
dataPtr = cursorPixels;
|
||||
|
||||
if (hRez == 320) {
|
||||
for (line = 0; line < rectHeight; line++) { /* for each line ... */
|
||||
for (line = 0; line < rectHeight; line++) { /* for each line ... */
|
||||
maskLine = cursorMask + line * lineWords * 2;
|
||||
imageLine = cursorImage + line * lineWords * 2;
|
||||
|
||||
for (j = 0; j < bitmaskLineBytes; j++) {
|
||||
for (j = 0; j < bitmaskLineBytes; j++) {
|
||||
bitmaskByte = *(bitmask + line*bitmaskLineBytes + j);
|
||||
outBytes320 =
|
||||
((bitmaskByte & 0x80) ) + ((bitmaskByte & 0x80) >> 1) +
|
||||
((bitmaskByte & 0x80) ) + ((bitmaskByte & 0x80) >> 1) +
|
||||
((bitmaskByte & 0x80) >> 2) + ((bitmaskByte & 0x80) >> 3) +
|
||||
((bitmaskByte & 0x40) >> 3) + ((bitmaskByte & 0x40) >> 4) +
|
||||
((bitmaskByte & 0x40) >> 3) + ((bitmaskByte & 0x40) >> 4) +
|
||||
((bitmaskByte & 0x40) >> 5) + ((bitmaskByte & 0x40) >> 6) +
|
||||
((bitmaskByte & 0x20) << 10) + ((bitmaskByte & 0x20) << 9) +
|
||||
((bitmaskByte & 0x20) << 8) + ((bitmaskByte & 0x20) << 7) +
|
||||
@ -223,12 +223,12 @@ void DoCursor (void) {
|
||||
for (n = 0; n < rectWidth/2; n++) {
|
||||
*(imageLine + n) = coltab320[*(dataPtr++)] & 0xF0;
|
||||
*(imageLine + n) += coltab320[*(dataPtr++)] & 0x0F;
|
||||
*(imageLine + n) ^= 0xFF; /* Reverse color */
|
||||
*(imageLine + n) ^= 0xFF; /* Reverse color */
|
||||
*(imageLine + n) &= *(maskLine + n);
|
||||
}
|
||||
if (rectWidth % 2) {
|
||||
*(imageLine + n) = coltab320[*(dataPtr++)] & 0xF0;
|
||||
*(imageLine + n) ^= 0xFF; /* Reverse color */
|
||||
*(imageLine + n) = coltab320[*(dataPtr++)] & 0xF0;
|
||||
*(imageLine + n) ^= 0xFF; /* Reverse color */
|
||||
*(imageLine + n) &= *(maskLine + n);
|
||||
n++;
|
||||
}
|
||||
@ -237,16 +237,16 @@ void DoCursor (void) {
|
||||
}
|
||||
}
|
||||
else { /* hRez == 640 */
|
||||
for (line = 0; line < rectHeight; line++) { /* for each line ... */
|
||||
for (line = 0; line < rectHeight; line++) { /* for each line ... */
|
||||
maskLine = cursorMask + line * lineWords * 2;
|
||||
imageLine = cursorImage + line * lineWords * 2;
|
||||
|
||||
for (j = 0; j < bitmaskLineBytes; j++) {
|
||||
bitmaskByte = *(bitmask + line*bitmaskLineBytes + j);
|
||||
outBytes640 =
|
||||
((bitmaskByte & 0x80) ) + ((bitmaskByte & 0xC0) >> 1) +
|
||||
((bitmaskByte & 0x60) >> 2) + ((bitmaskByte & 0x30) >> 3) +
|
||||
((bitmaskByte & 0x10) >> 4) + ((bitmaskByte & 0x08) << 12) +
|
||||
((bitmaskByte & 0x80) ) + ((bitmaskByte & 0xC0) >> 1) +
|
||||
((bitmaskByte & 0x60) >> 2) + ((bitmaskByte & 0x30) >> 3) +
|
||||
((bitmaskByte & 0x10) >> 4) + ((bitmaskByte & 0x08) << 12) +
|
||||
((bitmaskByte & 0x0C) << 11) + ((bitmaskByte & 0x06) << 10) +
|
||||
((bitmaskByte & 0x03) << 9) + ((bitmaskByte & 0x01) << 8);
|
||||
*((unsigned int *)maskLine + j) = outBytes640;
|
||||
@ -258,7 +258,7 @@ void DoCursor (void) {
|
||||
*(imageLine + n) += coltab640[*(dataPtr++)] & 0x30;
|
||||
*(imageLine + n) += coltab640[*(dataPtr++)] & 0x0C;
|
||||
*(imageLine + n) += coltab640[*(dataPtr++)] & 0x03;
|
||||
*(imageLine + n) ^= 0xFF; /* Reverse color */
|
||||
*(imageLine + n) ^= 0xFF; /* Reverse color */
|
||||
*(imageLine + n) &= *(maskLine + n);
|
||||
}
|
||||
*(imageLine + n) = 0;
|
||||
@ -275,7 +275,7 @@ void DoCursor (void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
*(imageLine + n) ^= 0xFF; /* Reverse color */
|
||||
*(imageLine + n) ^= 0xFF; /* Reverse color */
|
||||
*(imageLine + n) &= *(maskLine + n);
|
||||
*(unsigned int *)(imageLine + n + 1) = 0;
|
||||
}
|
||||
@ -283,10 +283,10 @@ void DoCursor (void) {
|
||||
|
||||
HUnlock(readBufferHndl);
|
||||
|
||||
if (GetCursorAdr() == oldCursor)
|
||||
SetCursor(cursor);
|
||||
if (GetCursorAdr() == oldCursor)
|
||||
SetCursor(cursor);
|
||||
if (oldCursor)
|
||||
free(oldCursor);
|
||||
free(oldCursor);
|
||||
|
||||
#if 0
|
||||
/***************/
|
||||
@ -297,18 +297,18 @@ void DoCursor (void) {
|
||||
rectWidth, rectHeight, rectX, rectY);
|
||||
fprintf(foo, "\n");
|
||||
for (k = cursor; k < cursorImage; k++)
|
||||
fprintf(foo, "%02X ", *k);
|
||||
fprintf(foo, "%02X ", *k);
|
||||
for (j = 0; j < lineWords * rectHeight * 4; j++) {
|
||||
fprintf(foo, "%02X", *(cursorImage + j));
|
||||
fprintf(foo, "%02X", *(cursorImage + j));
|
||||
if ((j+1) % (lineWords * 2) == 0)
|
||||
fprintf(foo, "\n");
|
||||
fprintf(foo, "\n");
|
||||
}
|
||||
for (k = cursorImage + j; k < cursorImage + j + 4; k = k + 1)
|
||||
fprintf(foo, "%02X ", *k);
|
||||
fprintf(foo, "%02X ", *k);
|
||||
//for (j = 0; j < bitmaskLineBytes*rectHeight; j++) {
|
||||
// fprintf(foo, "%02X", *(bitmask + j));
|
||||
// if ((j+1) % bitmaskLineBytes == 0)
|
||||
// fprintf(foo, "\n");
|
||||
// fprintf(foo, "\n");
|
||||
// }
|
||||
fprintf(foo, "\n");
|
||||
fclose(foo);
|
||||
|
2
mouse.h
2
mouse.h
@ -1,3 +1,3 @@
|
||||
extern unsigned char * cursor; /* Cursor from server */
|
||||
extern unsigned char * cursor; /* Cursor from server */
|
||||
extern void DoPointerEvent (void);
|
||||
extern void DoCursor (void);
|
||||
|
372
raw.cc
372
raw.cc
@ -30,10 +30,10 @@
|
||||
#include "hextile.h"
|
||||
|
||||
/* Data on state of raw rectangle drawing routines */
|
||||
unsigned int lineBytes; /* Number of bytes in a line of GS pixels */
|
||||
unsigned int lineBytes; /* Number of bytes in a line of GS pixels */
|
||||
unsigned long pixels;
|
||||
|
||||
unsigned int drawingLine; /* Line to be drawn while displaying */
|
||||
unsigned int drawingLine; /* Line to be drawn while displaying */
|
||||
static BOOLEAN extraByteAdvance;
|
||||
|
||||
unsigned char *destPtr;
|
||||
@ -42,120 +42,120 @@ unsigned char *destPtr;
|
||||
* because the rectangle is not visible.
|
||||
*/
|
||||
void StopRawDrawing (void) {
|
||||
HUnlock(readBufferHndl);
|
||||
free(srcLocInfo.ptrToPixImage); /* Allocated as destPtr */
|
||||
HUnlock(readBufferHndl);
|
||||
free(srcLocInfo.ptrToPixImage); /* Allocated as destPtr */
|
||||
|
||||
displayInProgress = FALSE;
|
||||
|
||||
NextRect(); /* Prepare for next rect */
|
||||
NextRect(); /* Prepare for next rect */
|
||||
}
|
||||
|
||||
#pragma optimize 95 /* To work around an ORCA/C optimizer bug */
|
||||
#pragma optimize 95 /* To work around an ORCA/C optimizer bug */
|
||||
|
||||
/* Draw one or more lines from a raw rectangle
|
||||
*/
|
||||
void RawDraw (void) {
|
||||
unsigned int i; /* Loop indices */
|
||||
unsigned char *dataPtr;
|
||||
unsigned int i; /* Loop indices */
|
||||
unsigned char *dataPtr;
|
||||
unsigned char *lineDataPtr, *initialLineDataPtr;
|
||||
unsigned char *finalDestPtr;
|
||||
static EventRecord unusedEventRec;
|
||||
|
||||
/* For use with GetContentOrigin() */
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
|
||||
SetPort(vncWindow); /* Drawing in VNC window */
|
||||
SetPort(vncWindow); /* Drawing in VNC window */
|
||||
dataPtr = (unsigned char *) *readBufferHndl;
|
||||
|
||||
/* Check if what we're drawing is visible, and skip any invisible part
|
||||
* by skipping some lines or completely aborting drawing the rectangle.
|
||||
*/
|
||||
if (checkBounds) {
|
||||
Rect drawingRect;
|
||||
Rect drawingRect;
|
||||
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
drawingRect.h1 = rectX - contentOriginPtr->h;
|
||||
drawingRect.h2 = rectX - contentOriginPtr->h + rectWidth;
|
||||
drawingRect.v1 = rectY - contentOriginPtr->v + drawingLine;
|
||||
drawingRect.v2 = rectY - contentOriginPtr->v + rectHeight;
|
||||
|
||||
if (!RectInRgn(&drawingRect, GetVisHandle())) {
|
||||
StopRawDrawing();
|
||||
StopRawDrawing();
|
||||
return;
|
||||
}
|
||||
else if (rectY + drawingLine < contentOriginPtr->v) {
|
||||
destPtr += (unsigned long)lineBytes *
|
||||
(contentOriginPtr->v - rectY - drawingLine);
|
||||
drawingLine = contentOriginPtr->v - rectY;
|
||||
|
||||
if (drawingLine >= rectHeight) { /* Sanity check */
|
||||
StopRawDrawing();
|
||||
return;
|
||||
}
|
||||
(contentOriginPtr->v - rectY - drawingLine);
|
||||
drawingLine = contentOriginPtr->v - rectY;
|
||||
|
||||
if (drawingLine >= rectHeight) { /* Sanity check */
|
||||
StopRawDrawing();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (rectY + rectHeight - 1 > contentOriginPtr->v + winHeight)
|
||||
rectHeight = contentOriginPtr->v + winHeight - rectY + 1;
|
||||
rectHeight = contentOriginPtr->v + winHeight - rectY + 1;
|
||||
|
||||
checkBounds = FALSE;
|
||||
}
|
||||
|
||||
lineDataPtr = dataPtr + (unsigned long) drawingLine * rectWidth;
|
||||
|
||||
do { /* We short-circuit back to here if there are no events pending */
|
||||
|
||||
do { /* We short-circuit back to here if there are no events pending */
|
||||
|
||||
finalDestPtr = destPtr + lineBytes - 1;
|
||||
finalDestPtr = destPtr + lineBytes - 1;
|
||||
if (hRez == 640) {
|
||||
initialLineDataPtr = lineDataPtr;
|
||||
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
}
|
||||
while (destPtr < finalDestPtr) {
|
||||
initialLineDataPtr = lineDataPtr;
|
||||
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
}
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
}
|
||||
while (destPtr < finalDestPtr) {
|
||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
|
||||
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
|
||||
lineDataPtr += 4;
|
||||
}
|
||||
/* Final byte to produce */
|
||||
*destPtr = pixTransTbl[*(lineDataPtr++)] & 0xC0;
|
||||
for (i = lineDataPtr - initialLineDataPtr; i < rectWidth; i++)
|
||||
switch (i & 0x03) {
|
||||
case 0x01: /* pixels 1, 5, 9, ... */
|
||||
*destPtr += pixTransTbl[*(lineDataPtr++)] & 0x30;
|
||||
break;
|
||||
case 0x02: /* pixels 2, 6, 10, ... */
|
||||
*destPtr += pixTransTbl[*(lineDataPtr++)] & 0x0C;
|
||||
break;
|
||||
case 0x03: /* pixels 3, 7, 11, ... */
|
||||
*destPtr += pixTransTbl[*(lineDataPtr++)] & 0x03;
|
||||
}
|
||||
for (i = lineDataPtr - initialLineDataPtr; i < rectWidth; i++)
|
||||
switch (i & 0x03) {
|
||||
case 0x01: /* pixels 1, 5, 9, ... */
|
||||
*destPtr += pixTransTbl[*(lineDataPtr++)] & 0x30;
|
||||
break;
|
||||
case 0x02: /* pixels 2, 6, 10, ... */
|
||||
*destPtr += pixTransTbl[*(lineDataPtr++)] & 0x0C;
|
||||
break;
|
||||
case 0x03: /* pixels 3, 7, 11, ... */
|
||||
*destPtr += pixTransTbl[*(lineDataPtr++)] & 0x03;
|
||||
}
|
||||
destPtr++;
|
||||
}
|
||||
else { /* 320 mode */
|
||||
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
|
||||
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
|
||||
else { /* 320 mode */
|
||||
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
|
||||
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
|
||||
lineDataPtr += 2;
|
||||
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
|
||||
lineDataPtr += 2;
|
||||
@ -171,39 +171,39 @@ void RawDraw (void) {
|
||||
lineDataPtr += 2;
|
||||
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
|
||||
lineDataPtr += 2;
|
||||
}
|
||||
while (destPtr < finalDestPtr) {
|
||||
}
|
||||
while (destPtr < finalDestPtr) {
|
||||
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
|
||||
lineDataPtr += 2;
|
||||
}
|
||||
/* Final byte to produce */
|
||||
*destPtr = pixTransTbl[*(lineDataPtr++)] & 0xF0;
|
||||
if (extraByteAdvance)
|
||||
destPtr++; /* Not ending on byte boundary - update index */
|
||||
if (extraByteAdvance)
|
||||
destPtr++; /* Not ending on byte boundary - update index */
|
||||
else
|
||||
*(destPtr++) += pixTransTbl[*(lineDataPtr++)] & 0x0F;
|
||||
*(destPtr++) += pixTransTbl[*(lineDataPtr++)] & 0x0F;
|
||||
}
|
||||
|
||||
drawingLine++;
|
||||
|
||||
drawingLine++;
|
||||
|
||||
if (pixels > 613 && !(drawingLine & 0x03)) { /* Draw every 4th line */
|
||||
srcRect.v2 = drawingLine;
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
PPToPort(&srcLocInfo, &srcRect, rectX - contentOriginPtr->h,
|
||||
rectY + srcRect.v1 - contentOriginPtr->v, modeCopy);
|
||||
srcRect.v1 = drawingLine;
|
||||
}
|
||||
srcRect.v2 = drawingLine;
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
PPToPort(&srcLocInfo, &srcRect, rectX - contentOriginPtr->h,
|
||||
rectY + srcRect.v1 - contentOriginPtr->v, modeCopy);
|
||||
srcRect.v1 = drawingLine;
|
||||
}
|
||||
|
||||
/* Check whether we're done with this rectangle */
|
||||
if (drawingLine >= rectHeight) {
|
||||
/* Draw final rect, if necessary */
|
||||
if (drawingLine > srcRect.v1) {
|
||||
srcRect.v2 = drawingLine;
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
PPToPort(&srcLocInfo, &srcRect, rectX - contentOriginPtr->h,
|
||||
rectY + srcRect.v1 - contentOriginPtr->v, modeCopy);
|
||||
}
|
||||
StopRawDrawing();
|
||||
/* Draw final rect, if necessary */
|
||||
if (drawingLine > srcRect.v1) {
|
||||
srcRect.v2 = drawingLine;
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
PPToPort(&srcLocInfo, &srcRect, rectX - contentOriginPtr->h,
|
||||
rectY + srcRect.v1 - contentOriginPtr->v, modeCopy);
|
||||
}
|
||||
StopRawDrawing();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -215,37 +215,37 @@ void RawDraw (void) {
|
||||
if (EventAvail(0xFFFF, &unusedEventRec))
|
||||
return;
|
||||
|
||||
SystemTask(); /* Let periodic Desk Accesories do their things */
|
||||
TCPIPPoll(); /* Let Marinetti keep processing data */
|
||||
SystemTask(); /* Let periodic Desk Accesories do their things */
|
||||
TCPIPPoll(); /* Let Marinetti keep processing data */
|
||||
|
||||
} while (1);
|
||||
} while (1);
|
||||
}
|
||||
|
||||
#pragma optimize -1
|
||||
|
||||
/* Draw one line of Raw data - used if the complete rect isn't yet available */
|
||||
void RawDrawLine (void) {
|
||||
unsigned int i;
|
||||
unsigned char *dataPtr;
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
unsigned int i;
|
||||
unsigned char *dataPtr;
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
|
||||
if (hRez == 640) {
|
||||
if (rectWidth & 0x03) /* Width not an exact multiple of 4 */
|
||||
lineBytes = rectWidth/4 + 1;
|
||||
else /* Width is a multiple of 4 */
|
||||
lineBytes = rectWidth/4;
|
||||
if (rectWidth & 0x03) /* Width not an exact multiple of 4 */
|
||||
lineBytes = rectWidth/4 + 1;
|
||||
else /* Width is a multiple of 4 */
|
||||
lineBytes = rectWidth/4;
|
||||
}
|
||||
else { /* 320 mode */
|
||||
if (rectWidth & 0x01) /* Width not an exact multiple of 2 */
|
||||
lineBytes = rectWidth/2 + 1;
|
||||
else /* Width is a multiple of 2 */
|
||||
lineBytes = rectWidth/2;
|
||||
else { /* 320 mode */
|
||||
if (rectWidth & 0x01) /* Width not an exact multiple of 2 */
|
||||
lineBytes = rectWidth/2 + 1;
|
||||
else /* Width is a multiple of 2 */
|
||||
lineBytes = rectWidth/2;
|
||||
}
|
||||
|
||||
destPtr = calloc(lineBytes, 1);
|
||||
if (!destPtr) { /* Couldn't allocate memory */
|
||||
DoClose(vncWindow);
|
||||
if (!destPtr) { /* Couldn't allocate memory */
|
||||
DoClose(vncWindow);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -256,64 +256,64 @@ void RawDrawLine (void) {
|
||||
* padding must be accounted for here.
|
||||
*/
|
||||
if (hRez == 640) {
|
||||
switch (rectWidth & 0x03) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+3; break;
|
||||
case 0x02: srcLocInfo.boundsRect.h2 = rectWidth+2; break;
|
||||
case 0x03: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
}
|
||||
switch (rectWidth & 0x03) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+3; break;
|
||||
case 0x02: srcLocInfo.boundsRect.h2 = rectWidth+2; break;
|
||||
case 0x03: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (rectWidth & 0x01) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
}
|
||||
}
|
||||
switch (rectWidth & 0x01) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't include padding in the area we will actually copy over */
|
||||
srcRect.h2 = rectWidth;
|
||||
srcRect.v1 = 0;
|
||||
srcRect.v2 = 1;
|
||||
srcRect.v1 = 0;
|
||||
srcRect.v2 = 1;
|
||||
|
||||
HLock(readBufferHndl);
|
||||
dataPtr = (unsigned char *) *readBufferHndl;
|
||||
SetPort(vncWindow); /* Drawing in VNC window */
|
||||
SetPort(vncWindow); /* Drawing in VNC window */
|
||||
|
||||
if (hRez == 640)
|
||||
for (i = 0; i < rectWidth; /* i is incremented in loop */) {
|
||||
switch (i & 0x03) {
|
||||
case 0x00: /* pixels 0, 4, 8, ... */
|
||||
*destPtr = pixTransTbl[dataPtr[i++]] & 0xC0;
|
||||
break;
|
||||
case 0x01: /* pixels 1, 5, 9, ... */
|
||||
*destPtr += pixTransTbl[dataPtr[i++]] & 0x30;
|
||||
break;
|
||||
case 0x02: /* pixels 2, 6, 10, ... */
|
||||
*destPtr += pixTransTbl[dataPtr[i++]] & 0x0C;
|
||||
break;
|
||||
case 0x03: /* pixels 3, 7, 11, ... */
|
||||
*(destPtr++) += pixTransTbl[dataPtr[i++]] & 0x03;
|
||||
}
|
||||
}
|
||||
else /* 320 mode */
|
||||
for (i = 0; i < rectWidth; /* i is incremented in loop */) {
|
||||
if ((i & 0x01) == 0) /* pixels 0, 2, 4, ... */
|
||||
*destPtr = pixTransTbl[dataPtr[i++]] & 0xF0;
|
||||
else { /* pixels 1, 3, 5, ... */
|
||||
if (hRez == 640)
|
||||
for (i = 0; i < rectWidth; /* i is incremented in loop */) {
|
||||
switch (i & 0x03) {
|
||||
case 0x00: /* pixels 0, 4, 8, ... */
|
||||
*destPtr = pixTransTbl[dataPtr[i++]] & 0xC0;
|
||||
break;
|
||||
case 0x01: /* pixels 1, 5, 9, ... */
|
||||
*destPtr += pixTransTbl[dataPtr[i++]] & 0x30;
|
||||
break;
|
||||
case 0x02: /* pixels 2, 6, 10, ... */
|
||||
*destPtr += pixTransTbl[dataPtr[i++]] & 0x0C;
|
||||
break;
|
||||
case 0x03: /* pixels 3, 7, 11, ... */
|
||||
*(destPtr++) += pixTransTbl[dataPtr[i++]] & 0x03;
|
||||
}
|
||||
}
|
||||
else /* 320 mode */
|
||||
for (i = 0; i < rectWidth; /* i is incremented in loop */) {
|
||||
if ((i & 0x01) == 0) /* pixels 0, 2, 4, ... */
|
||||
*destPtr = pixTransTbl[dataPtr[i++]] & 0xF0;
|
||||
else { /* pixels 1, 3, 5, ... */
|
||||
*(destPtr++) += pixTransTbl[dataPtr[i++]] & 0x0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HUnlock(readBufferHndl);
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
PPToPort(&srcLocInfo, &srcRect, rectX - contentOriginPtr->h,
|
||||
rectY - contentOriginPtr->v, modeCopy);
|
||||
free(srcLocInfo.ptrToPixImage); /* Allocated as destPtr */
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
PPToPort(&srcLocInfo, &srcRect, rectX - contentOriginPtr->h,
|
||||
rectY - contentOriginPtr->v, modeCopy);
|
||||
free(srcLocInfo.ptrToPixImage); /* Allocated as destPtr */
|
||||
|
||||
TCPIPPoll();
|
||||
|
||||
rectHeight--; /* One less line left to draw */
|
||||
rectY++; /* Rest of rect starts one line below this */
|
||||
rectHeight--; /* One less line left to draw */
|
||||
rectY++; /* Rest of rect starts one line below this */
|
||||
}
|
||||
|
||||
/* Process rectangle data in raw encoding and write it to screen.
|
||||
@ -324,43 +324,43 @@ void DoRawRect (void) {
|
||||
pixels = (unsigned long) rectWidth * rectHeight;
|
||||
|
||||
/* Try to read data */
|
||||
if (! DoReadTCP (pixels)) {
|
||||
/* Only support line-by-line drawing if the connection is quite slow;
|
||||
if (! DoReadTCP (pixels)) {
|
||||
/* Only support line-by-line drawing if the connection is quite slow;
|
||||
* otherwise it's actually detrimental to overall speed. The Hextile
|
||||
* setting is used as a hint at the connection speed.
|
||||
*/
|
||||
if (useHextile && rectHeight > 1 && DoReadTCP ((unsigned long) rectWidth))
|
||||
RawDrawLine(); /* Some data ready - draw first line */
|
||||
return; /* Not ready yet; wait */
|
||||
if (useHextile && rectHeight > 1 && DoReadTCP ((unsigned long) rectWidth))
|
||||
RawDrawLine(); /* Some data ready - draw first line */
|
||||
return; /* Not ready yet; wait */
|
||||
}
|
||||
|
||||
/* Here if data is ready to be processed */
|
||||
|
||||
if (hRez == 640) {
|
||||
if (rectWidth & 0x03) { /* Width not an exact multiple of 4 */
|
||||
lineBytes = rectWidth/4 + 1;
|
||||
if (rectWidth & 0x03) { /* Width not an exact multiple of 4 */
|
||||
lineBytes = rectWidth/4 + 1;
|
||||
extraByteAdvance = TRUE;
|
||||
}
|
||||
else { /* Width is a multiple of 4 */
|
||||
lineBytes = rectWidth/4;
|
||||
}
|
||||
else { /* Width is a multiple of 4 */
|
||||
lineBytes = rectWidth/4;
|
||||
extraByteAdvance = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { /* 320 mode */
|
||||
if (rectWidth & 0x01) { /* Width not an exact multiple of 2 */
|
||||
lineBytes = rectWidth/2 + 1;
|
||||
else { /* 320 mode */
|
||||
if (rectWidth & 0x01) { /* Width not an exact multiple of 2 */
|
||||
lineBytes = rectWidth/2 + 1;
|
||||
extraByteAdvance = TRUE;
|
||||
}
|
||||
else { /* Width is a multiple of 2 */
|
||||
lineBytes = rectWidth/2;
|
||||
}
|
||||
else { /* Width is a multiple of 2 */
|
||||
lineBytes = rectWidth/2;
|
||||
extraByteAdvance = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bufferLength = lineBytes * rectHeight;
|
||||
destPtr = calloc(bufferLength, 1);
|
||||
if (!destPtr) { /* Couldn't allocate memory */
|
||||
DoClose(vncWindow);
|
||||
if (!destPtr) { /* Couldn't allocate memory */
|
||||
DoClose(vncWindow);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -371,26 +371,26 @@ void DoRawRect (void) {
|
||||
* padding must be accounted for here.
|
||||
*/
|
||||
if (hRez == 640) {
|
||||
switch (rectWidth & 0x03) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+3; break;
|
||||
case 0x02: srcLocInfo.boundsRect.h2 = rectWidth+2; break;
|
||||
case 0x03: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
}
|
||||
switch (rectWidth & 0x03) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+3; break;
|
||||
case 0x02: srcLocInfo.boundsRect.h2 = rectWidth+2; break;
|
||||
case 0x03: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (rectWidth & 0x01) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
}
|
||||
}
|
||||
switch (rectWidth & 0x01) {
|
||||
case 0x00: srcLocInfo.boundsRect.h2 = rectWidth; break;
|
||||
case 0x01: srcLocInfo.boundsRect.h2 = rectWidth+1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't include padding in the area we will actually copy over */
|
||||
srcRect.h2 = rectWidth;
|
||||
srcRect.v1 = 0;
|
||||
|
||||
displayInProgress = TRUE;
|
||||
drawingLine = 0; /* Drawing first line of rect */
|
||||
checkBounds = TRUE; /* Flag to check bounds when drawing 1st line */
|
||||
HLock(readBufferHndl); /* Lock handle just once for efficiency */
|
||||
}
|
||||
displayInProgress = TRUE;
|
||||
drawingLine = 0; /* Drawing first line of rect */
|
||||
checkBounds = TRUE; /* Flag to check bounds when drawing 1st line */
|
||||
HLock(readBufferHndl); /* Lock handle just once for efficiency */
|
||||
}
|
||||
|
230
vncdisplay.cc
230
vncdisplay.cc
@ -56,11 +56,11 @@ struct LocInfo srcLocInfo = {0, 0, 0, {0, 0, 0, 0} };
|
||||
Rect srcRect = {0, 0, 0, 0};
|
||||
unsigned char *pixTransTbl;
|
||||
|
||||
BOOLEAN checkBounds = FALSE; /* Adjust drawing to stay in bounds */
|
||||
BOOLEAN checkBounds = FALSE; /* Adjust drawing to stay in bounds */
|
||||
|
||||
#define txtColor 10
|
||||
#define txtGray 11
|
||||
#define txtTransfers 23
|
||||
#define txtColor 10
|
||||
#define txtGray 11
|
||||
#define txtTransfers 23
|
||||
|
||||
/* Send a request to be sent the data to redraw the window when part of it has
|
||||
* been erased. It will be a while before the data is fully redrawn, but this
|
||||
@ -72,11 +72,11 @@ void VNCRedraw (void) {
|
||||
|
||||
updateRgnHndl = vncWindow->visRgn;
|
||||
|
||||
SendFBUpdateRequest(FALSE,
|
||||
(**updateRgnHndl).rgnBBox.h1,
|
||||
(**updateRgnHndl).rgnBBox.v1,
|
||||
(**updateRgnHndl).rgnBBox.h2 - (**updateRgnHndl).rgnBBox.h1,
|
||||
(**updateRgnHndl).rgnBBox.v2 - (**updateRgnHndl).rgnBBox.v1);
|
||||
SendFBUpdateRequest(FALSE,
|
||||
(**updateRgnHndl).rgnBBox.h1,
|
||||
(**updateRgnHndl).rgnBBox.v1,
|
||||
(**updateRgnHndl).rgnBBox.h2 - (**updateRgnHndl).rgnBBox.h1,
|
||||
(**updateRgnHndl).rgnBBox.v2 - (**updateRgnHndl).rgnBBox.v1);
|
||||
|
||||
checkBounds = TRUE;
|
||||
}
|
||||
@ -86,7 +86,7 @@ void VNCRedraw (void) {
|
||||
* Uses the procedure described in IIgs Tech Note #4.
|
||||
*/
|
||||
void ChangeResolution(int rez) {
|
||||
static Handle dpSpace;
|
||||
static Handle dpSpace;
|
||||
unsigned int masterSCB;
|
||||
|
||||
hRez = rez;
|
||||
@ -96,35 +96,35 @@ void ChangeResolution(int rez) {
|
||||
|
||||
/* Set up pixel translation table for correct graphics mode */
|
||||
if (rez == 320)
|
||||
pixTransTbl = coltab320;
|
||||
else /* 640 mode */
|
||||
pixTransTbl = coltab640;
|
||||
pixTransTbl = coltab320;
|
||||
else /* 640 mode */
|
||||
pixTransTbl = coltab640;
|
||||
|
||||
srcLocInfo.portSCB = (rez == 640) ? 0x87 : 0x00;
|
||||
|
||||
/* Check if we need to change modes */
|
||||
masterSCB = GetMasterSCB();
|
||||
if ( ( (masterSCB & 0x80) && (rez == 640)) ||
|
||||
(!(masterSCB & 0x80) && (rez == 320)) ) {
|
||||
return; /* Already in right mode, so don't change things */
|
||||
(!(masterSCB & 0x80) && (rez == 320)) ) {
|
||||
return; /* Already in right mode, so don't change things */
|
||||
}
|
||||
|
||||
/* Perform the basic procedure described in IIgs TN #4 */
|
||||
CloseAllNDAs();
|
||||
CloseAllNDAs();
|
||||
QDAuxShutDown();
|
||||
QDShutDown();
|
||||
if (dpSpace == NULL)
|
||||
dpSpace = NewHandle(0x0300, userid(),
|
||||
attrLocked|attrFixed|attrNoCross|attrBank, 0x00000000);
|
||||
dpSpace = NewHandle(0x0300, userid(),
|
||||
attrLocked|attrFixed|attrNoCross|attrBank, 0x00000000);
|
||||
QDStartUp((Word) *dpSpace, (rez == 640) ? 0x87 : 0x00, 0, userid());
|
||||
/* SCB 0x87 gives 640 mode with our custom gray palette */
|
||||
/* SCB 0x87 gives 640 mode with our custom gray palette */
|
||||
GrafOff();
|
||||
QDAuxStartUp();
|
||||
ClampMouse(0, (rez == 640) ? 639 : 319, 0, 199);
|
||||
HomeMouse();
|
||||
ShowCursor();
|
||||
WindNewRes();
|
||||
InitPalette(); /* Set up Apple menu colors before it is redrawn */
|
||||
InitPalette(); /* Set up Apple menu colors before it is redrawn */
|
||||
MenuNewRes();
|
||||
CtlNewRes();
|
||||
RefreshDesktop(NULL);
|
||||
@ -132,16 +132,16 @@ void ChangeResolution(int rez) {
|
||||
|
||||
/* Position new connection window at default location for new mode */
|
||||
if (rez == 320) {
|
||||
MoveControl(25, 64, GetCtlHandleFromID(newConnWindow, txtColor));
|
||||
MoveControl(25, 64, GetCtlHandleFromID(newConnWindow, txtColor));
|
||||
MoveControl(25, 87, GetCtlHandleFromID(newConnWindow, txtGray));
|
||||
MoveControl(134, 91, GetCtlHandleFromID(newConnWindow, txtTransfers));
|
||||
MoveWindow(2, 42, newConnWindow);
|
||||
MoveControl(134, 91, GetCtlHandleFromID(newConnWindow, txtTransfers));
|
||||
MoveWindow(2, 42, newConnWindow);
|
||||
}
|
||||
else {
|
||||
MoveControl(35, 64, GetCtlHandleFromID(newConnWindow, txtColor));
|
||||
MoveControl(35, 64, GetCtlHandleFromID(newConnWindow, txtColor));
|
||||
MoveControl(35, 87, GetCtlHandleFromID(newConnWindow, txtGray));
|
||||
MoveControl(144, 91, GetCtlHandleFromID(newConnWindow, txtTransfers));
|
||||
MoveWindow(162, 42, newConnWindow);
|
||||
MoveControl(144, 91, GetCtlHandleFromID(newConnWindow, txtTransfers));
|
||||
MoveWindow(162, 42, newConnWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,24 +151,24 @@ void ChangeResolution(int rez) {
|
||||
void InitVNCWindow(void) {
|
||||
#define wrNum640 1003
|
||||
#define wrNum320 1004
|
||||
BOOLEAN resize = FALSE;
|
||||
BOOLEAN resize = FALSE;
|
||||
|
||||
ChangeResolution(hRez);
|
||||
ChangeResolution(hRez);
|
||||
|
||||
vncWindow = NewWindow2(NULL, 0, NULL, NULL, 0x02,
|
||||
(hRez == 640) ? wrNum640 : wrNum320,
|
||||
rWindParam1);
|
||||
(hRez == 640) ? wrNum640 : wrNum320,
|
||||
rWindParam1);
|
||||
|
||||
if (fbWidth < winWidth) {
|
||||
winWidth = fbWidth;
|
||||
winWidth = fbWidth;
|
||||
resize = TRUE;
|
||||
}
|
||||
if (fbHeight < winHeight) {
|
||||
winHeight = fbHeight;
|
||||
winHeight = fbHeight;
|
||||
resize = TRUE;
|
||||
}
|
||||
if (resize)
|
||||
SizeWindow(winWidth, winHeight, vncWindow);
|
||||
SizeWindow(winWidth, winHeight, vncWindow);
|
||||
|
||||
SetContentDraw(VNCRedraw, vncWindow);
|
||||
|
||||
@ -176,7 +176,7 @@ void InitVNCWindow(void) {
|
||||
|
||||
DrawControls(vncWindow);
|
||||
|
||||
/* We also take the opportunity here to initialize the rectangle info. */
|
||||
/* We also take the opportunity here to initialize the rectangle info. */
|
||||
numRects = 0;
|
||||
displayInProgress = FALSE;
|
||||
|
||||
@ -188,11 +188,11 @@ void InitVNCWindow(void) {
|
||||
* the frame buffer.
|
||||
*/
|
||||
void SendFBUpdateRequest (BOOLEAN incremental, unsigned int x, unsigned int y,
|
||||
unsigned int width, unsigned int height) {
|
||||
|
||||
unsigned int width, unsigned int height) {
|
||||
|
||||
struct FBUpdateRequest {
|
||||
unsigned char messageType;
|
||||
unsigned char incremental;
|
||||
unsigned char messageType;
|
||||
unsigned char incremental;
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
unsigned int width;
|
||||
@ -205,31 +205,31 @@ void SendFBUpdateRequest (BOOLEAN incremental, unsigned int x, unsigned int y,
|
||||
fbUpdateRequest.width = SwapBytes2(width);
|
||||
fbUpdateRequest.height = SwapBytes2(height);
|
||||
|
||||
TCPIPWriteTCP(hostIpid, &fbUpdateRequest.messageType,
|
||||
sizeof(fbUpdateRequest), TRUE, FALSE);
|
||||
/* No error checking here -- Can't respond to one usefully. */
|
||||
TCPIPWriteTCP(hostIpid, &fbUpdateRequest.messageType,
|
||||
sizeof(fbUpdateRequest), TRUE, FALSE);
|
||||
/* No error checking here -- Can't respond to one usefully. */
|
||||
}
|
||||
|
||||
|
||||
/* Start responding to a FramebufferUpdate from the server
|
||||
*/
|
||||
void DoFBUpdate (void) {
|
||||
unsigned int *dataPtr; /* Pointer to header data */
|
||||
unsigned int *dataPtr; /* Pointer to header data */
|
||||
|
||||
if (!DoWaitingReadTCP(15)) {
|
||||
if (!DoWaitingReadTCP(15)) {
|
||||
DoClose(vncWindow);
|
||||
//printf("Closing in DoFBUpdate\n");
|
||||
return;
|
||||
}
|
||||
HLock(readBufferHndl);
|
||||
dataPtr = (unsigned int *) (((char *) (*readBufferHndl)) + 1);
|
||||
numRects = SwapBytes2(dataPtr[0]); /* Get data */
|
||||
numRects = SwapBytes2(dataPtr[0]); /* Get data */
|
||||
rectX = SwapBytes2(dataPtr[1]);
|
||||
rectY = SwapBytes2(dataPtr[2]);
|
||||
rectWidth = SwapBytes2(dataPtr[3]);
|
||||
rectHeight = SwapBytes2(dataPtr[4]);
|
||||
rectEncoding = SwapBytes4(*(unsigned long *)(dataPtr + 5));
|
||||
HUnlock(readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
}
|
||||
|
||||
/* The server should never send a color map, since we don't use a mapped
|
||||
@ -240,7 +240,7 @@ void DoFBUpdate (void) {
|
||||
* is actually working correctly.
|
||||
*/
|
||||
void DoSetColourMapEntries (void) {
|
||||
unsigned int numColors;
|
||||
unsigned int numColors;
|
||||
|
||||
DoWaitingReadTCP(3);
|
||||
DoWaitingReadTCP(2);
|
||||
@ -248,8 +248,8 @@ void DoSetColourMapEntries (void) {
|
||||
numColors = SwapBytes2((unsigned int) **readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
for (; numColors > 0; numColors--) {
|
||||
DoWaitingReadTCP(6);
|
||||
}
|
||||
DoWaitingReadTCP(6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -258,100 +258,100 @@ void DoSetColourMapEntries (void) {
|
||||
* If no more rectangles are available, we send a FramebufferUpdateRequest.
|
||||
*/
|
||||
void NextRect (void) {
|
||||
unsigned int *dataPtr;
|
||||
unsigned int *dataPtr;
|
||||
|
||||
numRects--;
|
||||
if (numRects) { /* Process next rectangle */
|
||||
if (!DoWaitingReadTCP(12)) {
|
||||
//printf("Closing in NextRect\n");
|
||||
DoClose(vncWindow);
|
||||
numRects--;
|
||||
if (numRects) { /* Process next rectangle */
|
||||
if (!DoWaitingReadTCP(12)) {
|
||||
//printf("Closing in NextRect\n");
|
||||
DoClose(vncWindow);
|
||||
return;
|
||||
}
|
||||
HLock(readBufferHndl);
|
||||
dataPtr = (unsigned int *) ((char *) (*readBufferHndl));
|
||||
rectX = SwapBytes2(dataPtr[0]);
|
||||
rectY = SwapBytes2(dataPtr[1]);
|
||||
rectWidth = SwapBytes2(dataPtr[2]);
|
||||
rectHeight = SwapBytes2(dataPtr[3]);
|
||||
rectEncoding = SwapBytes4(*(unsigned long *)(dataPtr + 4));
|
||||
dataPtr = (unsigned int *) ((char *) (*readBufferHndl));
|
||||
rectX = SwapBytes2(dataPtr[0]);
|
||||
rectY = SwapBytes2(dataPtr[1]);
|
||||
rectWidth = SwapBytes2(dataPtr[2]);
|
||||
rectHeight = SwapBytes2(dataPtr[3]);
|
||||
rectEncoding = SwapBytes4(*(unsigned long *)(dataPtr + 4));
|
||||
HUnlock(readBufferHndl);
|
||||
//printf("New Rect: X = %u, Y = %u, Width = %u, Height = %u\n", rectX, rectY, rectWidth, rectHeight);
|
||||
//printf("New Rect: X = %u, Y = %u, Width = %u, Height = %u\n", rectX, rectY, rectWidth, rectHeight);
|
||||
}
|
||||
else { /* No more rectangles from last update */
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
else { /* No more rectangles from last update */
|
||||
unsigned long contentOrigin;
|
||||
Point * contentOriginPtr = (void *) &contentOrigin;
|
||||
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
SendFBUpdateRequest(TRUE, contentOriginPtr->h, contentOriginPtr->v,
|
||||
winWidth, winHeight);
|
||||
}
|
||||
contentOrigin = GetContentOrigin(vncWindow);
|
||||
SendFBUpdateRequest(TRUE, contentOriginPtr->h, contentOriginPtr->v,
|
||||
winWidth, winHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConnectedEventLoop (void) {
|
||||
unsigned char messageType;
|
||||
#define FBUpdate 0
|
||||
unsigned char messageType;
|
||||
#define FBUpdate 0
|
||||
#define SetColourMapEntries 1
|
||||
#define Bell 2
|
||||
#define ServerCutText 3
|
||||
#define Bell 2
|
||||
#define ServerCutText 3
|
||||
|
||||
if (FrontWindow() != vncWindow && menuOffset == noKB)
|
||||
InitMenus(0);
|
||||
if (FrontWindow() != vncWindow && menuOffset == noKB)
|
||||
InitMenus(0);
|
||||
else if (FrontWindow() == vncWindow && menuOffset != noKB)
|
||||
InitMenus(noKB);
|
||||
InitMenus(noKB);
|
||||
|
||||
if (displayInProgress) {
|
||||
switch (rectEncoding) {
|
||||
case encodingRaw: RawDraw();
|
||||
return;
|
||||
case encodingHextile: HexDispatch();
|
||||
return;
|
||||
default: DoClose(vncWindow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (numRects) {
|
||||
switch (rectEncoding) {
|
||||
case encodingHextile:
|
||||
DoHextileRect();
|
||||
if (displayInProgress) {
|
||||
switch (rectEncoding) {
|
||||
case encodingRaw: RawDraw();
|
||||
return;
|
||||
case encodingHextile: HexDispatch();
|
||||
return;
|
||||
default: DoClose(vncWindow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (numRects) {
|
||||
switch (rectEncoding) {
|
||||
case encodingHextile:
|
||||
DoHextileRect();
|
||||
return;
|
||||
case encodingRaw: DoRawRect();
|
||||
return;
|
||||
case encodingRaw: DoRawRect();
|
||||
return;
|
||||
case encodingCopyRect:
|
||||
DoCopyRect();
|
||||
return;
|
||||
DoCopyRect();
|
||||
return;
|
||||
case encodingDesktopSize:
|
||||
DoDesktopSize();
|
||||
return;
|
||||
DoDesktopSize();
|
||||
return;
|
||||
case encodingCursor:
|
||||
DoCursor();
|
||||
return;
|
||||
default: DisplayConnectStatus (
|
||||
"\pInvalid rectangle from server.", FALSE);
|
||||
default: DisplayConnectStatus (
|
||||
"\pInvalid rectangle from server.", FALSE);
|
||||
DoClose(vncWindow);
|
||||
//printf("Closing due to bad rectangle encoding %lu\n", rectEncoding);
|
||||
//printf("rectX = %u, rectY = %u, rectWidth = %u, rectHeight = %u\n", rectX, rectY, rectWidth, rectHeight);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (DoReadTCP(1)) { /* Read message type byte */
|
||||
HLock(readBufferHndl);
|
||||
messageType = ((unsigned char) **readBufferHndl);
|
||||
}
|
||||
else if (DoReadTCP(1)) { /* Read message type byte */
|
||||
HLock(readBufferHndl);
|
||||
messageType = ((unsigned char) **readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
switch (messageType) {
|
||||
case FBUpdate: DoFBUpdate();
|
||||
break;
|
||||
case SetColourMapEntries: DoSetColourMapEntries();
|
||||
break;
|
||||
case Bell: SysBeep();
|
||||
break;
|
||||
case ServerCutText: DoServerCutText();
|
||||
break;
|
||||
default: DisplayConnectStatus (
|
||||
"\pInvalid message from server.",
|
||||
FALSE);
|
||||
switch (messageType) {
|
||||
case FBUpdate: DoFBUpdate();
|
||||
break;
|
||||
case SetColourMapEntries: DoSetColourMapEntries();
|
||||
break;
|
||||
case Bell: SysBeep();
|
||||
break;
|
||||
case ServerCutText: DoServerCutText();
|
||||
break;
|
||||
default: DisplayConnectStatus (
|
||||
"\pInvalid message from server.",
|
||||
FALSE);
|
||||
DoClose(vncWindow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
20
vncdisplay.h
20
vncdisplay.h
@ -10,14 +10,14 @@ extern unsigned int rectWidth;
|
||||
extern unsigned int rectHeight;
|
||||
extern unsigned long rectEncoding;
|
||||
|
||||
#define encodingRaw 0
|
||||
#define encodingCopyRect 1
|
||||
#define encodingRRE 2
|
||||
#define encodingCoRRE 4
|
||||
#define encodingHextile 5
|
||||
#define encodingZRLE 16
|
||||
#define encodingCursor 0xffffff11
|
||||
#define encodingDesktopSize 0xffffff21
|
||||
#define encodingRaw 0
|
||||
#define encodingCopyRect 1
|
||||
#define encodingRRE 2
|
||||
#define encodingCoRRE 4
|
||||
#define encodingHextile 5
|
||||
#define encodingZRLE 16
|
||||
#define encodingCursor 0xffffff11
|
||||
#define encodingDesktopSize 0xffffff21
|
||||
|
||||
extern GrafPortPtr vncWindow;
|
||||
|
||||
@ -34,12 +34,12 @@ extern struct LocInfo srcLocInfo;
|
||||
extern Rect srcRect;
|
||||
extern unsigned char *pixTransTbl;
|
||||
|
||||
extern BOOLEAN checkBounds; /* Adjust drawing to stay in bounds */
|
||||
extern BOOLEAN checkBounds; /* Adjust drawing to stay in bounds */
|
||||
|
||||
void InitVNCWindow (void);
|
||||
|
||||
void SendFBUpdateRequest (BOOLEAN /*incremental*/, unsigned int /*x*/,
|
||||
unsigned int /*y*/, unsigned int /*width*/, unsigned int /*height*/);
|
||||
unsigned int /*y*/, unsigned int /*width*/, unsigned int /*height*/);
|
||||
|
||||
void ConnectedEventLoop (void);
|
||||
|
||||
|
566
vncsession.cc
566
vncsession.cc
@ -1,6 +1,6 @@
|
||||
/*********************************************************************
|
||||
* vncsession.cc - Routines for initiating/conducting a VNC session
|
||||
* with the remote host
|
||||
* with the remote host
|
||||
*********************************************************************/
|
||||
|
||||
#if __ORCAC__
|
||||
@ -38,183 +38,183 @@
|
||||
#include "menus.h"
|
||||
#include "colortables.h"
|
||||
|
||||
#define linServer 3
|
||||
#define linPassword 7
|
||||
#define linServer 3
|
||||
#define linPassword 7
|
||||
|
||||
#define noCryptoError 2005
|
||||
#define authFailedError 2006
|
||||
#define authTooManyError 2007
|
||||
#define noTCPIPConnectionError 2011
|
||||
#define badGetIpidError 2012
|
||||
#define badOptionNegotiationError 2013
|
||||
#define badHandshakingError 2014
|
||||
#define badReadTCPError 2015
|
||||
#define noCryptoError 2005
|
||||
#define authFailedError 2006
|
||||
#define authTooManyError 2007
|
||||
#define noTCPIPConnectionError 2011
|
||||
#define badGetIpidError 2012
|
||||
#define badOptionNegotiationError 2013
|
||||
#define badHandshakingError 2014
|
||||
#define badReadTCPError 2015
|
||||
|
||||
GrafPortPtr connectStatusWindowPtr = NULL;
|
||||
|
||||
unsigned int hostIpid;
|
||||
void ** readBufferHndl; /* Handle to the data read by the last
|
||||
* DoReadTCP call. Copy this elsewhere if more
|
||||
void ** readBufferHndl; /* Handle to the data read by the last
|
||||
* DoReadTCP call. Copy this elsewhere if more
|
||||
* data may be read while it is still in use.
|
||||
*/
|
||||
BOOLEAN readError;
|
||||
BOOLEAN alerted = FALSE;
|
||||
|
||||
#define buffTypePointer 0x0000 /* For TCPIPReadTCP() */
|
||||
#define buffTypePointer 0x0000 /* For TCPIPReadTCP() */
|
||||
#define buffTypeHandle 0x0001
|
||||
#define buffTypeNewHandle 0x0002
|
||||
|
||||
#define vncConnectionFailed SwapBytes4(0)
|
||||
#define vncConnectionFailed SwapBytes4(0)
|
||||
#define vncNoAuthentication SwapBytes4(1)
|
||||
#define vncVNCAuthentication SwapBytes4(2)
|
||||
#define vncVNCAuthentication SwapBytes4(2)
|
||||
|
||||
/***************************************************************
|
||||
* DoConnect - establish connection to server
|
||||
***************************************************************/
|
||||
|
||||
void DoConnect (void) {
|
||||
int i; /* loop counter */
|
||||
int i; /* loop counter */
|
||||
|
||||
if (colorTablesComplete == FALSE) {
|
||||
DisplayConnectStatus("\pGenerating color tables...", FALSE);
|
||||
MakeBigColorTables(65536);
|
||||
DisplayConnectStatus("\pGenerating color tables...", FALSE);
|
||||
MakeBigColorTables(65536);
|
||||
colorTablesComplete = TRUE;
|
||||
CloseConnectStatusWindow();
|
||||
}
|
||||
|
||||
/* Get server & password */
|
||||
|
||||
/* Get server & password */
|
||||
|
||||
GetLETextByID(newConnWindow, linServer, (StringPtr) vncServer);
|
||||
GetLETextByID(newConnWindow, linPassword, (StringPtr) vncPassword);
|
||||
GetLETextByID(newConnWindow, linPassword, (StringPtr) vncPassword);
|
||||
|
||||
/* Try to establish connection before continuing; if unsuccessful, stop */
|
||||
if (ConnectTCPIP() == FALSE) {
|
||||
if (ConnectTCPIP() == FALSE) {
|
||||
SysBeep();
|
||||
AlertWindow(awResource, NULL, noTCPIPConnectionError);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetIpid() == FALSE) {
|
||||
if (GetIpid() == FALSE) {
|
||||
SysBeep();
|
||||
AlertWindow(awResource, NULL, badGetIpidError);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if (DoVNCHandshaking() == FALSE) {
|
||||
SetHandleSize(1,readBufferHndl);
|
||||
SetHandleSize(1,readBufferHndl);
|
||||
CloseConnectStatusWindow();
|
||||
InitCursor();
|
||||
SysBeep();
|
||||
if (alerted == FALSE)
|
||||
AlertWindow(awResource, NULL, badHandshakingError);
|
||||
AlertWindow(awResource, NULL, badHandshakingError);
|
||||
else
|
||||
alerted = FALSE;
|
||||
alerted = FALSE;
|
||||
return;
|
||||
}
|
||||
if (FinishVNCHandshaking() == FALSE) {
|
||||
SetHandleSize(1,readBufferHndl);
|
||||
SetHandleSize(1,readBufferHndl);
|
||||
CloseConnectStatusWindow();
|
||||
InitCursor();
|
||||
AlertWindow(awResource, NULL, badOptionNegotiationError);
|
||||
SysBeep();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
InitVNCWindow();
|
||||
|
||||
CloseConnectStatusWindow();
|
||||
InitCursor();
|
||||
|
||||
DoClose(newConnWindow);
|
||||
DoClose(newConnWindow);
|
||||
DisableMItem(fileNewConnection);
|
||||
|
||||
myEvent.wmTaskMask = 0x001D79FE; /* don't let TaskMaster process keys */
|
||||
InitMenus(noKB);
|
||||
myEvent.wmTaskMask = 0x001D79FE; /* don't let TaskMaster process keys */
|
||||
InitMenus(noKB);
|
||||
vncConnected = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* DisplayConnectStatus - Display modal dialog with status information
|
||||
* statusString - P-String to display
|
||||
* cancelMessage - determines whether to display string about OA-.
|
||||
* statusString - P-String to display
|
||||
* cancelMessage - determines whether to display string about OA-.
|
||||
*******************************************************************/
|
||||
|
||||
void DisplayConnectStatus(char *statusString, BOOLEAN cancelMessage) {
|
||||
#define wrNum 1002
|
||||
#define cancelStr 10002
|
||||
#define wrNum 1002
|
||||
#define cancelStr 10002
|
||||
|
||||
GrafPortPtr oldPort;
|
||||
Rect bigRect = {0,9,15,293};
|
||||
GrafPortPtr oldPort;
|
||||
Rect bigRect = {0,9,15,293};
|
||||
|
||||
if (connectStatusWindowPtr == NULL) {
|
||||
connectStatusWindowPtr = NewWindow2(NULL, NULL, NULL, NULL,
|
||||
0x02, wrNum, rWindParam1);
|
||||
connectStatusWindowPtr = NewWindow2(NULL, NULL, NULL, NULL,
|
||||
0x02, wrNum, rWindParam1);
|
||||
}
|
||||
|
||||
if (connectStatusWindowPtr != NULL) { /* Only draw if window was */
|
||||
if (GetMasterSCB() & 0x0080) /* If in 640 mode... */
|
||||
MoveWindow(169, 85, connectStatusWindowPtr);
|
||||
else /* If in 320 mode... */
|
||||
MoveWindow(9, 85, connectStatusWindowPtr);
|
||||
if (connectStatusWindowPtr != NULL) { /* Only draw if window was */
|
||||
if (GetMasterSCB() & 0x0080) /* If in 640 mode... */
|
||||
MoveWindow(169, 85, connectStatusWindowPtr);
|
||||
else /* If in 320 mode... */
|
||||
MoveWindow(9, 85, connectStatusWindowPtr);
|
||||
|
||||
oldPort = GetPort(); /* created successfully */
|
||||
SetPort(connectStatusWindowPtr);
|
||||
EraseRect(&bigRect); /* Clipped to window's GrafPort */
|
||||
MoveTo(bigRect.h1, 13);
|
||||
DrawStringWidth(0x6000, (Long) statusString, bigRect.h2 - bigRect.h1);
|
||||
if (cancelMessage) {
|
||||
MoveTo(bigRect.h1, 24);
|
||||
DrawStringWidth(0x0002, cancelStr, bigRect.h2 - bigRect.h1);
|
||||
}
|
||||
SetPort(oldPort);
|
||||
}
|
||||
oldPort = GetPort(); /* created successfully */
|
||||
SetPort(connectStatusWindowPtr);
|
||||
EraseRect(&bigRect); /* Clipped to window's GrafPort */
|
||||
MoveTo(bigRect.h1, 13);
|
||||
DrawStringWidth(0x6000, (Long) statusString, bigRect.h2 - bigRect.h1);
|
||||
if (cancelMessage) {
|
||||
MoveTo(bigRect.h1, 24);
|
||||
DrawStringWidth(0x0002, cancelStr, bigRect.h2 - bigRect.h1);
|
||||
}
|
||||
SetPort(oldPort);
|
||||
}
|
||||
|
||||
#undef wrNum
|
||||
#undef cancelStr
|
||||
}
|
||||
#undef cancelStr
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DisplayConnectStatusFromTool - Can be passed to Marinetti
|
||||
***********************************************************************/
|
||||
#pragma databank 1 /* Set data bank register to access globals. */
|
||||
#pragma toolparms 1 /* Use tool-style stack model */
|
||||
#pragma databank 1 /* Set data bank register to access globals. */
|
||||
#pragma toolparms 1 /* Use tool-style stack model */
|
||||
void DisplayConnectStatusFromTool (char *statusString) {
|
||||
DisplayConnectStatus(statusString, TRUE);
|
||||
DisplayConnectStatus(statusString, TRUE);
|
||||
}
|
||||
#pragma toolparms 0 /* Use ORCA stack model */
|
||||
#pragma databank 0 /* Must restore data bank register on exit */
|
||||
#pragma toolparms 0 /* Use ORCA stack model */
|
||||
#pragma databank 0 /* Must restore data bank register on exit */
|
||||
|
||||
/***********************************************************************
|
||||
* CloseConnectStatusWindow - Close connect status window (if open)
|
||||
***********************************************************************/
|
||||
void CloseConnectStatusWindow (void) {
|
||||
if (connectStatusWindowPtr != NULL) {
|
||||
CloseWindow(connectStatusWindowPtr);
|
||||
if (connectStatusWindowPtr != NULL) {
|
||||
CloseWindow(connectStatusWindowPtr);
|
||||
connectStatusWindowPtr = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ConnectTCPIP - Try to establish a TCP/IP connection through Marinetti
|
||||
***********************************************************************/
|
||||
BOOLEAN ConnectTCPIP (void)
|
||||
{
|
||||
BOOLEAN connected = FALSE; /* Are we connected to the network now? */
|
||||
BOOLEAN connected = FALSE; /* Are we connected to the network now? */
|
||||
|
||||
if (TCPIPGetConnectStatus() == FALSE) { /* If no TCP/IP connection... */
|
||||
WaitCursor();
|
||||
TCPIPConnect(&DisplayConnectStatusFromTool);
|
||||
if (!toolerror())
|
||||
connected = TRUE;
|
||||
CloseConnectStatusWindow();
|
||||
InitCursor();
|
||||
}
|
||||
else /* Already connected */
|
||||
return TRUE;
|
||||
if (TCPIPGetConnectStatus() == FALSE) { /* If no TCP/IP connection... */
|
||||
WaitCursor();
|
||||
TCPIPConnect(&DisplayConnectStatusFromTool);
|
||||
if (!toolerror())
|
||||
connected = TRUE;
|
||||
CloseConnectStatusWindow();
|
||||
InitCursor();
|
||||
}
|
||||
else /* Already connected */
|
||||
return TRUE;
|
||||
|
||||
if (connected)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
if (connected)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -222,77 +222,77 @@ BOOLEAN ConnectTCPIP (void)
|
||||
***********************************************************************/
|
||||
BOOLEAN GetIpid (void)
|
||||
{
|
||||
#define baseDisplayNum 5900
|
||||
#define baseDisplayNum 5900
|
||||
|
||||
int i;
|
||||
long hostPort;
|
||||
cvtRec hostInfo;
|
||||
static dnrBuffer dnrInfo;
|
||||
int i;
|
||||
long hostPort;
|
||||
cvtRec hostInfo;
|
||||
static dnrBuffer dnrInfo;
|
||||
unsigned long initialTime;
|
||||
|
||||
/* Find ":" character that delimits name (or IP) from display number */
|
||||
for (i = vncServer[0]; isdigit(vncServer[i]) && i>0; i--);
|
||||
for (i = vncServer[0]; isdigit(vncServer[i]) && i>0; i--);
|
||||
|
||||
/* Set port to connect to */
|
||||
/* Set port to connect to */
|
||||
if (sscanf(&vncServer[i], ":%ld", &hostPort) == 0)
|
||||
hostPort = 0;
|
||||
hostPort = 0;
|
||||
hostPort += baseDisplayNum;
|
||||
|
||||
/* Modify the string so it only contains the hostname or IP */
|
||||
if (vncServer[i] == ':') {
|
||||
vncServer[0] = i - 1;
|
||||
vncServer[i] = 0;
|
||||
}
|
||||
if (vncServer[i] == ':') {
|
||||
vncServer[0] = i - 1;
|
||||
vncServer[i] = 0;
|
||||
}
|
||||
|
||||
/* If it's an IP address, then put it in the record */
|
||||
if (TCPIPValidateIPString(vncServer))
|
||||
TCPIPConvertIPToHex(&hostInfo, vncServer);
|
||||
else { /* Do a DNS lookup */
|
||||
if (TCPIPValidateIPString(vncServer))
|
||||
TCPIPConvertIPToHex(&hostInfo, vncServer);
|
||||
else { /* Do a DNS lookup */
|
||||
hostInfo.cvtPort = TCPIPMangleDomainName(0xF800, vncServer);
|
||||
TCPIPDNRNameToIP(vncServer, &dnrInfo);
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
WaitCursor();
|
||||
DisplayConnectStatus("\pResolving domain name...", FALSE);
|
||||
initialTime = TickCount();
|
||||
while (dnrInfo.DNRstatus == DNR_Pending) {
|
||||
if (TickCount() >= initialTime + 15*60)
|
||||
break;
|
||||
TCPIPPoll(); /* Call TCPIPPoll() so that */
|
||||
} /* Marinetti can process data */
|
||||
if (TickCount() >= initialTime + 15*60)
|
||||
break;
|
||||
TCPIPPoll(); /* Call TCPIPPoll() so that */
|
||||
} /* Marinetti can process data */
|
||||
CloseConnectStatusWindow();
|
||||
InitCursor();
|
||||
if (dnrInfo.DNRstatus == DNR_OK)
|
||||
hostInfo.cvtIPAddress == dnrInfo.DNRIPaddress;
|
||||
hostInfo.cvtIPAddress == dnrInfo.DNRIPaddress;
|
||||
else
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hostIpid = TCPIPLogin(userid(), hostInfo.cvtIPAddress, (int) hostPort,
|
||||
0x0010 /* minimize latency */,
|
||||
0x0010 /* minimize latency */,
|
||||
0x0040 /* Normal TTL*/);
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
|
||||
if (TCPIPOpenTCP(hostIpid) == tcperrOK)
|
||||
if (!toolerror())
|
||||
return TRUE;
|
||||
if (!toolerror())
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
||||
#undef baseDisplayNum
|
||||
}
|
||||
#undef baseDisplayNum
|
||||
}
|
||||
|
||||
|
||||
/* Read data, waiting for up to 15 seconds for the data to be ready */
|
||||
BOOLEAN DoWaitingReadTCP(unsigned long dataLength) {
|
||||
unsigned long stopTime;
|
||||
BOOLEAN result = FALSE;
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
stopTime = TickCount() + 15 * 60;
|
||||
do {
|
||||
result = DoReadTCP(dataLength);
|
||||
} while (result == FALSE && TickCount() < stopTime);
|
||||
} while (result == FALSE && TickCount() < stopTime);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -300,36 +300,36 @@ BOOLEAN DoWaitingReadTCP(unsigned long dataLength) {
|
||||
|
||||
/* Fix things when TCPIPReadTCP returns less data than it's supposed to */
|
||||
BOOLEAN ReadFixup (unsigned long requested, unsigned long returned) {
|
||||
static rrBuff theRRBuff;
|
||||
static rrBuff theRRBuff;
|
||||
|
||||
SetHandleSize(requested, readBufferHndl);
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
do {
|
||||
TCPIPPoll();
|
||||
if (TCPIPReadTCP(hostIpid, buffTypeNewHandle, NULL,
|
||||
requested-returned, &theRRBuff) != tcperrOK)
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
|
||||
if (theRRBuff.rrBuffCount == 0) /* To avoid infinite loops */
|
||||
return FALSE;
|
||||
TCPIPPoll();
|
||||
if (TCPIPReadTCP(hostIpid, buffTypeNewHandle, NULL,
|
||||
requested-returned, &theRRBuff) != tcperrOK)
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
|
||||
if (theRRBuff.rrBuffCount == 0) /* To avoid infinite loops */
|
||||
return FALSE;
|
||||
|
||||
HandToPtr(theRRBuff.rrBuffHandle, (char *)*readBufferHndl + returned,
|
||||
theRRBuff.rrBuffCount);
|
||||
theRRBuff.rrBuffCount);
|
||||
|
||||
returned += theRRBuff.rrBuffCount;
|
||||
|
||||
} while (returned < requested);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* DoReadTCP() - Issue TCPIPReadTCP() call w/ appropriate parameters
|
||||
* Return value = did the read succeed?
|
||||
* Return value = did the read succeed?
|
||||
**********************************************************************/
|
||||
BOOLEAN DoReadTCP (unsigned long dataLength) {
|
||||
static srBuff theSRBuff;
|
||||
@ -338,24 +338,24 @@ BOOLEAN DoReadTCP (unsigned long dataLength) {
|
||||
TCPIPPoll();
|
||||
|
||||
if (TCPIPStatusTCP(hostIpid, &theSRBuff) != tcperrOK)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
if (theSRBuff.srRcvQueued < dataLength)
|
||||
return FALSE;
|
||||
if (theSRBuff.srRcvQueued < dataLength)
|
||||
return FALSE;
|
||||
|
||||
if (TCPIPReadTCP(hostIpid, buffTypeHandle, (Ref) readBufferHndl,
|
||||
dataLength, &theRRBuff) != tcperrOK)
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
dataLength, &theRRBuff) != tcperrOK)
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
|
||||
if (theRRBuff.rrBuffCount != dataLength)
|
||||
return ReadFixup(dataLength, theRRBuff.rrBuffCount);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
@ -375,15 +375,15 @@ BOOLEAN DoVNCHandshaking (void) {
|
||||
/* Read RFB version string from the server */
|
||||
strcpy(versionString, "");
|
||||
if (! DoWaitingReadTCP(12))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
HLock(readBufferHndl);
|
||||
if ( ! ((strncmp((char *)*readBufferHndl, "RFB ", 4) == 0) &&
|
||||
(strncmp((char *)*readBufferHndl+4, RFBMAJORVERSIONSTR, 3) >= 0) &&
|
||||
(strncmp((char *)*readBufferHndl+4, RFBMAJORVERSIONSTR, 3) >= 0) &&
|
||||
(strncmp((char *)*readBufferHndl+7, ".", 1) == 0) &&
|
||||
(strncmp((char *)*readBufferHndl+11, "\n", 1) == 0))) {
|
||||
HUnlock(readBufferHndl);
|
||||
InitCursor();
|
||||
AlertWindow(awResource, NULL, badRFBVersionAlert);
|
||||
AlertWindow(awResource, NULL, badRFBVersionAlert);
|
||||
alerted = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@ -391,54 +391,54 @@ BOOLEAN DoVNCHandshaking (void) {
|
||||
|
||||
strcpy(versionString, RFBVERSIONSTR);
|
||||
if (TCPIPWriteTCP(hostIpid, versionString, 12, TRUE, FALSE)) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
if (toolerror()) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (! DoWaitingReadTCP(4)) { /* Read authentication type */
|
||||
if (! DoWaitingReadTCP(4)) { /* Read authentication type */
|
||||
return FALSE;
|
||||
}
|
||||
HLock(readBufferHndl);
|
||||
switch ((unsigned long) (**readBufferHndl)) {
|
||||
case vncConnectionFailed: HUnlock(readBufferHndl);
|
||||
case vncConnectionFailed: HUnlock(readBufferHndl);
|
||||
if (! DoWaitingReadTCP(4))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
HLock(readBufferHndl);
|
||||
reasonLength = SwapBytes4(**readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
if (! DoWaitingReadTCP(reasonLength))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
SetHandleSize(
|
||||
GetHandleSize(readBufferHndl)+1,
|
||||
readBufferHndl);
|
||||
if (! toolerror()) {
|
||||
HLock(readBufferHndl);
|
||||
*((char *) *readBufferHndl+reasonLength)
|
||||
= 0;
|
||||
InitCursor();
|
||||
AlertWindow(awResource,
|
||||
(Pointer) readBufferHndl,
|
||||
connectionFailedAlert);
|
||||
GetHandleSize(readBufferHndl)+1,
|
||||
readBufferHndl);
|
||||
if (! toolerror()) {
|
||||
HLock(readBufferHndl);
|
||||
*((char *) *readBufferHndl+reasonLength)
|
||||
= 0;
|
||||
InitCursor();
|
||||
AlertWindow(awResource,
|
||||
(Pointer) readBufferHndl,
|
||||
connectionFailedAlert);
|
||||
alerted = TRUE;
|
||||
HUnlock(readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
}
|
||||
return FALSE;
|
||||
case vncNoAuthentication: break;
|
||||
case vncVNCAuthentication: if (DoDES())
|
||||
break;
|
||||
return FALSE;
|
||||
case vncNoAuthentication: break;
|
||||
case vncVNCAuthentication: if (DoDES())
|
||||
break;
|
||||
HUnlock(readBufferHndl);
|
||||
return FALSE;
|
||||
default: HUnlock(readBufferHndl);
|
||||
AlertWindow(awResource, NULL,
|
||||
badAuthTypeAlert);
|
||||
default: HUnlock(readBufferHndl);
|
||||
AlertWindow(awResource, NULL,
|
||||
badAuthTypeAlert);
|
||||
alerted = TRUE;
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HUnlock(readBufferHndl);
|
||||
@ -452,66 +452,66 @@ BOOLEAN DoVNCHandshaking (void) {
|
||||
* DoDES() - Try to do DES (aka VNC) authentication
|
||||
**********************************************************************/
|
||||
BOOLEAN DoDES (void) {
|
||||
/* This reverses the order of the low 7 bits of a byte. */
|
||||
/* Uses the high bit (7) as scratch space. */
|
||||
#define SwitchBits(x) do { x &= 0x7f; /* Clear 7 */ \
|
||||
x ^= (x << 7) & 0x80; /* 0 -> 7 */ \
|
||||
x &= 0xfe; /* Clear 0 */ \
|
||||
x ^= (x >> 6) & 0x01; /* 6 -> 0 */ \
|
||||
x &= 0xbf; /* Clear 6 */ \
|
||||
x ^= (x >> 1) & 0x40; /* 7 -> 6 */ \
|
||||
x &= 0x7f; /* Clear 7 */ \
|
||||
x ^= (x << 6) & 0x80; /* 1 -> 7 */ \
|
||||
x &= 0xfd; /* Clear 1 */ \
|
||||
x ^= (x >> 4) & 0x02; /* 5 -> 1 */ \
|
||||
x &= 0xdf; /* Clear 5 */ \
|
||||
x ^= (x >> 2) & 0x20; /* 7 -> 5 */ \
|
||||
x &= 0x7f; /* Clear 7 */ \
|
||||
x ^= (x << 5) & 0x80; /* 2 -> 7 */ \
|
||||
x &= 0xfb; /* Clear 2 */ \
|
||||
x ^= (x >> 2) & 0x04; /* 4 -> 2 */ \
|
||||
x &= 0xef; /* Clear 4 */ \
|
||||
x ^= (x >> 3) & 0x10; /* 7 -> 4 */ \
|
||||
/* This reverses the order of the low 7 bits of a byte. */
|
||||
/* Uses the high bit (7) as scratch space. */
|
||||
#define SwitchBits(x) do { x &= 0x7f; /* Clear 7 */ \
|
||||
x ^= (x << 7) & 0x80; /* 0 -> 7 */ \
|
||||
x &= 0xfe; /* Clear 0 */ \
|
||||
x ^= (x >> 6) & 0x01; /* 6 -> 0 */ \
|
||||
x &= 0xbf; /* Clear 6 */ \
|
||||
x ^= (x >> 1) & 0x40; /* 7 -> 6 */ \
|
||||
x &= 0x7f; /* Clear 7 */ \
|
||||
x ^= (x << 6) & 0x80; /* 1 -> 7 */ \
|
||||
x &= 0xfd; /* Clear 1 */ \
|
||||
x ^= (x >> 4) & 0x02; /* 5 -> 1 */ \
|
||||
x &= 0xdf; /* Clear 5 */ \
|
||||
x ^= (x >> 2) & 0x20; /* 7 -> 5 */ \
|
||||
x &= 0x7f; /* Clear 7 */ \
|
||||
x ^= (x << 5) & 0x80; /* 2 -> 7 */ \
|
||||
x &= 0xfb; /* Clear 2 */ \
|
||||
x ^= (x >> 2) & 0x04; /* 4 -> 2 */ \
|
||||
x &= 0xef; /* Clear 4 */ \
|
||||
x ^= (x >> 3) & 0x10; /* 7 -> 4 */ \
|
||||
} while (0)
|
||||
#define statusOK SwapBytes4(0)
|
||||
#define statusFailed SwapBytes4(1)
|
||||
#define statusTooMany SwapBytes4(2)
|
||||
#define statusOK SwapBytes4(0)
|
||||
#define statusFailed SwapBytes4(1)
|
||||
#define statusTooMany SwapBytes4(2)
|
||||
unsigned char theResponse[16];
|
||||
unsigned char theKey[8];
|
||||
BOOLEAN success;
|
||||
BOOLEAN startedCrypto = FALSE; /* True if we started CryptoTool */
|
||||
BOOLEAN startedCrypto = FALSE; /* True if we started CryptoTool */
|
||||
Handle dpSpace;
|
||||
int i;
|
||||
|
||||
DisplayConnectStatus("\pAuthenticating...", FALSE);
|
||||
|
||||
if (!(CryptoStatus() && !toolerror())) { /* if Crypto isn't started */
|
||||
startedCrypto = TRUE;
|
||||
LoadOneTool(129, 0x100); /* load Crypto tool 1.0+ */
|
||||
if (toolerror()) { /* Check that it is available */
|
||||
AlertWindow(awResource, NULL, noCryptoError);
|
||||
alerted = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
if (!(CryptoStatus() && !toolerror())) { /* if Crypto isn't started */
|
||||
startedCrypto = TRUE;
|
||||
LoadOneTool(129, 0x100); /* load Crypto tool 1.0+ */
|
||||
if (toolerror()) { /* Check that it is available */
|
||||
AlertWindow(awResource, NULL, noCryptoError);
|
||||
alerted = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dpSpace = NewHandle(0x0100, userid(),
|
||||
attrLocked|attrFixed|attrNoCross|attrBank, 0x00000000);
|
||||
CryptoStartUp((Word) *dpSpace);
|
||||
dpSpace = NewHandle(0x0100, userid(),
|
||||
attrLocked|attrFixed|attrNoCross|attrBank, 0x00000000);
|
||||
CryptoStartUp((Word) *dpSpace);
|
||||
}
|
||||
|
||||
if (! (DoWaitingReadTCP(16))) {
|
||||
success = FALSE;
|
||||
success = FALSE;
|
||||
goto UnloadCrypto;
|
||||
}
|
||||
|
||||
/* Pad password with nulls, as per VNC precedent */
|
||||
for (i=vncPassword[0]+1; i<=8; i++)
|
||||
vncPassword[i] = 0;
|
||||
vncPassword[i] = 0;
|
||||
|
||||
/* Flip bits around to be in format expected by CryptoTool */
|
||||
/* Flip bits around to be in format expected by CryptoTool */
|
||||
for (i=1; i<9; i++)
|
||||
SwitchBits(vncPassword[i]);
|
||||
|
||||
SwitchBits(vncPassword[i]);
|
||||
|
||||
/* Shift password to form 56-bit key */
|
||||
vncPassword[1] <<= 1;
|
||||
vncPassword[1] += (vncPassword[2] & 0x7f) >> 6;
|
||||
@ -536,49 +536,49 @@ BOOLEAN DoDES (void) {
|
||||
HUnlock(readBufferHndl);
|
||||
|
||||
if (TCPIPWriteTCP(hostIpid, theResponse, sizeof(theResponse), TRUE, FALSE))
|
||||
{
|
||||
success = FALSE;
|
||||
goto UnloadCrypto;
|
||||
{
|
||||
success = FALSE;
|
||||
goto UnloadCrypto;
|
||||
}
|
||||
if (toolerror()) {
|
||||
success = FALSE;
|
||||
success = FALSE;
|
||||
goto UnloadCrypto;
|
||||
}
|
||||
if (! (DoWaitingReadTCP(4))) {
|
||||
success = FALSE;
|
||||
success = FALSE;
|
||||
goto UnloadCrypto;
|
||||
}
|
||||
|
||||
HLock(readBufferHndl);
|
||||
if ((**readBufferHndl) == statusOK) {
|
||||
success = TRUE;
|
||||
success = TRUE;
|
||||
goto UnloadCrypto;
|
||||
}
|
||||
else if ((**readBufferHndl) == statusFailed) {
|
||||
InitCursor();
|
||||
else if ((**readBufferHndl) == statusFailed) {
|
||||
InitCursor();
|
||||
AlertWindow(awResource, NULL, authFailedError);
|
||||
alerted = TRUE;
|
||||
success = FALSE;
|
||||
success = FALSE;
|
||||
goto UnloadCrypto;
|
||||
}
|
||||
else if ((**readBufferHndl) == statusTooMany) {
|
||||
InitCursor();
|
||||
else if ((**readBufferHndl) == statusTooMany) {
|
||||
InitCursor();
|
||||
AlertWindow(awResource, NULL, authTooManyError);
|
||||
alerted = TRUE;
|
||||
success = FALSE;
|
||||
success = FALSE;
|
||||
goto UnloadCrypto;
|
||||
}
|
||||
/* else */
|
||||
success = FALSE;
|
||||
}
|
||||
/* else */
|
||||
success = FALSE;
|
||||
|
||||
UnloadCrypto:
|
||||
|
||||
HUnlock(readBufferHndl);
|
||||
|
||||
if (startedCrypto) {
|
||||
CryptoShutDown(); /* Shut down Crypto tool set */
|
||||
DisposeHandle(dpSpace);
|
||||
UnloadOneTool(129);
|
||||
CryptoShutDown(); /* Shut down Crypto tool set */
|
||||
DisposeHandle(dpSpace);
|
||||
UnloadOneTool(129);
|
||||
}
|
||||
return success;
|
||||
|
||||
@ -592,15 +592,15 @@ BOOLEAN DoDES (void) {
|
||||
* FinishVNCHandshaking() - Complete VNC protocol initialization
|
||||
**********************************************************************/
|
||||
BOOLEAN FinishVNCHandshaking (void) {
|
||||
#define screenTooBigError 2010
|
||||
unsigned char sharedFlag;
|
||||
unsigned long serverNameLen;
|
||||
#define screenTooBigError 2010
|
||||
unsigned char sharedFlag;
|
||||
unsigned long serverNameLen;
|
||||
unsigned long encodingInfoSize;
|
||||
struct PixelFormat {
|
||||
unsigned char messageType;
|
||||
unsigned char messageType;
|
||||
unsigned char padding1;
|
||||
unsigned int padding2;
|
||||
unsigned char bitsPerPixel;
|
||||
unsigned char bitsPerPixel;
|
||||
unsigned char depth;
|
||||
unsigned char bigEndianFlag;
|
||||
unsigned char trueColorFlag;
|
||||
@ -612,24 +612,24 @@ BOOLEAN FinishVNCHandshaking (void) {
|
||||
unsigned char blueShift;
|
||||
unsigned char padding3;
|
||||
unsigned int padding4;
|
||||
} pixelFormat = {
|
||||
0 /* message type - SetPixelFormat */,
|
||||
0,0 /* padding */,
|
||||
8 /* bpp */,
|
||||
8 /* depth */,
|
||||
0 /* big endian flag - irrelevant */,
|
||||
TRUE /* true color flag */,
|
||||
SwapBytes2(7) /* red-max */,
|
||||
SwapBytes2(7) /* green-max */,
|
||||
SwapBytes2(3) /* blue-max */,
|
||||
0 /* red-shift */,
|
||||
3 /* green-shift */,
|
||||
6 /* blue-shift */,
|
||||
0,0 /* padding */
|
||||
};
|
||||
} pixelFormat = {
|
||||
0 /* message type - SetPixelFormat */,
|
||||
0,0 /* padding */,
|
||||
8 /* bpp */,
|
||||
8 /* depth */,
|
||||
0 /* big endian flag - irrelevant */,
|
||||
TRUE /* true color flag */,
|
||||
SwapBytes2(7) /* red-max */,
|
||||
SwapBytes2(7) /* green-max */,
|
||||
SwapBytes2(3) /* blue-max */,
|
||||
0 /* red-shift */,
|
||||
3 /* green-shift */,
|
||||
6 /* blue-shift */,
|
||||
0,0 /* padding */
|
||||
};
|
||||
|
||||
struct Encodings {
|
||||
unsigned char messageType;
|
||||
struct Encodings {
|
||||
unsigned char messageType;
|
||||
unsigned char padding;
|
||||
unsigned int numberOfEncodings;
|
||||
unsigned long firstEncoding;
|
||||
@ -637,91 +637,91 @@ BOOLEAN FinishVNCHandshaking (void) {
|
||||
unsigned long thirdEncoding;
|
||||
unsigned long fourthEncoding;
|
||||
} encodings = {
|
||||
2, /* Message Type - SetEncodings */
|
||||
0, /* padding */
|
||||
0, /* number of encodings - set below */
|
||||
SwapBytes4(0xffffff21), /* DesktopSize pseudo-encoding */
|
||||
2, /* Message Type - SetEncodings */
|
||||
0, /* padding */
|
||||
0, /* number of encodings - set below */
|
||||
SwapBytes4(0xffffff21), /* DesktopSize pseudo-encoding */
|
||||
SwapBytes4(0xffffff11), /* Cursor pseudo-encoding */
|
||||
SwapBytes4(1), /* CopyRect encoding */
|
||||
SwapBytes4(5) /* Hextile encoding */
|
||||
SwapBytes4(1), /* CopyRect encoding */
|
||||
SwapBytes4(5) /* Hextile encoding */
|
||||
/* Per the spec, raw encoding is supported even though
|
||||
* it is not listed here explicitly.
|
||||
*/
|
||||
};
|
||||
};
|
||||
|
||||
DisplayConnectStatus("\pNegotiating protocol options...", FALSE);
|
||||
|
||||
/* ClientInitialisation */
|
||||
sharedFlag = !!requestSharedSession;
|
||||
if (TCPIPWriteTCP(hostIpid, &sharedFlag, sizeof(sharedFlag), TRUE, FALSE))
|
||||
return FALSE;
|
||||
if (TCPIPWriteTCP(hostIpid, &sharedFlag, sizeof(sharedFlag), TRUE, FALSE))
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
/* ServerInitialisation */
|
||||
if (! DoWaitingReadTCP(2))
|
||||
return FALSE;
|
||||
HLock(readBufferHndl);
|
||||
return FALSE;
|
||||
HLock(readBufferHndl);
|
||||
fbWidth = SwapBytes2(**(unsigned **)readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
if (! DoWaitingReadTCP(2))
|
||||
return FALSE;
|
||||
HLock(readBufferHndl);
|
||||
return FALSE;
|
||||
HLock(readBufferHndl);
|
||||
fbHeight = SwapBytes2(**(unsigned **)readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
|
||||
if ((fbWidth > 16384) || (fbHeight > 16384)) {
|
||||
AlertWindow(awResource, NULL, screenTooBigError);
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Ignore server's pixel format and display name */
|
||||
if (! DoWaitingReadTCP(16))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
if (! DoWaitingReadTCP(4))
|
||||
return FALSE;
|
||||
HLock(readBufferHndl);
|
||||
serverNameLen = SwapBytes4(**(unsigned long **)readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
return FALSE;
|
||||
HLock(readBufferHndl);
|
||||
serverNameLen = SwapBytes4(**(unsigned long **)readBufferHndl);
|
||||
HUnlock(readBufferHndl);
|
||||
if (! DoWaitingReadTCP(serverNameLen))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
if (TCPIPWriteTCP(hostIpid, &pixelFormat.messageType, sizeof(pixelFormat),
|
||||
TRUE, FALSE))
|
||||
return FALSE;
|
||||
TRUE, FALSE))
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
if (useHextile) {
|
||||
encodings.numberOfEncodings = SwapBytes2(4);
|
||||
encodings.numberOfEncodings = SwapBytes2(4);
|
||||
encodingInfoSize = sizeof(encodings);
|
||||
} else {
|
||||
/* No Hextile */
|
||||
encodings.numberOfEncodings = SwapBytes2(3);
|
||||
/* No Hextile */
|
||||
encodings.numberOfEncodings = SwapBytes2(3);
|
||||
encodingInfoSize = sizeof(encodings) - 4;
|
||||
}
|
||||
|
||||
if (TCPIPWriteTCP(hostIpid, &encodings.messageType, encodingInfoSize,
|
||||
TRUE, FALSE))
|
||||
return FALSE;
|
||||
TRUE, FALSE))
|
||||
return FALSE;
|
||||
if (toolerror())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
#undef screenTooBigError
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* CloseTCPConnection() - Close the TCP connection to the host
|
||||
**********************************************************************/
|
||||
void CloseTCPConnection (void) {
|
||||
TCPIPCloseTCP(hostIpid);
|
||||
TCPIPCloseTCP(hostIpid);
|
||||
WaitCursor();
|
||||
DisplayConnectStatus("\pClosing VNC session...", FALSE);
|
||||
do {
|
||||
TCPIPPoll();
|
||||
TCPIPLogout(hostIpid);
|
||||
TCPIPLogout(hostIpid);
|
||||
} while (toolerror() == terrSOCKETOPEN);
|
||||
CloseConnectStatusWindow();
|
||||
InitCursor();
|
||||
|
10
vncsession.h
10
vncsession.h
@ -1,6 +1,6 @@
|
||||
/********************************************************************
|
||||
* vncsession.h - functions for establishing connection to VNC server
|
||||
* and communicating with it
|
||||
* and communicating with it
|
||||
********************************************************************/
|
||||
|
||||
#include <types.h>
|
||||
@ -8,11 +8,11 @@
|
||||
#define RFBVERSIONSTR "RFB 003.003\n"
|
||||
#define RFBMAJORVERSIONSTR "003"
|
||||
|
||||
#define SwapBytes2(x) (((unsigned int)x << 8) | ((unsigned int)x >> 8))
|
||||
#define SwapBytes2(x) (((unsigned int)x << 8) | ((unsigned int)x >> 8))
|
||||
#define SwapBytes4(x) (((unsigned long)x << 24) | \
|
||||
((unsigned long)x >> 24) | \
|
||||
(((unsigned long)x & 0x0000FF00) << 8) | \
|
||||
(((unsigned long)x & 0x00FF0000) >> 8))
|
||||
((unsigned long)x >> 24) | \
|
||||
(((unsigned long)x & 0x0000FF00) << 8) | \
|
||||
(((unsigned long)x & 0x00FF0000) >> 8))
|
||||
|
||||
extern BOOLEAN readError;
|
||||
|
||||
|
482
vncview.cc
482
vncview.cc
@ -37,44 +37,44 @@
|
||||
#include "keyboard.h"
|
||||
#include "clipboard.h"
|
||||
|
||||
#define noMarinettiError 2001
|
||||
#define outOfMemoryError 2002
|
||||
#define noMarinettiError 2001
|
||||
#define outOfMemoryError 2002
|
||||
|
||||
#define disconnectTCPIPAlert 2003
|
||||
#define disconnectTCPIPAlert 2003
|
||||
|
||||
#define NCWindow 1000 /* Offset for "New Connection" */
|
||||
/* window and its controls */
|
||||
#define winNewConnection 1
|
||||
#define btnConnect 1
|
||||
#define btnCancel 2
|
||||
#define linServer 3
|
||||
#define txtServer 4
|
||||
#define txtServerInfo 5
|
||||
#define txtPassword 6
|
||||
#define linPassword 7
|
||||
#define txtDisplay 8
|
||||
#define rectDisplay 9
|
||||
#define txtColor 10
|
||||
#define txtGray 11
|
||||
#define rad320 12
|
||||
#define rad640 13
|
||||
#define chkShared 16
|
||||
#define chkClipboard 17
|
||||
#define txtTransfers 23
|
||||
#define chkEmul3Btn 18
|
||||
#define chkViewOnly 19
|
||||
#define txtPreferredEncoding 24
|
||||
#define radRaw 25
|
||||
#define radHextile 26
|
||||
#define NCWindow 1000 /* Offset for "New Connection" */
|
||||
/* window and its controls */
|
||||
#define winNewConnection 1
|
||||
#define btnConnect 1
|
||||
#define btnCancel 2
|
||||
#define linServer 3
|
||||
#define txtServer 4
|
||||
#define txtServerInfo 5
|
||||
#define txtPassword 6
|
||||
#define linPassword 7
|
||||
#define txtDisplay 8
|
||||
#define rectDisplay 9
|
||||
#define txtColor 10
|
||||
#define txtGray 11
|
||||
#define rad320 12
|
||||
#define rad640 13
|
||||
#define chkShared 16
|
||||
#define chkClipboard 17
|
||||
#define txtTransfers 23
|
||||
#define chkEmul3Btn 18
|
||||
#define chkViewOnly 19
|
||||
#define txtPreferredEncoding 24
|
||||
#define radRaw 25
|
||||
#define radHextile 26
|
||||
|
||||
|
||||
BOOLEAN done = FALSE; /* are we done, yet? */
|
||||
EventRecord myEvent; /* event record for menu mode */
|
||||
GrafPortPtr newConnWindow; /* pointer to new connection window */
|
||||
BOOLEAN vncConnected = FALSE; /* are we connected to a VNC host */
|
||||
int menuOffset; /* Indicates which menu bar is active */
|
||||
Ref startStopParm; /* tool start/shutdown parameter */
|
||||
BOOLEAN colorTablesComplete = FALSE; /* Are the big color tables complete */
|
||||
GrafPortPtr newConnWindow; /* pointer to new connection window */
|
||||
BOOLEAN vncConnected = FALSE; /* are we connected to a VNC host */
|
||||
int menuOffset; /* Indicates which menu bar is active */
|
||||
Ref startStopParm; /* tool start/shutdown parameter */
|
||||
BOOLEAN colorTablesComplete = FALSE; /* Are the big color tables complete */
|
||||
|
||||
|
||||
/* Connection options */
|
||||
@ -95,9 +95,9 @@ char vncPassword[10];
|
||||
#pragma databank 1
|
||||
|
||||
void DrawContents (void) {
|
||||
PenNormal(); /* use a "normal" pen */
|
||||
DrawControls(GetPort()); /* draw controls in window */
|
||||
}
|
||||
PenNormal(); /* use a "normal" pen */
|
||||
DrawControls(GetPort()); /* draw controls in window */
|
||||
}
|
||||
|
||||
#pragma databank 0
|
||||
|
||||
@ -106,12 +106,12 @@ void DrawContents (void) {
|
||||
***************************************************************/
|
||||
|
||||
void DoAbout (void) {
|
||||
#define alertID 1 /* alert string resource ID */
|
||||
#define alertID 1 /* alert string resource ID */
|
||||
|
||||
AlertWindow(awCString+awResource, NULL, alertID);
|
||||
AlertWindow(awCString+awResource, NULL, alertID);
|
||||
|
||||
#undef alertID
|
||||
}
|
||||
#undef alertID
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* DoNewConnection - Show the New Connection window
|
||||
@ -119,183 +119,183 @@ void DoAbout (void) {
|
||||
|
||||
void DoNewConnection (void) {
|
||||
unsigned int masterSCB;
|
||||
|
||||
|
||||
masterSCB = GetMasterSCB();
|
||||
MakeThisCtlTarget(GetCtlHandleFromID(newConnWindow, linServer));
|
||||
ShowWindow(newConnWindow);
|
||||
MakeThisCtlTarget(GetCtlHandleFromID(newConnWindow, linServer));
|
||||
ShowWindow(newConnWindow);
|
||||
SelectWindow(newConnWindow);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* DoClose - Close the frontmost window/connection
|
||||
* Parameters:
|
||||
* wPtr - window to close
|
||||
* wPtr - window to close
|
||||
***************************************************************/
|
||||
|
||||
void DoClose (GrafPortPtr wPtr) {
|
||||
if (wPtr == newConnWindow) {
|
||||
HideWindow(wPtr);
|
||||
}
|
||||
else if (wPtr && vncConnected) { /* Close VNC session window */
|
||||
CloseWindow(wPtr);
|
||||
CloseTCPConnection();
|
||||
vncConnected = FALSE;
|
||||
void DoClose (GrafPortPtr wPtr) {
|
||||
if (wPtr == newConnWindow) {
|
||||
HideWindow(wPtr);
|
||||
}
|
||||
else if (wPtr && vncConnected) { /* Close VNC session window */
|
||||
CloseWindow(wPtr);
|
||||
CloseTCPConnection();
|
||||
vncConnected = FALSE;
|
||||
EnableMItem(fileNewConnection);
|
||||
InitMenus(0);
|
||||
myEvent.wmTaskMask = 0x001F79FF; /* let TaskMaster handle keys again */
|
||||
InitMenus(0);
|
||||
myEvent.wmTaskMask = 0x001F79FF; /* let TaskMaster handle keys again */
|
||||
if (cursor) {
|
||||
InitCursor();
|
||||
InitCursor();
|
||||
free(cursor);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* DoLEEdit - Handle edit menu items for LineEdit controls
|
||||
* Parameters:
|
||||
* editAction: Action selected from edit menu
|
||||
* editAction: Action selected from edit menu
|
||||
***************************************************************/
|
||||
|
||||
void DoLEEdit (int editAction) {
|
||||
CtlRecHndl ctl; /* target control handle */
|
||||
unsigned long id; /* control ID */
|
||||
GrafPortPtr port; /* caller's GrafPort */
|
||||
CtlRecHndl ctl; /* target control handle */
|
||||
unsigned long id; /* control ID */
|
||||
GrafPortPtr port; /* caller's GrafPort */
|
||||
|
||||
port = GetPort();
|
||||
SetPort(newConnWindow);
|
||||
ctl = FindTargetCtl();
|
||||
id = GetCtlID(ctl);
|
||||
if ((id == linServer) || (id == linPassword)) {
|
||||
LEFromScrap();
|
||||
switch (editAction) {
|
||||
case editCut: if (id == linServer) {
|
||||
LECut((LERecHndl) GetCtlTitle(ctl));
|
||||
};
|
||||
port = GetPort();
|
||||
SetPort(newConnWindow);
|
||||
ctl = FindTargetCtl();
|
||||
id = GetCtlID(ctl);
|
||||
if ((id == linServer) || (id == linPassword)) {
|
||||
LEFromScrap();
|
||||
switch (editAction) {
|
||||
case editCut: if (id == linServer) {
|
||||
LECut((LERecHndl) GetCtlTitle(ctl));
|
||||
};
|
||||
LEToScrap();
|
||||
break;
|
||||
case editCopy: if (id == linServer) {
|
||||
LECopy((LERecHndl) GetCtlTitle(ctl));
|
||||
};
|
||||
case editCopy: if (id == linServer) {
|
||||
LECopy((LERecHndl) GetCtlTitle(ctl));
|
||||
};
|
||||
LEToScrap();
|
||||
break;
|
||||
case editPaste: LEPaste((LERecHndl) GetCtlTitle(ctl));
|
||||
break;
|
||||
case editClear: LEDelete((LERecHndl) GetCtlTitle(ctl));
|
||||
break;
|
||||
case editPaste: LEPaste((LERecHndl) GetCtlTitle(ctl));
|
||||
break;
|
||||
case editClear: LEDelete((LERecHndl) GetCtlTitle(ctl));
|
||||
break;
|
||||
};
|
||||
};
|
||||
SetPort(port);
|
||||
}
|
||||
};
|
||||
SetPort(port);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* HandleMenu - Initialize the menu bar.
|
||||
***************************************************************/
|
||||
|
||||
void HandleMenu (void) {
|
||||
int menuNum, menuItemNum; /* menu number & menu item number */
|
||||
int menuNum, menuItemNum; /* menu number & menu item number */
|
||||
|
||||
menuNum = myEvent.wmTaskData >> 16;
|
||||
menuItemNum = myEvent.wmTaskData;
|
||||
switch (menuItemNum) { /* go handle the menu */
|
||||
case appleAbout: DoAbout(); break;
|
||||
menuNum = myEvent.wmTaskData >> 16;
|
||||
menuItemNum = myEvent.wmTaskData;
|
||||
switch (menuItemNum) { /* go handle the menu */
|
||||
case appleAbout: DoAbout(); break;
|
||||
|
||||
case fileNewConnection: DoNewConnection(); break;
|
||||
case fileClose: DoClose(FrontWindow()); break;
|
||||
case fileQuit: Quit(); break;
|
||||
case fileNewConnection: DoNewConnection(); break;
|
||||
case fileClose: DoClose(FrontWindow()); break;
|
||||
case fileQuit: Quit(); break;
|
||||
|
||||
case editCut: DoLEEdit(editCut); break;
|
||||
case editCopy: DoLEEdit(editCopy); break;
|
||||
case editPaste: DoLEEdit(editPaste); break;
|
||||
case editClear: DoLEEdit(editClear); break;
|
||||
case editShowClipboard: ShowClipboard(0x8000, 0); break;
|
||||
case editSendClipboard: DoSendClipboard(); break;
|
||||
}
|
||||
HiliteMenu(FALSE, menuNum); /* unhighlight the menu */
|
||||
}
|
||||
case editCut: DoLEEdit(editCut); break;
|
||||
case editCopy: DoLEEdit(editCopy); break;
|
||||
case editPaste: DoLEEdit(editPaste); break;
|
||||
case editClear: DoLEEdit(editClear); break;
|
||||
case editShowClipboard: ShowClipboard(0x8000, 0); break;
|
||||
case editSendClipboard: DoSendClipboard(); break;
|
||||
}
|
||||
HiliteMenu(FALSE, menuNum); /* unhighlight the menu */
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* HandleControl - Handle a control press in the New Conn. window
|
||||
***************************************************************/
|
||||
|
||||
void HandleControl (void) {
|
||||
switch (myEvent.wmTaskData4) {
|
||||
case btnConnect: DoConnect(); break;
|
||||
case btnCancel: DoClose(newConnWindow); break;
|
||||
case txtColor: SetCtlValueByID(TRUE, newConnWindow,
|
||||
rad320);
|
||||
/* Fall through */
|
||||
case rad320: hRez = 320; /* "320x200" */ break;
|
||||
case txtGray: SetCtlValueByID(TRUE, newConnWindow,
|
||||
rad640);
|
||||
/* Fall through */
|
||||
case rad640: hRez = 640; /* "640x200" */ break;
|
||||
case chkShared: requestSharedSession = !requestSharedSession;
|
||||
break;
|
||||
case chkClipboard: allowClipboardTransfers = !allowClipboardTransfers;
|
||||
break;
|
||||
case chkEmul3Btn: emulate3ButtonMouse = !emulate3ButtonMouse; break;
|
||||
case chkViewOnly: viewOnlyMode = !viewOnlyMode; break;
|
||||
case txtTransfers: allowClipboardTransfers = !allowClipboardTransfers;
|
||||
SetCtlValueByID(allowClipboardTransfers,
|
||||
newConnWindow, chkClipboard); break;
|
||||
case radRaw: useHextile = FALSE; break;
|
||||
case radHextile: useHextile = TRUE; break;
|
||||
switch (myEvent.wmTaskData4) {
|
||||
case btnConnect: DoConnect(); break;
|
||||
case btnCancel: DoClose(newConnWindow); break;
|
||||
case txtColor: SetCtlValueByID(TRUE, newConnWindow,
|
||||
rad320);
|
||||
/* Fall through */
|
||||
case rad320: hRez = 320; /* "320x200" */ break;
|
||||
case txtGray: SetCtlValueByID(TRUE, newConnWindow,
|
||||
rad640);
|
||||
/* Fall through */
|
||||
case rad640: hRez = 640; /* "640x200" */ break;
|
||||
case chkShared: requestSharedSession = !requestSharedSession;
|
||||
break;
|
||||
case chkClipboard: allowClipboardTransfers = !allowClipboardTransfers;
|
||||
break;
|
||||
case chkEmul3Btn: emulate3ButtonMouse = !emulate3ButtonMouse; break;
|
||||
case chkViewOnly: viewOnlyMode = !viewOnlyMode; break;
|
||||
case txtTransfers: allowClipboardTransfers = !allowClipboardTransfers;
|
||||
SetCtlValueByID(allowClipboardTransfers,
|
||||
newConnWindow, chkClipboard); break;
|
||||
case radRaw: useHextile = FALSE; break;
|
||||
case radHextile: useHextile = TRUE; break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* InitMenus - Initialize the menu bar.
|
||||
***************************************************************/
|
||||
|
||||
void InitMenus (int offset) {
|
||||
#define menuID 1 /* menu bar resource ID */
|
||||
#define menuID 1 /* menu bar resource ID */
|
||||
|
||||
int height; /* height of the largest menu */
|
||||
MenuBarRecHndl menuBarHand = 0; /* for 'handling' the menu bar */
|
||||
int height; /* height of the largest menu */
|
||||
MenuBarRecHndl menuBarHand = 0; /* for 'handling' the menu bar */
|
||||
MenuBarRecHndl oldMenuBarHand;
|
||||
/* create the menu bar */
|
||||
oldMenuBarHand = menuBarHand;
|
||||
menuBarHand = NewMenuBar2(refIsResource, menuID+offset, NULL);
|
||||
SetSysBar(menuBarHand);
|
||||
SetMenuBar(NULL);
|
||||
FixAppleMenu(1); /* add desk accessories */
|
||||
height = FixMenuBar(); /* draw the completed menu bar */
|
||||
DrawMenuBar();
|
||||
if (oldMenuBarHand)
|
||||
DisposeHandle((Handle) oldMenuBarHand);
|
||||
/* create the menu bar */
|
||||
oldMenuBarHand = menuBarHand;
|
||||
menuBarHand = NewMenuBar2(refIsResource, menuID+offset, NULL);
|
||||
SetSysBar(menuBarHand);
|
||||
SetMenuBar(NULL);
|
||||
FixAppleMenu(1); /* add desk accessories */
|
||||
height = FixMenuBar(); /* draw the completed menu bar */
|
||||
DrawMenuBar();
|
||||
if (oldMenuBarHand)
|
||||
DisposeHandle((Handle) oldMenuBarHand);
|
||||
|
||||
menuOffset = offset; /* So we can tell which menu is active */
|
||||
menuOffset = offset; /* So we can tell which menu is active */
|
||||
|
||||
#undef menuID
|
||||
}
|
||||
#undef menuID
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* CheckMenus - Check the menus to see if they should be dimmed
|
||||
***************************************************************/
|
||||
|
||||
void CheckMenus (void) {
|
||||
GrafPortPtr activeWindow; /* Front visible window */
|
||||
GrafPortPtr activeWindow; /* Front visible window */
|
||||
static GrafPortPtr lastActiveWindow;
|
||||
|
||||
activeWindow = FrontWindow();
|
||||
activeWindow = FrontWindow();
|
||||
|
||||
/* Speed up common case (no change since last time) */
|
||||
if (activeWindow == lastActiveWindow)
|
||||
return;
|
||||
return;
|
||||
|
||||
lastActiveWindow = activeWindow;
|
||||
|
||||
if (activeWindow) {
|
||||
if (GetSysWFlag(activeWindow)) { /* NDA window is active */
|
||||
EnableMItem(fileClose);
|
||||
EnableMItem(editUndo);
|
||||
if (activeWindow) {
|
||||
if (GetSysWFlag(activeWindow)) { /* NDA window is active */
|
||||
EnableMItem(fileClose);
|
||||
EnableMItem(editUndo);
|
||||
EnableMItem(editCut);
|
||||
EnableMItem(editCopy);
|
||||
EnableMItem(editPaste);
|
||||
EnableMItem(editClear);
|
||||
}
|
||||
else if (activeWindow == newConnWindow) { /* New Connection window */
|
||||
EnableMItem(fileClose);
|
||||
EnableMItem(fileClose);
|
||||
DisableMItem(editUndo);
|
||||
EnableMItem(editCut);
|
||||
EnableMItem(editCopy);
|
||||
@ -303,117 +303,117 @@ void CheckMenus (void) {
|
||||
EnableMItem(editClear);
|
||||
}
|
||||
else if (activeWindow == vncWindow) {
|
||||
DisableMItem(editUndo);
|
||||
DisableMItem(editCopy);
|
||||
DisableMItem(editCut);
|
||||
DisableMItem(editPaste);
|
||||
DisableMItem(editClear);
|
||||
}
|
||||
DisableMItem(editUndo);
|
||||
DisableMItem(editCopy);
|
||||
DisableMItem(editCut);
|
||||
DisableMItem(editPaste);
|
||||
DisableMItem(editClear);
|
||||
}
|
||||
}
|
||||
else { /* no editable window on top */
|
||||
else { /* no editable window on top */
|
||||
DisableMItem(fileClose);
|
||||
DisableMItem(editUndo);
|
||||
DisableMItem(editCut);
|
||||
DisableMItem(editCopy);
|
||||
DisableMItem(editPaste);
|
||||
DisableMItem(editClear);
|
||||
};
|
||||
DisableMItem(editUndo);
|
||||
DisableMItem(editCut);
|
||||
DisableMItem(editCopy);
|
||||
DisableMItem(editPaste);
|
||||
DisableMItem(editClear);
|
||||
};
|
||||
|
||||
if (vncConnected) { /* VNC connection present */
|
||||
DisableMItem(fileNewConnection);
|
||||
EnableMItem(fileClose);
|
||||
if (vncConnected) { /* VNC connection present */
|
||||
DisableMItem(fileNewConnection);
|
||||
EnableMItem(fileClose);
|
||||
if (viewOnlyMode)
|
||||
DisableMItem(editSendClipboard);
|
||||
DisableMItem(editSendClipboard);
|
||||
else
|
||||
EnableMItem(editSendClipboard);
|
||||
}
|
||||
else {
|
||||
DisableMItem(editSendClipboard);
|
||||
}
|
||||
}
|
||||
EnableMItem(editSendClipboard);
|
||||
}
|
||||
else {
|
||||
DisableMItem(editSendClipboard);
|
||||
}
|
||||
}
|
||||
|
||||
/* InitScreen - Set up color tables and SCBs to appropriate values
|
||||
*/
|
||||
void InitScreen (void) {
|
||||
static ColorTable gray640Colors = {
|
||||
0x0000, 0x0555, 0x0AAA, 0x0FFF, 0x0000, 0x0555, 0x0AAA, 0x0FFF,
|
||||
0x0000, 0x0555, 0x0AAA, 0x0FFF, 0x0000, 0x0555, 0x0AAA, 0x0FFF,
|
||||
0x0000, 0x0555, 0x0AAA, 0x0FFF, 0x0000, 0x0555, 0x0AAA, 0x0FFF
|
||||
};
|
||||
};
|
||||
|
||||
/* Apple menu uses color tables 1 through 6 */
|
||||
SetColorTable(7, &gray640Colors);
|
||||
SetAllSCBs(0x87); /* 640 mode with gray640Colors */
|
||||
InitPalette(); /* Restore Apple Menu colors */
|
||||
SetColorTable(7, &gray640Colors);
|
||||
SetAllSCBs(0x87); /* 640 mode with gray640Colors */
|
||||
InitPalette(); /* Restore Apple Menu colors */
|
||||
}
|
||||
|
||||
void Quit (void) {
|
||||
/* Done with event loop - now quitting */
|
||||
if (vncConnected) /* Disconnect if still connected */
|
||||
CloseTCPConnection();
|
||||
if (vncConnected) /* Disconnect if still connected */
|
||||
CloseTCPConnection();
|
||||
|
||||
if (readBufferHndl)
|
||||
DisposeHandle(readBufferHndl); /* Get rid of TCPIP read buffer hndl */
|
||||
DisposeHandle(readBufferHndl); /* Get rid of TCPIP read buffer hndl */
|
||||
|
||||
if (bigcoltab320)
|
||||
free(bigcoltab320);
|
||||
free(bigcoltab320);
|
||||
if (bigcoltab640a)
|
||||
free(bigcoltab640a);
|
||||
free(bigcoltab640a);
|
||||
if (bigcoltab640b)
|
||||
free(bigcoltab640b);
|
||||
free(bigcoltab640b);
|
||||
if (cursor)
|
||||
free(cursor);
|
||||
free(cursor);
|
||||
|
||||
/* Ask the user if we should disconnect only if the connection */
|
||||
/* is not "permanent," i.e. started when the system boots up. */
|
||||
if (TCPIPGetConnectStatus() && (!TCPIPGetBootConnectFlag()))
|
||||
if (AlertWindow(awResource+awButtonLayout, NULL, disconnectTCPIPAlert))
|
||||
{
|
||||
/* Ask the user if we should disconnect only if the connection */
|
||||
/* is not "permanent," i.e. started when the system boots up. */
|
||||
if (TCPIPGetConnectStatus() && (!TCPIPGetBootConnectFlag()))
|
||||
if (AlertWindow(awResource+awButtonLayout, NULL, disconnectTCPIPAlert))
|
||||
{
|
||||
WaitCursor();
|
||||
/* Must use force flag below because Marinetti will still count
|
||||
* our ipid as logged in (proventing non-forced disconnect)
|
||||
* for several minutes after the TCPIPLogout call. */
|
||||
TCPIPDisconnect(TRUE, &DisplayConnectStatus);
|
||||
if (connectStatusWindowPtr != NULL)
|
||||
CloseWindow(connectStatusWindowPtr);
|
||||
if (connectStatusWindowPtr != NULL)
|
||||
CloseWindow(connectStatusWindowPtr);
|
||||
}
|
||||
|
||||
UnloadScrap(); /* Save scrap to disk */
|
||||
UnloadScrap(); /* Save scrap to disk */
|
||||
|
||||
TCPIPShutDown(); /* Shut down Marinetti */
|
||||
UnloadOneTool(54);
|
||||
ShutDownTools(1, startStopParm); /* shut down the tools */
|
||||
TCPIPShutDown(); /* Shut down Marinetti */
|
||||
UnloadOneTool(54);
|
||||
ShutDownTools(1, startStopParm); /* shut down the tools */
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* Main - Initial startup function
|
||||
***************************************************************/
|
||||
|
||||
int main (void) {
|
||||
int event; /* event type returned by TaskMaster */
|
||||
int event; /* event type returned by TaskMaster */
|
||||
|
||||
#define wrNum 1001 /* New Conn. window resource number */
|
||||
#define wrNum 1001 /* New Conn. window resource number */
|
||||
|
||||
startStopParm = /* start up the tools */
|
||||
StartUpTools(userid(), 2, 1);
|
||||
if (toolerror() != 0) {
|
||||
GrafOff();
|
||||
SysFailMgr(toolerror(), "\pCould not start tools: ");
|
||||
startStopParm = /* start up the tools */
|
||||
StartUpTools(userid(), 2, 1);
|
||||
if (toolerror() != 0) {
|
||||
GrafOff();
|
||||
SysFailMgr(toolerror(), "\pCould not start tools: ");
|
||||
}
|
||||
|
||||
readBufferHndl = NewHandle(1, userid(), 0, NULL);
|
||||
|
||||
LoadOneTool(54, 0x200); /* load Marinetti 2.0+ */
|
||||
if (toolerror()) { /* Check that Marinetti is available */
|
||||
SysBeep(); /* Can't load Marinetti.. */
|
||||
InitCursor(); /* Activate pointer cursor */
|
||||
AlertWindow(awResource, NULL, noMarinettiError);
|
||||
Quit(); /* Can't proceed, so just quit */
|
||||
}
|
||||
else /* Marinetti loaded successfully */
|
||||
TCPIPStartUp(); /* ... so activate it now */
|
||||
|
||||
LoadOneTool(54, 0x200); /* load Marinetti 2.0+ */
|
||||
if (toolerror()) { /* Check that Marinetti is available */
|
||||
SysBeep(); /* Can't load Marinetti.. */
|
||||
InitCursor(); /* Activate pointer cursor */
|
||||
AlertWindow(awResource, NULL, noMarinettiError);
|
||||
Quit(); /* Can't proceed, so just quit */
|
||||
}
|
||||
else /* Marinetti loaded successfully */
|
||||
TCPIPStartUp(); /* ... so activate it now */
|
||||
|
||||
if (toolerror()) { /* Get handle for TCPIP read buffer */
|
||||
if (toolerror()) { /* Get handle for TCPIP read buffer */
|
||||
SysBeep();
|
||||
InitCursor();
|
||||
AlertWindow(awResource, NULL, outOfMemoryError);
|
||||
@ -427,50 +427,50 @@ int main (void) {
|
||||
Quit();
|
||||
}
|
||||
|
||||
InitScreen(); /* Set up color tables */
|
||||
InitScreen(); /* Set up color tables */
|
||||
|
||||
LoadScrap(); /* put scrap in memory */
|
||||
InitMenus(0); /* set up the menu bar */
|
||||
InitCursor(); /* start the arrow cursor */
|
||||
LoadScrap(); /* put scrap in memory */
|
||||
InitMenus(0); /* set up the menu bar */
|
||||
InitCursor(); /* start the arrow cursor */
|
||||
|
||||
vncConnected = FALSE; /* Initially not connected */
|
||||
vncConnected = FALSE; /* Initially not connected */
|
||||
|
||||
newConnWindow = NewWindow2("\p New VNC Connection ", 0,
|
||||
DrawContents, NULL, 0x02, wrNum, rWindParam1);
|
||||
#undef wrNum
|
||||
newConnWindow = NewWindow2("\p New VNC Connection ", 0,
|
||||
DrawContents, NULL, 0x02, wrNum, rWindParam1);
|
||||
#undef wrNum
|
||||
|
||||
DoNewConnection(); /* Display new connection window */
|
||||
DoNewConnection(); /* Display new connection window */
|
||||
|
||||
/* main event loop */
|
||||
myEvent.wmTaskMask = 0x001F79FF; /* let TaskMaster do everything needed */
|
||||
while (!done) {
|
||||
CheckMenus();
|
||||
/* main event loop */
|
||||
myEvent.wmTaskMask = 0x001F79FF; /* let TaskMaster do everything needed */
|
||||
while (!done) {
|
||||
CheckMenus();
|
||||
event = TaskMaster(everyEvent, &myEvent);
|
||||
if (vncConnected)
|
||||
SendModifiers();
|
||||
SendModifiers();
|
||||
switch (event) {
|
||||
case wInSpecial:
|
||||
case wInMenuBar: HandleMenu();
|
||||
break;
|
||||
case wInGoAway: DoClose((GrafPortPtr) myEvent.wmTaskData);
|
||||
break;
|
||||
case wInControl: HandleControl();
|
||||
break;
|
||||
case wInContent: if (vncWindow && ((GrafPortPtr)
|
||||
myEvent.wmTaskData == vncWindow))
|
||||
DoPointerEvent();
|
||||
case wInSpecial:
|
||||
case wInMenuBar: HandleMenu();
|
||||
break;
|
||||
case wInGoAway: DoClose((GrafPortPtr) myEvent.wmTaskData);
|
||||
break;
|
||||
case wInControl: HandleControl();
|
||||
break;
|
||||
case wInContent: if (vncWindow && ((GrafPortPtr)
|
||||
myEvent.wmTaskData == vncWindow))
|
||||
DoPointerEvent();
|
||||
break;
|
||||
case nullEvt: if (vncConnected) DoPointerEvent();
|
||||
break;
|
||||
case nullEvt: if (vncConnected) DoPointerEvent();
|
||||
break;
|
||||
case keyDownEvt:
|
||||
case autoKeyEvt: ProcessKeyEvent();
|
||||
case autoKeyEvt: ProcessKeyEvent();
|
||||
}
|
||||
if (vncConnected)
|
||||
ConnectedEventLoop();
|
||||
ConnectedEventLoop();
|
||||
else if (colorTablesComplete == FALSE)
|
||||
if (MakeBigColorTables(256))
|
||||
colorTablesComplete = TRUE;
|
||||
if (MakeBigColorTables(256))
|
||||
colorTablesComplete = TRUE;
|
||||
}
|
||||
|
||||
Quit();
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ extern unsigned long deleteKeysym;
|
||||
extern char vncServer[257];
|
||||
extern char vncPassword[10];
|
||||
|
||||
extern EventRecord myEvent; /* Event Record for TaskMaster */
|
||||
extern BOOLEAN vncConnected; /* Is the GS desktop active */
|
||||
extern BOOLEAN colorTablesComplete; /* Are the color tables complete */
|
||||
extern EventRecord myEvent; /* Event Record for TaskMaster */
|
||||
extern BOOLEAN vncConnected; /* Is the GS desktop active */
|
||||
extern BOOLEAN colorTablesComplete; /* Are the color tables complete */
|
||||
|
||||
extern void DoClose (GrafPortPtr wPtr);
|
||||
extern void DrawContents (void);
|
||||
|
612
vncview.rez
612
vncview.rez
@ -6,69 +6,69 @@
|
||||
|
||||
/*- Constants --------------------------------------------------*/
|
||||
|
||||
#define appleMenu 1
|
||||
#define fileMenu 2
|
||||
#define editMenu 3
|
||||
#define editUndo 250
|
||||
#define editCut 251
|
||||
#define editCopy 252
|
||||
#define editPaste 253
|
||||
#define editClear 254
|
||||
#define editSendClipboard 262
|
||||
#define editShowClipboard 261
|
||||
#define appleMenu 1
|
||||
#define fileMenu 2
|
||||
#define editMenu 3
|
||||
#define editUndo 250
|
||||
#define editCut 251
|
||||
#define editCopy 252
|
||||
#define editPaste 253
|
||||
#define editClear 254
|
||||
#define editSendClipboard 262
|
||||
#define editShowClipboard 261
|
||||
#define fileNewConnection 260
|
||||
#define fileClose 255
|
||||
#define fileQuit 256
|
||||
#define appleAbout 257
|
||||
#define fileClose 255
|
||||
#define fileQuit 256
|
||||
#define appleAbout 257
|
||||
|
||||
#define noKB 100
|
||||
#define noKB 100
|
||||
|
||||
#define noMarinettiError 2001
|
||||
#define outOfMemoryError 2002
|
||||
#define noMarinettiError 2001
|
||||
#define outOfMemoryError 2002
|
||||
|
||||
#define disconnectTCPIPAlert 2003
|
||||
#define connectionFailedAlert 2004
|
||||
#define noCryptoError 2005
|
||||
#define authFailedError 2006
|
||||
#define authTooManyError 2007
|
||||
#define badRFBVersionAlert 2008
|
||||
#define badAuthTypeAlert 2009
|
||||
#define screenTooBigError 2010
|
||||
#define noTCPIPConnectionError 2011
|
||||
#define badGetIpidError 2012
|
||||
#define badOptionNegotiationError 2013
|
||||
#define badHandshakingError 2014
|
||||
#define badReadTCPError 2015
|
||||
#define disconnectTCPIPAlert 2003
|
||||
#define connectionFailedAlert 2004
|
||||
#define noCryptoError 2005
|
||||
#define authFailedError 2006
|
||||
#define authTooManyError 2007
|
||||
#define badRFBVersionAlert 2008
|
||||
#define badAuthTypeAlert 2009
|
||||
#define screenTooBigError 2010
|
||||
#define noTCPIPConnectionError 2011
|
||||
#define badGetIpidError 2012
|
||||
#define badOptionNegotiationError 2013
|
||||
#define badHandshakingError 2014
|
||||
#define badReadTCPError 2015
|
||||
|
||||
#define linedColors 1
|
||||
#define linedColors 1
|
||||
|
||||
#define NCWindow 1000 /* Offset for "New Connection" */
|
||||
/* window and its controls */
|
||||
#define NCWindow 1000 /* Offset for "New Connection" */
|
||||
/* window and its controls */
|
||||
|
||||
#define VNCWindow 3000
|
||||
#define VNCWindow 3000
|
||||
|
||||
#define winNewConnection 1
|
||||
#define btnConnect 1
|
||||
#define btnCancel 2
|
||||
#define linServer 3
|
||||
#define txtServer 4
|
||||
#define txtServerInfo 5
|
||||
#define txtPassword 6
|
||||
#define linPassword 7
|
||||
#define txtDisplay 8
|
||||
#define rectDisplay 9
|
||||
#define txtColor 10
|
||||
#define txtGray 11
|
||||
#define rad320 12
|
||||
#define rad640 13
|
||||
#define chkShared 16
|
||||
#define chkClipboard 17
|
||||
#define txtTransfers 23
|
||||
#define chkEmul3Btn 18
|
||||
#define chkViewOnly 19
|
||||
#define txtPreferredEncoding 24
|
||||
#define radRaw 25
|
||||
#define radHextile 26
|
||||
#define winNewConnection 1
|
||||
#define btnConnect 1
|
||||
#define btnCancel 2
|
||||
#define linServer 3
|
||||
#define txtServer 4
|
||||
#define txtServerInfo 5
|
||||
#define txtPassword 6
|
||||
#define linPassword 7
|
||||
#define txtDisplay 8
|
||||
#define rectDisplay 9
|
||||
#define txtColor 10
|
||||
#define txtGray 11
|
||||
#define rad320 12
|
||||
#define rad640 13
|
||||
#define chkShared 16
|
||||
#define chkClipboard 17
|
||||
#define txtTransfers 23
|
||||
#define chkEmul3Btn 18
|
||||
#define chkViewOnly 19
|
||||
#define txtPreferredEncoding 24
|
||||
#define radRaw 25
|
||||
#define radHextile 26
|
||||
|
||||
/*- Tools ------------------------------------------------------*/
|
||||
|
||||
@ -204,7 +204,7 @@ resource rMenuItem (editSendClipboard) {
|
||||
editSendClipboard
|
||||
};
|
||||
|
||||
resource rMenuItem (fileNewConnection) { /* New menu item */
|
||||
resource rMenuItem (fileNewConnection) { /* New menu item */
|
||||
fileNewConnection, /* menu item ID */
|
||||
"N","n", /* key equivalents */
|
||||
0, /* check character */
|
||||
@ -217,7 +217,7 @@ resource rMenuItem (fileClose) { /* Close menu item */
|
||||
"W","w", /* key equivalents */
|
||||
0, /* check character */
|
||||
refIsResource*itemTitleRefShift /* flags */
|
||||
+ fDivider,
|
||||
+ fDivider,
|
||||
fileClose /* menu item title resource ID */
|
||||
};
|
||||
|
||||
@ -248,11 +248,11 @@ resource rPString (editCopy, noCrossBank) {"Copy"};
|
||||
resource rPString (editPaste, noCrossBank) {"Paste"};
|
||||
resource rPString (editClear, noCrossBank) {"Clear"};
|
||||
resource rPString (editShowClipboard, noCrossBank)
|
||||
{"Show Clipboard"};
|
||||
{"Show Clipboard"};
|
||||
resource rPString (editSendClipboard, noCrossBank)
|
||||
{"Send Clipboard"};
|
||||
{"Send Clipboard"};
|
||||
resource rPString (fileNewConnection, noCrossBank)
|
||||
{"New Connection..."};
|
||||
{"New Connection..."};
|
||||
resource rPString (fileClose, noCrossBank) {"Close"};
|
||||
resource rPString (fileQuit, noCrossBank) {"Quit"};
|
||||
resource rPString (appleAbout, noCrossBank) {"About VNCview GS..."};
|
||||
@ -330,7 +330,7 @@ resource rMenuItem (editPaste+noKB) { /* Paste menu item */
|
||||
editPaste /* menu item title resource ID */
|
||||
};
|
||||
|
||||
resource rMenuItem (fileNewConnection+noKB) { /* New menu item */
|
||||
resource rMenuItem (fileNewConnection+noKB) { /* New menu item */
|
||||
fileNewConnection, /* menu item ID */
|
||||
"","", /* key equivalents */
|
||||
0, /* check character */
|
||||
@ -343,7 +343,7 @@ resource rMenuItem (fileClose+noKB) { /* Close menu item */
|
||||
"","", /* key equivalents */
|
||||
0, /* check character */
|
||||
refIsResource*itemTitleRefShift /* flags */
|
||||
+ fDivider,
|
||||
+ fDivider,
|
||||
fileClose /* menu item title resource ID */
|
||||
};
|
||||
|
||||
@ -370,26 +370,26 @@ resource rAlertString (1) {
|
||||
/*- Resources used by Finder, etc. -----------------------------*/
|
||||
|
||||
resource rVersion (1) {
|
||||
{
|
||||
1,0,0, /* Version number */
|
||||
{
|
||||
1,0,0, /* Version number */
|
||||
beta, 1, /* Release version */
|
||||
},
|
||||
verUS, /* Region code */
|
||||
"VNCview GS", /* Title */
|
||||
verUS, /* Region code */
|
||||
"VNCview GS", /* Title */
|
||||
"Copyright \$A9 2002\$D12004\n"
|
||||
"by Stephen Heumann"
|
||||
};
|
||||
|
||||
resource rBundle (1, preload, nospecialmemory) {
|
||||
1, /* Icon ID */
|
||||
1, /* rBundle ID */
|
||||
{ /* OneDoc structure to match the program */
|
||||
{
|
||||
$81,
|
||||
1, /* Icon ID */
|
||||
1, /* rBundle ID */
|
||||
{ /* OneDoc structure to match the program */
|
||||
{
|
||||
$81,
|
||||
{0},
|
||||
{1},
|
||||
{2}
|
||||
},
|
||||
},
|
||||
$00000005,
|
||||
matchFileType {{$B3}},
|
||||
empty {},
|
||||
@ -403,172 +403,172 @@ resource rBundle (1, preload, nospecialmemory) {
|
||||
empty {},
|
||||
empty {},
|
||||
empty {}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
resource rIcon (1, preload, nospecialmemory) {
|
||||
$8000,
|
||||
22,
|
||||
24,
|
||||
$"000000000000000000000000"
|
||||
$"0F8EFF00F0FF00F0F0FFFFF0"
|
||||
$8000,
|
||||
22,
|
||||
24,
|
||||
$"000000000000000000000000"
|
||||
$"0F8EFF00F0FF00F0F0FFFFF0"
|
||||
$"0F45FF0F000F0F00F0FFFFF0"
|
||||
$"000000000000000000000000"
|
||||
$"0F99FF00FFF0F00FFFFFF0F0"
|
||||
$"0F99FF0F0F00F0FFFFFFF030"
|
||||
$"0F99FF0F0F00F0FFFFFFF030"
|
||||
$"0000000000000000000000F0"
|
||||
$"0999999999999999999990F0"
|
||||
$"099FFFF000F0F00FFF999030"
|
||||
$"09FFFFFFFFFFFFFFFFF99030"
|
||||
$"09FFFFFFFFFFFFFFFFF99030"
|
||||
$"09F88FFFFF88F1111FF99030"
|
||||
$"09FF88FFF88FF1FFF1F99030"
|
||||
$"09FF88FFF88FF1FFF1F99030"
|
||||
$"09FFF88F88FFFFFFFFF99030"
|
||||
$"09FFF88F88FFFFFFFFF99030"
|
||||
$"09FFF88F88FFFF4444F99030"
|
||||
$"09FFFF888FFFF4FFFFF99030"
|
||||
$"09FFFF888FFFF4FFFFF99030"
|
||||
$"09FFFFF8FFFFFF4444F99030"
|
||||
$"09FFFFF8FFFFFF4444F99030"
|
||||
$"09FFFFFFFFFFFFFFFFF990F0"
|
||||
$"000000000000000000000000"
|
||||
$"0F3FFFFFF33333333333F0F0"
|
||||
$"000000000000000000000000",
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
$"FFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
};
|
||||
|
||||
resource rIcon (2, preload, nospecialmemory) {
|
||||
0x8000,
|
||||
8,
|
||||
8,
|
||||
$"F8F8F11F"
|
||||
$"F8F8F1F1"
|
||||
$"F8F8F1F1"
|
||||
$"F8F8FFFF"
|
||||
$"F8F8FF44"
|
||||
$"F8F8F4FF"
|
||||
$"FF8FF4FF"
|
||||
$"FF8FFF44",
|
||||
$"0F0F0FF0"
|
||||
$"0F0F0F0F"
|
||||
$"0F0F0F0F"
|
||||
$"0F0F0000"
|
||||
$"0F0F00FF"
|
||||
$"0F0F0F00"
|
||||
$"00F00F00"
|
||||
$"00F000FF"
|
||||
0x8000,
|
||||
8,
|
||||
8,
|
||||
$"F8F8F11F"
|
||||
$"F8F8F1F1"
|
||||
$"F8F8F1F1"
|
||||
$"F8F8FFFF"
|
||||
$"F8F8FF44"
|
||||
$"F8F8F4FF"
|
||||
$"FF8FF4FF"
|
||||
$"FF8FFF44",
|
||||
$"0F0F0FF0"
|
||||
$"0F0F0F0F"
|
||||
$"0F0F0F0F"
|
||||
$"0F0F0000"
|
||||
$"0F0F00FF"
|
||||
$"0F0F0F00"
|
||||
$"00F00F00"
|
||||
$"00F000FF"
|
||||
};
|
||||
|
||||
|
||||
/*- Error handler ----------------------------------------------*/
|
||||
|
||||
resource rAlertString (noMarinettiError) {
|
||||
"42:"
|
||||
"Could not load the Marinetti TCP/IP stack. Please ensure that "
|
||||
"you have Marinetti 2.0 or later installed on this computer."
|
||||
":^#5\$00";
|
||||
};
|
||||
"42:"
|
||||
"Could not load the Marinetti TCP/IP stack. Please ensure that "
|
||||
"you have Marinetti 2.0 or later installed on this computer."
|
||||
":^#5\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (noCryptoError) {
|
||||
"42:"
|
||||
"42:"
|
||||
"Could not load the Crypto tool set. Please install the crypto "
|
||||
"tool set version 1.0 or later to use passwords in VNCview GS."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (outOfMemoryError) {
|
||||
"42:"
|
||||
"Could not allocate sufficient memory. Please reduce memory "
|
||||
"usage and run VNCview GS again."
|
||||
":^#5\$00";
|
||||
};
|
||||
"42:"
|
||||
"Could not allocate sufficient memory. Please reduce memory "
|
||||
"usage and run VNCview GS again."
|
||||
":^#5\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (disconnectTCPIPAlert) {
|
||||
"20:"
|
||||
"20:"
|
||||
"Do you want to disconnect your TCP/IP connection?"
|
||||
":^#3:#2\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (authFailedError) {
|
||||
"52:"
|
||||
"52:"
|
||||
"Authentication failed. Please re-type your password and try again."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (authTooManyError) {
|
||||
"72:"
|
||||
"Authentication has failed too many times. Please check that you are "
|
||||
"72:"
|
||||
"Authentication has failed too many times. Please check that you are "
|
||||
"using the correct password and wait a while before connecting again."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (connectionFailedAlert) {
|
||||
"92;"
|
||||
"92;"
|
||||
"Connection failed:\n"
|
||||
"*0"
|
||||
";^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (badRFBVersionAlert) {
|
||||
"42:"
|
||||
"42:"
|
||||
"The server reported an RFB protocal version incompatible with VNCview "
|
||||
"GS or is not an RFB server."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (badAuthTypeAlert) {
|
||||
"42:"
|
||||
"42:"
|
||||
"The connection failed because the server requested an authentication "
|
||||
"type not recognized by VNCview GS."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (noTCPIPConnectionError) {
|
||||
"32:"
|
||||
"32:"
|
||||
"A TCP/IP connection could not be established."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (badGetIpidError) {
|
||||
"42:"
|
||||
"42:"
|
||||
"There was an error while resolving the hostname you provided or "
|
||||
"preparing to connect to it."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (badOptionNegotiationError) {
|
||||
"32:"
|
||||
"32:"
|
||||
"There was an error while negotiating protocol options."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (badHandshakingError) {
|
||||
"32:"
|
||||
"32:"
|
||||
"There was an error while establishing a VNC connection with the server."
|
||||
":^#6\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (screenTooBigError) {
|
||||
"72:"
|
||||
"72:"
|
||||
"The server's framebuffer resolution is too big for VNCview GS. "
|
||||
"VNCview GS does not support resolutions greater than 16,384 by 16,384."
|
||||
":^#6\$00";
|
||||
@ -576,7 +576,7 @@ resource rAlertString (screenTooBigError) {
|
||||
|
||||
#if 0
|
||||
resource rAlertString (badReadTCPError) {
|
||||
"72:"
|
||||
"72:"
|
||||
"The TCP/IP stack did not return the amount of data expected. This "
|
||||
"may be indicative of a bug in Marinetti or in the VNC server software."
|
||||
":^#6\$00";
|
||||
@ -584,7 +584,7 @@ resource rAlertString (badReadTCPError) {
|
||||
#endif
|
||||
|
||||
resource rAlertString (10000) {
|
||||
"72:"
|
||||
"72:"
|
||||
"*0"
|
||||
":^#6\$00";
|
||||
};
|
||||
@ -592,28 +592,28 @@ resource rAlertString (10000) {
|
||||
/*- New VNC Connection window resources ----------------------------------*/
|
||||
|
||||
resource rWindParam1 (NCWindow+winNewConnection) {
|
||||
fTitle+fClose+fFlex+fMove, /* wFrameBits */
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0,0,0,0}, /* ZoomRect */
|
||||
nil, /* wColor ID */
|
||||
{0,0}, /* Origin */
|
||||
{0,0}, /* data size */
|
||||
{0,0}, /* max height-width */
|
||||
{0,0}, /* scroll vertical, horizontal */
|
||||
{0,0}, /* page vertical, horizontal */
|
||||
0, /* wInfoRefCon */
|
||||
0, /* wInfoHeight */
|
||||
{40,162,181,478}, /* wPosition */
|
||||
infront, /* wPlane */
|
||||
NCWindow+winNewConnection, /* wStorage */
|
||||
$0009 /* wInVerb */
|
||||
fTitle+fClose+fFlex+fMove, /* wFrameBits */
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0,0,0,0}, /* ZoomRect */
|
||||
nil, /* wColor ID */
|
||||
{0,0}, /* Origin */
|
||||
{0,0}, /* data size */
|
||||
{0,0}, /* max height-width */
|
||||
{0,0}, /* scroll vertical, horizontal */
|
||||
{0,0}, /* page vertical, horizontal */
|
||||
0, /* wInfoRefCon */
|
||||
0, /* wInfoHeight */
|
||||
{40,162,181,478}, /* wPosition */
|
||||
infront, /* wPlane */
|
||||
NCWindow+winNewConnection, /* wStorage */
|
||||
$0009 /* wInVerb */
|
||||
};
|
||||
|
||||
resource rControlList (NCWindow+winNewConnection) {{
|
||||
NCWindow+btnConnect,
|
||||
NCWindow+btnConnect,
|
||||
NCWindow+btnCancel,
|
||||
NCWindow+linServer,
|
||||
NCWindow+linServer,
|
||||
NCWindow+txtServer,
|
||||
NCWindow+txtServerInfo,
|
||||
NCWindow+txtPassword,
|
||||
@ -635,267 +635,267 @@ resource rControlList (NCWindow+winNewConnection) {{
|
||||
}};
|
||||
|
||||
resource rControlTemplate (NCWindow+btnConnect) {
|
||||
btnConnect, /* Control ID */
|
||||
{121,217,0,0}, /* Control Rect */
|
||||
btnConnect, /* Control ID */
|
||||
{121,217,0,0}, /* Control Rect */
|
||||
SimpleButtonControl {{
|
||||
$0001, /* flags */
|
||||
$3002, /* more flags */
|
||||
0, /* refcon */
|
||||
NCWindow+btnConnect, /* Title Ref */
|
||||
nil, /* color table ref */
|
||||
{"\$0D","\$0D",0,0} /* key equivalents (esc) */
|
||||
}};
|
||||
$0001, /* flags */
|
||||
$3002, /* more flags */
|
||||
0, /* refcon */
|
||||
NCWindow+btnConnect, /* Title Ref */
|
||||
nil, /* color table ref */
|
||||
{"\$0D","\$0D",0,0} /* key equivalents (esc) */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+btnConnect) {"Connect"};
|
||||
|
||||
resource rControlTemplate (NCWindow+btnCancel) {
|
||||
btnCancel, /* Control ID */
|
||||
{121,128,0,0}, /* Control Rect */
|
||||
btnCancel, /* Control ID */
|
||||
{121,128,0,0}, /* Control Rect */
|
||||
SimpleButtonControl {{
|
||||
$0000, /* flags */
|
||||
$3002, /* more flags */
|
||||
0, /* refcon */
|
||||
NCWindow+btnCancel, /* Title Ref */
|
||||
nil, /* color table ref */
|
||||
{"\$1B","\$1B",0,0} /* key equivalents (esc) */
|
||||
$0000, /* flags */
|
||||
$3002, /* more flags */
|
||||
0, /* refcon */
|
||||
NCWindow+btnCancel, /* Title Ref */
|
||||
nil, /* color table ref */
|
||||
{"\$1B","\$1B",0,0} /* key equivalents (esc) */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+btnCancel) {"Cancel"};
|
||||
|
||||
resource rControlTemplate (NCWindow+linServer) {
|
||||
linServer,
|
||||
linServer,
|
||||
{4,87,16,310},
|
||||
editLineControl {{
|
||||
$0000,
|
||||
$0000,
|
||||
$7000,
|
||||
0,
|
||||
0,
|
||||
255, /* Max Size */
|
||||
0 /* text ref */
|
||||
}};
|
||||
};
|
||||
|
||||
resource rControlTemplate (NCWindow+txtServer) {
|
||||
txtServer,
|
||||
{5,3,15,86},
|
||||
txtServer,
|
||||
{5,3,15,86},
|
||||
statTextControl {{
|
||||
$0004,
|
||||
$0004,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+txtServer /* Title ref */
|
||||
}};
|
||||
NCWindow+txtServer /* Title ref */
|
||||
}};
|
||||
};
|
||||
resource rTextForLETextBox2 (NCWindow+txtServer) {"VNC Server:"};
|
||||
|
||||
resource rControlTemplate (NCWindow+txtServerInfo) {
|
||||
txtServerInfo,
|
||||
{16,0,26,316},
|
||||
txtServerInfo,
|
||||
{16,0,26,316},
|
||||
statTextControl {{
|
||||
$0000,
|
||||
$0000,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+txtServerInfo /* Title ref */
|
||||
}};
|
||||
NCWindow+txtServerInfo /* Title ref */
|
||||
}};
|
||||
};
|
||||
resource rTextForLETextBox2 (NCWindow+txtServerInfo) {
|
||||
"\$01J\$01\$00Use \$01S\$03\$00host:display\$01S\$00\$00 "
|
||||
"\$01J\$01\$00Use \$01S\$03\$00host:display\$01S\$00\$00 "
|
||||
"(or \$01S\$03\$00host\$01S\$00\$00 for display 0)."
|
||||
};
|
||||
|
||||
resource rControlTemplate (NCWindow+txtPassword) {
|
||||
txtPassword,
|
||||
{29,15,38,86},
|
||||
txtPassword,
|
||||
{29,15,38,86},
|
||||
statTextControl {{
|
||||
$0004,
|
||||
$0004,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+txtPassword /* Title ref */
|
||||
}};
|
||||
NCWindow+txtPassword /* Title ref */
|
||||
}};
|
||||
};
|
||||
resource rTextForLETextBox2 (NCWindow+txtPassword) {"Password:"};
|
||||
|
||||
resource rControlTemplate (NCWindow+linPassword) {
|
||||
linPassword,
|
||||
linPassword,
|
||||
{28,87,39,310},
|
||||
editLineControl {{
|
||||
$0000,
|
||||
$0000,
|
||||
$7000,
|
||||
0,
|
||||
8, /* Max Size */
|
||||
0,
|
||||
8, /* Max Size */
|
||||
0, /* text ref */
|
||||
$D7 /* password character */
|
||||
$D7 /* password character */
|
||||
}};
|
||||
};
|
||||
|
||||
resource rControlTemplate (NCWindow+txtDisplay) {
|
||||
txtDisplay,
|
||||
{43,13,52,73},
|
||||
txtDisplay,
|
||||
{43,13,52,73},
|
||||
statTextControl {{
|
||||
$0000,
|
||||
$0000,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+txtDisplay /* Title ref */
|
||||
}};
|
||||
NCWindow+txtDisplay /* Title ref */
|
||||
}};
|
||||
};
|
||||
resource rTextForLETextBox2 (NCWindow+txtDisplay) {" Display "};
|
||||
|
||||
resource rControlTemplate (NCWindow+rectDisplay) {
|
||||
NCWindow+rectDisplay,
|
||||
{47,3,100,111},
|
||||
NCWindow+rectDisplay,
|
||||
{47,3,100,111},
|
||||
rectangleControl {{
|
||||
$FF01,
|
||||
$FF01,
|
||||
$1000,
|
||||
0
|
||||
}};
|
||||
}};
|
||||
};
|
||||
|
||||
resource rControlTemplate (NCWindow+rad320) {
|
||||
rad320,
|
||||
{55,10,0,0},
|
||||
rad320,
|
||||
{55,10,0,0},
|
||||
RadioControl {{
|
||||
$0002,
|
||||
$0002,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+rad320, /* Title ref */
|
||||
1 /* initial value */
|
||||
NCWindow+rad320, /* Title ref */
|
||||
1 /* initial value */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+rad320) {"320 x 200"};
|
||||
|
||||
resource rControlTemplate (NCWindow+txtColor) {
|
||||
txtColor,
|
||||
{64,35,73,90},
|
||||
txtColor,
|
||||
{64,35,73,90},
|
||||
statTextControl {{
|
||||
$000C,
|
||||
$000C,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+txtColor /* Title ref */
|
||||
NCWindow+txtColor /* Title ref */
|
||||
}};
|
||||
};
|
||||
resource rTextForLETextBox2 (NCWindow+txtColor) {"Color"};
|
||||
|
||||
resource rControlTemplate (NCWindow+rad640) {
|
||||
rad640,
|
||||
{78,10,0,0},
|
||||
rad640,
|
||||
{78,10,0,0},
|
||||
RadioControl {{
|
||||
$0002,
|
||||
$0002,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+rad640, /* Title ref */
|
||||
0 /* initial value */
|
||||
NCWindow+rad640, /* Title ref */
|
||||
0 /* initial value */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+rad640) {"640 x 200"};
|
||||
|
||||
resource rControlTemplate (NCWindow+txtGray) {
|
||||
txtGray,
|
||||
{87,35,96,109},
|
||||
txtGray,
|
||||
{87,35,96,109},
|
||||
statTextControl {{
|
||||
$000C,
|
||||
$000C,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+txtGray /* Title ref */
|
||||
NCWindow+txtGray /* Title ref */
|
||||
}};
|
||||
};
|
||||
resource rTextForLETextBox2 (NCWindow+txtGray) {"Grayscale"};
|
||||
|
||||
resource rControlTemplate (NCWindow+chkShared) {
|
||||
chkShared,
|
||||
{43,117,0,0},
|
||||
chkShared,
|
||||
{43,117,0,0},
|
||||
CheckControl {{
|
||||
$0000,
|
||||
$0000,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+chkShared, /* Title ref */
|
||||
1 /* initial value */
|
||||
NCWindow+chkShared, /* Title ref */
|
||||
1 /* initial value */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+chkShared) {"Request Shared Session"};
|
||||
|
||||
resource rControlTemplate (NCWindow+chkClipboard) {
|
||||
chkClipboard,
|
||||
{82,117,0,0},
|
||||
chkClipboard,
|
||||
{82,117,0,0},
|
||||
CheckControl {{
|
||||
$0000,
|
||||
$0000,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+chkClipboard, /* Title ref */
|
||||
1 /* initial value */
|
||||
NCWindow+chkClipboard, /* Title ref */
|
||||
1 /* initial value */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+chkClipboard) {"Allow Clipboard"};
|
||||
|
||||
resource rControlTemplate (NCWindow+txtTransfers) {
|
||||
txtTransfers,
|
||||
{91,144,100,310},
|
||||
txtTransfers,
|
||||
{91,144,100,310},
|
||||
statTextControl {{
|
||||
$000C,
|
||||
$000C,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+txtTransfers /* Title ref */
|
||||
NCWindow+txtTransfers /* Title ref */
|
||||
}};
|
||||
};
|
||||
resource rTextForLETextBox2 (NCWindow+txtTransfers) {"Transfers from Server"};
|
||||
|
||||
resource rControlTemplate (NCWindow+chkEmul3Btn) {
|
||||
chkEmul3Btn,
|
||||
{56,117,0,0},
|
||||
chkEmul3Btn,
|
||||
{56,117,0,0},
|
||||
CheckControl {{
|
||||
$0000,
|
||||
$0000,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+chkEmul3Btn, /* Title ref */
|
||||
1 /* initial value */
|
||||
NCWindow+chkEmul3Btn, /* Title ref */
|
||||
1 /* initial value */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+chkEmul3Btn) {"Emulate 3-Button Mouse"};
|
||||
|
||||
resource rControlTemplate (NCWindow+chkViewOnly) {
|
||||
chkViewOnly,
|
||||
{69,117,0,0},
|
||||
chkViewOnly,
|
||||
{69,117,0,0},
|
||||
CheckControl {{
|
||||
$0000,
|
||||
$0000,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+chkViewOnly, /* Title ref */
|
||||
0 /* initial value */
|
||||
NCWindow+chkViewOnly, /* Title ref */
|
||||
0 /* initial value */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+chkViewOnly) {"View Only Mode"};
|
||||
|
||||
resource rControlTemplate (NCWindow+txtPreferredEncoding) {
|
||||
txtPreferredEncoding,
|
||||
{104,3,91,310},
|
||||
txtPreferredEncoding,
|
||||
{104,3,91,310},
|
||||
statTextControl {{
|
||||
$0004,
|
||||
$0004,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+txtPreferredEncoding /* Title ref */
|
||||
}};
|
||||
NCWindow+txtPreferredEncoding /* Title ref */
|
||||
}};
|
||||
};
|
||||
resource rTextForLETextBox2 (NCWindow+txtPreferredEncoding) {"Preferred Encoding:"};
|
||||
|
||||
resource rControlTemplate (NCWindow+radRaw) {
|
||||
radRaw,
|
||||
{104,155,0,0},
|
||||
radRaw,
|
||||
{104,155,0,0},
|
||||
RadioControl {{
|
||||
$0003,
|
||||
$0003,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+radRaw, /* Title ref */
|
||||
1 /* initial value */
|
||||
NCWindow+radRaw, /* Title ref */
|
||||
1 /* initial value */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+radRaw) {"Raw"};
|
||||
|
||||
resource rControlTemplate (NCWindow+radHextile) {
|
||||
radHextile,
|
||||
{104,220,0,0},
|
||||
radHextile,
|
||||
{104,220,0,0},
|
||||
RadioControl {{
|
||||
$0003,
|
||||
$0003,
|
||||
$1002,
|
||||
0,
|
||||
NCWindow+radHextile, /* Title ref */
|
||||
0 /* initial value */
|
||||
NCWindow+radHextile, /* Title ref */
|
||||
0 /* initial value */
|
||||
}};
|
||||
};
|
||||
resource rPString (NCWindow+radHextile) {"Hextile"};
|
||||
@ -904,22 +904,22 @@ resource rPString (NCWindow+radHextile) {"Hextile"};
|
||||
/*- TCP/IP Connection Status window resources ----------------------*/
|
||||
|
||||
resource rWindParam1 (1002) {
|
||||
fVis + fAlert, /* wFrameBits */
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0,0,0,0}, /* ZoomRect */
|
||||
nil, /* wColor ID */
|
||||
{0,0}, /* Origin */
|
||||
{0,0}, /* data size */
|
||||
{0,0}, /* max height-width */
|
||||
{0,0}, /* scroll vertical, horizontal */
|
||||
{0,0}, /* page vertical, horizontal */
|
||||
0, /* wInfoRefCon */
|
||||
0, /* wInfoHeight */
|
||||
{85,169,115,471}, /* wPosition */
|
||||
infront, /* wPlane */
|
||||
nil, /* wStorage */
|
||||
$0000 /* wInVerb */
|
||||
fVis + fAlert, /* wFrameBits */
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0,0,0,0}, /* ZoomRect */
|
||||
nil, /* wColor ID */
|
||||
{0,0}, /* Origin */
|
||||
{0,0}, /* data size */
|
||||
{0,0}, /* max height-width */
|
||||
{0,0}, /* scroll vertical, horizontal */
|
||||
{0,0}, /* page vertical, horizontal */
|
||||
0, /* wInfoRefCon */
|
||||
0, /* wInfoHeight */
|
||||
{85,169,115,471}, /* wPosition */
|
||||
infront, /* wPlane */
|
||||
nil, /* wStorage */
|
||||
$0000 /* wInVerb */
|
||||
};
|
||||
|
||||
resource rPString(10002) {"Press \$11. to cancel."};
|
||||
@ -928,46 +928,46 @@ resource rPString(10002) {"Press \$11. to cancel."};
|
||||
|
||||
/* 640 mode */
|
||||
resource rWindParam1 (1003) {
|
||||
fRScroll + fBScroll + fVis + fCtlTie + fGrow, /* wFrameBits */
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0,0,0,0}, /* ZoomRect */
|
||||
1, /* wColor ID */
|
||||
{0,0}, /* Origin */
|
||||
{0,0}, /* data size */
|
||||
{0,0}, /* max height-width */
|
||||
{8,8}, /* scroll vertical, horizontal */
|
||||
{0,608}, /* page vertical, horizontal */
|
||||
0, /* wInfoRefCon */
|
||||
0, /* wInfoHeight */
|
||||
{13,1,187,614}, /* wPosition */
|
||||
infront, /* wPlane */
|
||||
nil, /* wStorage */
|
||||
$0800 /* wInVerb */
|
||||
fRScroll + fBScroll + fVis + fCtlTie + fGrow, /* wFrameBits */
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0,0,0,0}, /* ZoomRect */
|
||||
1, /* wColor ID */
|
||||
{0,0}, /* Origin */
|
||||
{0,0}, /* data size */
|
||||
{0,0}, /* max height-width */
|
||||
{8,8}, /* scroll vertical, horizontal */
|
||||
{0,608}, /* page vertical, horizontal */
|
||||
0, /* wInfoRefCon */
|
||||
0, /* wInfoHeight */
|
||||
{13,1,187,614}, /* wPosition */
|
||||
infront, /* wPlane */
|
||||
nil, /* wStorage */
|
||||
$0800 /* wInVerb */
|
||||
};
|
||||
|
||||
/* 320 mode */
|
||||
resource rWindParam1 (1004) {
|
||||
fRScroll + fBScroll + fVis + fCtlTie + fGrow, /* wFrameBits */
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0,0,0,0}, /* ZoomRect */
|
||||
1, /* wColor ID */
|
||||
{0,0}, /* Origin */
|
||||
{0,0}, /* data size */
|
||||
{0,0}, /* max height-width */
|
||||
{8,8}, /* scroll vertical, horizontal */
|
||||
{0,0}, /* page vertical, horizontal */
|
||||
0, /* wInfoRefCon */
|
||||
0, /* wInfoHeight */
|
||||
{13,1,187,303}, /* wPosition */
|
||||
infront, /* wPlane */
|
||||
nil, /* wStorage */
|
||||
$0800 /* wInVerb */
|
||||
fRScroll + fBScroll + fVis + fCtlTie + fGrow, /* wFrameBits */
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0,0,0,0}, /* ZoomRect */
|
||||
1, /* wColor ID */
|
||||
{0,0}, /* Origin */
|
||||
{0,0}, /* data size */
|
||||
{0,0}, /* max height-width */
|
||||
{8,8}, /* scroll vertical, horizontal */
|
||||
{0,0}, /* page vertical, horizontal */
|
||||
0, /* wInfoRefCon */
|
||||
0, /* wInfoHeight */
|
||||
{13,1,187,303}, /* wPosition */
|
||||
infront, /* wPlane */
|
||||
nil, /* wStorage */
|
||||
$0800 /* wInVerb */
|
||||
};
|
||||
|
||||
resource rWindColor (1) {
|
||||
0x0000,
|
||||
0x0000,
|
||||
0x0FA0,
|
||||
0x020F,
|
||||
0xF0AA,
|
||||
|
Loading…
Reference in New Issue
Block a user