copyrect corrections, fd_set in rfbNewClient, dox in rfb.h for pthreads

problem
pull/1/head
dscho 23 years ago
parent fad7881732
commit 519a8e0e39

@ -1,4 +1,14 @@
0.2
rfbNewClient now sets the socket in the fd_set (for the select() call)
when compiling the library with HAVE_PTHREADS and an application
which includes "rfb.h" without, the structures got mixed up.
So, the pthreads section is now always at the end, and also
you get a linker error for rfbInitServer when using two different
pthread setups.
fixed two deadlocks: when setting a cursor and when using CopyRect
fixed CopyRect when copying modified regions (they lost the modified
property)
WIN32 target compiles and works for example :-)
fixed CopyRect (was using the wrong order of rectangles...)
should also work with pthreads, because copyrects are
always sent immediately (so that two consecutive copy rects
@ -6,11 +16,16 @@
changed rfbUndrawCursor(rfbClientPtr) to (rfbScreenInfoPtr), because
this makes more sense!
flag backgroundLoop in rfbScreenInfo (if having pthreads)
rfbCopyRect & rfbCopyRegion (really copies rectangle in frameBuffer)
added flag to optionally not send XCursor updates.
CopyRect & CopyRegion were implemented.
if you use a rfbDoCopyR* function, it copies the data in the
framebuffer. If you prefer to do that yourself, use rfbScheduleCopyR*
instead; this doesn't modify the frameBuffer.
added flag to optionally not send XCursor updates, but only RichCursor,
or if that is not possible, fall back to server side cursor.
This is useful if your cursor has many nice colours.
fixed java viewer on server side:
SendCursorUpdate would send data even before the client pixel format
was set.
was set, but the java applet doesn't like the server's format.
fixed two pthread issues:
rfbSendFramebuffer was sent by a ProcessClientMessage function
(unprotected by updateMutex).

13
TODO

@ -1,23 +1,25 @@
immediate:
----------
test copyRect and pthreads.
authentification schemes (secure vnc)
udp
udp (need an rfbClientPtr udpClient in rfbScreen)
documentation
hint that to mark very tiny regions as
modified is possibly inefficient for the encodings.
(a trail of points could be better a small rectangle).
(a trail of points could better be a small rectangle).
later:
------
autoconf? at least Sun Solaris and Windows compilation
(maybe Michael makes that)
using Hermes library for fast colour translations.
CORBA
done:
-----
.test copyRect and pthreads.
.optionally dont draw rich cursors as xcursors
.cursor smears on IRIX with pthreads, then has bus error. has to be a mutex
problem in cursor routines.
@ -56,3 +58,8 @@ fix bug with odd width (depends on client depth: width has to be multiple of ser
three have to be warned that this is happening.
-> rfbClientConnectionGone can only be called by the outer loop
(with background loop, it is input, else it is processEvents).
. fixed pthreads issues:
cursor deadlock,
CopyRect deadlock.
. when copying a region with modified parts, they were not marked
as modified

@ -75,6 +75,7 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
while((cl=rfbClientIteratorNext(iterator))) {
LOCK(cl->updateMutex);
if(cl->useCopyRect) {
sraRegionPtr modifiedRegionBackup;
if(!sraRgnEmpty(cl->copyRegion) && (cl->copyDX!=dx || cl->copyDY!=dy)) {
sraRgnOr(cl->copyRegion,cl->modifiedRegion);
sraRgnMakeEmpty(cl->copyRegion);
@ -83,6 +84,13 @@ void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,in
cl->copyDX = dx;
cl->copyDY = dy;
/* if there were modified regions, which are now copied: */
modifiedRegionBackup=sraRgnCreateRgn(cl->modifiedRegion);
sraRgnOffset(modifiedRegionBackup,dx,dy);
sraRgnAnd(modifiedRegionBackup,cl->copyRegion);
sraRgnOr(cl->modifiedRegion,modifiedRegionBackup);
sraRgnDestroy(modifiedRegionBackup);
/* while(!sraRgnEmpty(cl->copyRegion)) */ {
#ifdef HAVE_PTHREADS
if(!cl->screen->backgroundLoop)

13
rfb.h

@ -738,15 +738,20 @@ void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y
void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen,sraRegionPtr modRegion);
void doNothingWithClient(rfbClientPtr cl);
/* functions to make a vnc server */
extern rfbScreenInfoPtr rfbGetScreen(int argc,char** argv,
int width,int height,int bitsPerSample,int samplesPerPixel,
int bytesPerPixel);
/* if you use pthreads, but don't define HAVE_PTHREADS, the structs
get all mixed up. So this gives a linker error reminding you to compile
the library and your application (at least the parts including rfb.h)
with the same support for pthreads. */
#ifdef HAVE_PTHREADS
#define rfbInitServer rfbInitServerWithPthreads
#else
#define rfbInitServer rfbInitServerWithoutPthreads
#endif
/* functions to make a vnc server */
extern rfbScreenInfoPtr rfbGetScreen(int argc,char** argv,
int width,int height,int bitsPerSample,int samplesPerPixel,
int bytesPerPixel);
extern void rfbInitServer(rfbScreenInfoPtr rfbScreen);
extern void rfbScreenCleanup(rfbScreenInfoPtr screenInfo);

@ -137,7 +137,6 @@ rfbNewClientConnection(rfbScreen,sock)
if(cl!=NULL)
newConnection(cl, (KEYBOARD_DEVICE|POINTER_DEVICE),1,1,1);
#endif
FD_SET(sock,&(rfbScreen->allFds));
}
@ -194,6 +193,7 @@ rfbNewClient(rfbScreen,sock)
cl = (rfbClientPtr)xalloc(sizeof(rfbClientRec));
FD_SET(sock,&(rfbScreen->allFds));
cl->screen = rfbScreen;
cl->sock = sock;
getpeername(sock, (struct sockaddr *)&addr, &addrlen);

Loading…
Cancel
Save