summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordscho <dscho>2002-01-17 09:33:17 +0000
committerdscho <dscho>2002-01-17 09:33:17 +0000
commit7b90c44708b6b3096419af747e4a4f3470d2d4db (patch)
tree4214a827c7505e97c6863d00d00b07f82b770d5a
parentba66518fa044cf164cc3d963a248002c45f29538 (diff)
downloadlibtdevnc-7b90c44708b6b3096419af747e4a4f3470d2d4db.tar.gz
libtdevnc-7b90c44708b6b3096419af747e4a4f3470d2d4db.zip
correct BackChannel handling, compile cleanups
-rw-r--r--font.c5
-rw-r--r--rfb.h3
-rw-r--r--rfbproto.h1
-rw-r--r--rfbserver.c35
-rw-r--r--vncauth.c2
5 files changed, 31 insertions, 15 deletions
diff --git a/font.c b/font.c
index f61f09e..4bebe44 100644
--- a/font.c
+++ b/font.c
@@ -4,8 +4,8 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
int x,int y,unsigned char c,Pixel col)
{
int i,j,width,height;
- unsigned char d;
unsigned char* data=font->data+font->metaData[c*5];
+ unsigned char d=*data;
int rowstride=rfbScreen->paddedWidthInBytes;
int bpp=rfbScreen->rfbServerFormat.bitsPerPixel/8;
char *colour=(char*)&col;
@@ -49,8 +49,8 @@ int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
Pixel col,Pixel bcol)
{
int i,j,width,height;
- unsigned char d;
unsigned char* data=font->data+font->metaData[c*5];
+ unsigned char d;
int rowstride=rfbScreen->paddedWidthInBytes;
int bpp=rfbScreen->rfbServerFormat.bitsPerPixel/8,extra_bytes=0;
char* colour=(char*)&col;
@@ -73,6 +73,7 @@ int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
if(y2<y+height) height-=y+height-y2;
if(x2<x+width) { extra_bytes+=(x1+width)/8-(x+width-x2+7)/8; width-=x+width-x2; }
+ d=*data;
for(j=y1;j<height;j++) {
if((x1&7)!=0)
d=data[-1]; /* TODO: check if in this case extra_bytes is correct! */
diff --git a/rfb.h b/rfb.h
index a604dac..35dd031 100644
--- a/rfb.h
+++ b/rfb.h
@@ -473,6 +473,9 @@ typedef struct rfbClientRec {
Bool enableCursorShapeUpdates; /* client supports cursor shape updates */
Bool useRichCursorEncoding; /* rfbEncodingRichCursor is preferred */
Bool cursorWasChanged; /* cursor shape update should be sent */
+#ifdef BACKCHANNEL
+ Bool enableBackChannel;
+#endif
struct rfbClientRec *prev;
struct rfbClientRec *next;
diff --git a/rfbproto.h b/rfbproto.h
index aa2f54b..6ea6a62 100644
--- a/rfbproto.h
+++ b/rfbproto.h
@@ -610,6 +610,7 @@ typedef struct {
#ifdef BACKCHANNEL
typedef rfbServerCutTextMsg rfbBackChannelMsg;
+#define sz_rfbBackChannelMsg 8
#endif
diff --git a/rfbserver.c b/rfbserver.c
index 94533f3..b938d91 100644
--- a/rfbserver.c
+++ b/rfbserver.c
@@ -709,6 +709,15 @@ rfbProcessClientNormalMessage(cl)
cl->enableLastRectEncoding = TRUE;
}
break;
+#ifdef BACKCHANNEL
+ case rfbEncodingBackChannel:
+ if (!cl->enableBackChannel) {
+ rfbLog("Enabling BackChannel protocol extension for "
+ "client %s\n", cl->host);
+ cl->enableBackChannel = TRUE;
+ }
+ break;
+#endif
default:
if ( enc >= (CARD32)rfbEncodingCompressLevel0 &&
enc <= (CARD32)rfbEncodingCompressLevel9 ) {
@@ -1470,18 +1479,20 @@ void rfbSendBackChannel(rfbScreenInfoPtr rfbScreen,char* str,int len)
iterator = rfbGetClientIterator(rfbScreen);
while ((cl = rfbClientIteratorNext(iterator)) != NULL) {
- sct.type = rfbBackChannel;
- sct.length = Swap32IfLE(len);
- if (WriteExact(cl, (char *)&sct,
- sz_rfbServerCutTextMsg) < 0) {
- rfbLogPerror("rfbSendServerCutText: write");
- rfbCloseClient(cl);
- continue;
- }
- if (WriteExact(cl, str, len) < 0) {
- rfbLogPerror("rfbSendServerCutText: write");
- rfbCloseClient(cl);
- }
+ if (cl->enableBackChannel) {
+ sct.type = rfbBackChannel;
+ sct.length = Swap32IfLE(len);
+ if (WriteExact(cl, (char *)&sct,
+ sz_rfbBackChannelMsg) < 0) {
+ rfbLogPerror("rfbSendBackChannel: write");
+ rfbCloseClient(cl);
+ continue;
+ }
+ if (WriteExact(cl, str, len) < 0) {
+ rfbLogPerror("rfbSendBackChannel: write");
+ rfbCloseClient(cl);
+ }
+ }
}
rfbReleaseClientIterator(iterator);
}
diff --git a/vncauth.c b/vncauth.c
index 1014291..ef27e35 100644
--- a/vncauth.c
+++ b/vncauth.c
@@ -26,8 +26,8 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
#include <time.h>
+#ifdef WIN32
#define srandom srand
#define random rand
#else