summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bdf2c.pl1
-rw-r--r--font.c19
-rw-r--r--main.c31
-rw-r--r--rfb.h14
-rw-r--r--rfbserver.c4
5 files changed, 45 insertions, 24 deletions
diff --git a/bdf2c.pl b/bdf2c.pl
index 9eca7b3..e92b465 100644
--- a/bdf2c.pl
+++ b/bdf2c.pl
@@ -16,6 +16,7 @@ $nullx="0x";
while(<>) {
if(/^FONT (.*)$/) {
$fontname=$1;
+ $fontname=~y/\"//d;
} elsif(/^ENCODING (.*)$/) {
$glyphindex=$1;
$searchfor="BBX";
diff --git a/font.c b/font.c
index 3fa6b3c..9356793 100644
--- a/font.c
+++ b/font.c
@@ -1,7 +1,7 @@
#include "rfb.h"
int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
- int x,int y,char c,CARD32 colour)
+ int x,int y,unsigned char c,CARD32 colour)
{
int i,j,k,width,height;
unsigned char d;
@@ -12,7 +12,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
width=font->metaData[c*5+1];
height=font->metaData[c*5+2];
x+=font->metaData[c*5+3];
- y+=font->metaData[c*5+4]-height+1;
+ y+=-font->metaData[c*5+4]-height+1;
for(j=0;j<height;j++) {
for(i=0;i<width;i++) {
@@ -23,7 +23,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
if(d&0x80) {
for(k=0;k<bpp;k++)
rfbScreen->frameBuffer[(y+j)*rowstride+(x+i)*bpp+k]=
- ((colour>>(8*bpp))&0xff);
+ ((colour>>(8*k))&0xff);
}
d<<=1;
}
@@ -34,7 +34,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
}
void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
- int x,int y,char* string,CARD32 colour)
+ int x,int y,unsigned char* string,CARD32 colour)
{
while(*string) {
x+=rfbDrawChar(rfbScreen,font,x,y,*string,colour);
@@ -42,7 +42,7 @@ void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
}
}
-int rfbWidth(rfbFontDataPtr font,char* string)
+int rfbWidth(rfbFontDataPtr font,unsigned char* string)
{
int i=0;
while(*string) {
@@ -52,10 +52,15 @@ int rfbWidth(rfbFontDataPtr font,char* string)
return(i);
}
-void rfbFontBBox(rfbFontDataPtr font,char c,int* x1,int* y1,int* x2,int* y2)
+int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c)
+{
+ return(font->metaData[c*5+1]+font->metaData[c*5+3]);
+}
+
+void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2)
{
*x1+=font->metaData[c*5+3];
- *y1+=font->metaData[c*5+4]-font->metaData[c*5+2]+1;
+ *y1+=-font->metaData[c*5+4]-font->metaData[c*5+2]+1;
*x2=*x1+font->metaData[c*5+1];
*y2=*y1+font->metaData[c*5+2];
}
diff --git a/main.c b/main.c
index 2c682af..d1e1797 100644
--- a/main.c
+++ b/main.c
@@ -75,22 +75,28 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
while((cl=rfbClientIteratorNext(iterator))) {
LOCK(cl->updateMutex);
if(cl->useCopyRect) {
+ if(!sraRgnEmpty(cl->copyRegion) && (cl->copyDX!=dx || cl->copyDY!=dy)) {
+ sraRgnOr(cl->copyRegion,cl->modifiedRegion);
+ sraRgnMakeEmpty(cl->copyRegion);
+ }
sraRgnOr(cl->copyRegion,copyRegion);
cl->copyDX = dx;
cl->copyDY = dy;
-
+
+ /* while(!sraRgnEmpty(cl->copyRegion)) */ {
#ifdef HAVE_PTHREADS
- if(cl->screen->backgroundLoop) {
- SIGNAL(cl->updateCond);
- UNLOCK(cl->updateMutex);
- LOCK(cl->updateMutex);
- } else
+ if(cl->screen->backgroundLoop) {
+ SIGNAL(cl->updateCond);
+ UNLOCK(cl->updateMutex);
+ LOCK(cl->updateMutex);
+ } else
#endif
- {
- sraRegionPtr updateRegion = sraRgnCreateRgn(cl->modifiedRegion);
- sraRgnOr(updateRegion,cl->copyRegion);
- rfbSendFramebufferUpdate(cl,updateRegion);
- sraRgnDestroy(updateRegion);
+ {
+ sraRegionPtr updateRegion = sraRgnCreateRgn(cl->modifiedRegion);
+ sraRgnOr(updateRegion,cl->copyRegion);
+ rfbSendFramebufferUpdate(cl,updateRegion);
+ sraRgnDestroy(updateRegion);
+ }
}
} else {
sraRgnOr(cl->modifiedRegion,copyRegion);
@@ -457,7 +463,7 @@ rfbScreenInfoPtr rfbGetScreen(int argc,char** argv,
rfbScreen->colourMap.is16 = 0;
rfbScreen->colourMap.data.bytes = NULL;
- if(bytesPerPixel == 8) {
+ if(bytesPerPixel == 1) {
format->redMax = 7;
format->greenMax = 7;
format->blueMax = 3;
@@ -500,6 +506,7 @@ rfbScreenInfoPtr rfbGetScreen(int argc,char** argv,
rfbScreen->getCursorPtr = defaultGetCursorPtr;
rfbScreen->setTranslateFunction = rfbSetTranslateFunction;
rfbScreen->newClientHook = doNothingWithClient;
+ rfbScreen->displayHook = 0;
/* initialize client list and iterator mutex */
rfbClientListInit(rfbScreen);
diff --git a/rfb.h b/rfb.h
index 26dde36..24ee3c0 100644
--- a/rfb.h
+++ b/rfb.h
@@ -147,6 +147,7 @@ typedef void (*SetXCutTextProcPtr) (char* str,int len, struct rfbClientRec* cl);
typedef struct rfbCursor* (*GetCursorProcPtr) (struct rfbClientRec* pScreen);
typedef Bool (*SetTranslateFunctionProcPtr)(struct rfbClientRec* cl);
typedef void (*NewClientHookPtr)(struct rfbClientRec* cl);
+typedef void (*DisplayHookPtr)(struct rfbClientRec* cl);
typedef struct {
CARD32 count;
@@ -296,6 +297,8 @@ typedef struct
/* newClientHook is called just after a new client is created */
NewClientHookPtr newClientHook;
+ /* displayHook is called just before a frame buffer update */
+ DisplayHookPtr displayHook;
} rfbScreenInfo, *rfbScreenInfoPtr;
@@ -714,7 +717,7 @@ extern void rfbDisconnectUDPSock(rfbScreenInfoPtr cl);
/* font.c */
typedef struct rfbFontData {
- char* data;
+ unsigned char* data;
/*
metaData is a 256*5 array:
for each character
@@ -723,10 +726,11 @@ typedef struct rfbFontData {
int* metaData;
} rfbFontData,* rfbFontDataPtr;
-int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,char c,CARD32 colour);
-void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,char* string,CARD32 colour);
-int rfbWidth(rfbFontDataPtr font,char* string);
-void rfbFontBBox(rfbFontDataPtr font,char c,int* x1,int* y1,int* x2,int* y2);
+int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,CARD32 colour);
+void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char* string,CARD32 colour);
+int rfbWidth(rfbFontDataPtr font,unsigned char* string);
+int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c);
+void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2);
/* main.c */
diff --git a/rfbserver.c b/rfbserver.c
index 6c20323..e8d3f76 100644
--- a/rfbserver.c
+++ b/rfbserver.c
@@ -853,6 +853,9 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
sraRegionPtr updateRegion,updateCopyRegion;
int dx, dy;
Bool sendCursorShape = FALSE;
+
+ if(cl->screen->displayHook)
+ cl->screen->displayHook(cl);
/*
* If this client understands cursor shape updates, cursor should be
@@ -1097,6 +1100,7 @@ rfbSendCopyRegion(cl, reg, dx, dy)
sraRectangleIterator* i;
sraRect rect1;
+ /* printf("copyrect: "); sraRgnPrint(reg); putchar('\n'); fflush(stdout); */
i = sraRgnGetReverseIterator(reg,dx>0,dy>0);
while(sraRgnIteratorNext(i,&rect1)) {