From 1f8da9bde3b7de272228872410143f076662ae13 Mon Sep 17 00:00:00 2001 From: runge Date: Wed, 31 Jan 2007 15:29:12 +0000 Subject: [PATCH] libvncclient: add GotCursorShape() and GotCopyRect(); x11vnc dep on libvncclient --- Makefile.am | 4 ++-- libvncclient/cursor.c | 4 ++++ libvncclient/rfbproto.c | 31 ++++++++++++++++++++++++++++--- libvncclient/vncviewer.c | 2 +- prepare_x11vnc_dist.sh | 14 ++++++++++---- rfb/rfbclient.h | 6 ++++++ 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index e14374d..8db7f34 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ CFLAGS=-g -Wall -SUBDIRS=libvncserver examples contrib x11vnc vncterm classes libvncclient client_examples test -DIST_SUBDIRS=libvncserver examples contrib x11vnc vncterm classes libvncclient client_examples test +SUBDIRS=libvncserver examples contrib libvncclient x11vnc vncterm classes client_examples test +DIST_SUBDIRS=libvncserver examples contrib libvncclient x11vnc vncterm classes client_examples test bin_SCRIPTS = libvncserver-config diff --git a/libvncclient/cursor.c b/libvncclient/cursor.c index 9c8463d..a48d7c5 100644 --- a/libvncclient/cursor.c +++ b/libvncclient/cursor.c @@ -167,6 +167,10 @@ rfbBool HandleCursorShape(rfbClient* client,int xhot, int yhot, int width, int h } } + if (client->GotCursorShape != NULL) { + client->GotCursorShape(client, xhot, yhot, width, height, bytesPerPixel); + } + free(buf); return TRUE; diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index 105e4e3..2704dee 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -167,9 +167,30 @@ static void CopyRectangleFromRectangle(rfbClient* client, int src_x, int src_y, #define COPY_RECT_FROM_RECT(BPP) \ { \ uint##BPP##_t* _buffer=((uint##BPP##_t*)client->frameBuffer)+(src_y-dest_y)*client->width+src_x-dest_x; \ - for(j=dest_y*client->width;j<(dest_y+h)*client->width;j+=client->width) { \ - for(i=dest_x;iframeBuffer)[j+i]=_buffer[j+i]; \ + if (dest_y < src_y) { \ + for(j = dest_y*client->width; j < (dest_y+h)*client->width; j += client->width) { \ + if (dest_x < src_x) { \ + for(i = dest_x; i < dest_x+w; i++) { \ + ((uint##BPP##_t*)client->frameBuffer)[j+i]=_buffer[j+i]; \ + } \ + } else { \ + for(i = dest_x+w-1; i >= dest_x; i--) { \ + ((uint##BPP##_t*)client->frameBuffer)[j+i]=_buffer[j+i]; \ + } \ + } \ + } \ + } else { \ + for(j = (dest_y+h-1)*client->width; j >= dest_y*client->width; j-=client->width) { \ + if (dest_x < src_x) { \ + for(i = dest_x; i < dest_x+w; i++) { \ + ((uint##BPP##_t*)client->frameBuffer)[j+i]=_buffer[j+i]; \ + } \ + } else { \ + for(i = dest_x+w-1; i >= dest_x; i--) { \ + ((uint##BPP##_t*)client->frameBuffer)[j+i]=_buffer[j+i]; \ + } \ + } \ + } \ } \ } @@ -1262,6 +1283,10 @@ HandleRFBServerMessage(rfbClient* client) client->SoftCursorLockArea(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h); + if (client->GotCopyRect != NULL) { + client->GotCopyRect(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h, + rect.r.x, rect.r.y); + } CopyRectangleFromRectangle(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h, rect.r.x, rect.r.y); diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index c66e02d..2e42b87 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -87,7 +87,7 @@ static rfbBool MallocFrameBuffer(rfbClient* client) { static void initAppData(AppData* data) { data->shareDesktop=TRUE; data->viewOnly=FALSE; - data->encodingsString="tight zrle ultra hextile zlib corre rre raw"; + data->encodingsString="tight zrle ultra copyrect hextile zlib corre rre raw"; data->useBGR233=FALSE; data->nColours=0; data->forceOwnCmap=FALSE; diff --git a/prepare_x11vnc_dist.sh b/prepare_x11vnc_dist.sh index 6a14670..8a6ce73 100644 --- a/prepare_x11vnc_dist.sh +++ b/prepare_x11vnc_dist.sh @@ -9,7 +9,7 @@ mv configure.ac configure.ac.LibVNCServer cat configure.ac.LibVNCServer | \ egrep -v 'AC_CONFIG_COMMANDS.*libvncserver-config' | \ sed -e "s/LibVNCServer, [^,)]*\([(,]\)*/x11vnc, $VERSION\1/g" \ - -e "s/\(contrib\|examples\|vncterm\|libvncclient\|test\|client_examples\)\/Makefile//g" \ + -e "s/\(contrib\|examples\|vncterm\|test\|client_examples\)\/Makefile//g" \ -e "s/LibVNCServer.spec/x11vnc.spec/g" \ -e "s/^.*libvncserver-config//g" \ > configure.ac @@ -18,8 +18,8 @@ mv Makefile.am Makefile.am.LibVNCServer echo "EXTRA_DIST=tightvnc-1.3dev5-vncviewer-alpha-cursor.patch README.LibVNCServer" > Makefile.am cat Makefile.am.LibVNCServer | \ -sed -e "s/^SUBDIRS.*$/SUBDIRS=libvncserver x11vnc classes/" \ - -e "s/^DIST_SUBDIRS.*$/DIST_SUBDIRS=libvncserver x11vnc classes/" \ +sed -e "s/^SUBDIRS.*$/SUBDIRS=libvncserver libvncclient x11vnc classes/" \ + -e "s/^DIST_SUBDIRS.*$/DIST_SUBDIRS=libvncserver libvncclient x11vnc classes/" \ -e "/all: make_config_executable/,\$d" \ -e "/^.*bin_SCRIPTS.*$/d" \ -e "s/include_/noinst_/" \ @@ -76,6 +76,12 @@ cat libvncserver/Makefile.am.LibVNCServer | \ sed -e "s/\(include\|LIB\|lib\)_/noinst_/g" \ > libvncserver/Makefile.am +mv libvncclient/Makefile.am libvncclient/Makefile.am.LibVNCServer + +cat libvncclient/Makefile.am.LibVNCServer | \ +sed -e "s/\(include\|LIB\|lib\)_/noinst_/g" \ +> libvncclient/Makefile.am + cp classes/Makefile.am classes/Makefile.am.LibVNCServer echo 'pkgdatadir = $(datadir)/@PACKAGE@/classes' >> classes/Makefile.am echo 'pkgdata_DATA=VncViewer.jar index.vnc' >> classes/Makefile.am @@ -96,7 +102,7 @@ sed -e "s/^\(_PKG.*\)\$PACKAGE\(.*\)$/\1LibVNCServer\2/" \ > acinclude.m4 make x11vnc-${VERSION}.tar.gz -for f in configure.ac Makefile.am libvncserver/Makefile.am classes/Makefile.am classes/ssl/Makefile.am acinclude.m4 README; do +for f in configure.ac Makefile.am libvncserver/Makefile.am libvncclient/Makefile.am classes/Makefile.am classes/ssl/Makefile.am acinclude.m4 README; do mv -f $f.LibVNCServer $f done diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h index e8754fd..17b22b3 100644 --- a/rfb/rfbclient.h +++ b/rfb/rfbclient.h @@ -107,6 +107,9 @@ typedef rfbBool (*MallocFrameBufferProc)(struct _rfbClient* client); typedef void (*GotXCutTextProc)(struct _rfbClient* client, const char *text, int textlen); typedef void (*BellProc)(struct _rfbClient* client); +typedef void (*GotCursorShapeProc)(struct _rfbClient* client, int xhot, int yhot, int width, int height, int bytesPerPixel); +typedef void (*GotCopyRectProc)(struct _rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y); + typedef struct _rfbClient { uint8_t* frameBuffer; int width, height; @@ -222,6 +225,9 @@ typedef struct _rfbClient { GotXCutTextProc GotXCutText; BellProc Bell; + GotCursorShapeProc GotCursorShape; + GotCopyRectProc GotCopyRect; + /* Which messages are supported by the server * This is a *guess* for most servers. * (If we can even detect the type of server)