summaryrefslogtreecommitdiffstats
path: root/libvncclient/vncviewer.c
diff options
context:
space:
mode:
authordscho <dscho>2004-06-07 08:31:57 +0000
committerdscho <dscho>2004-06-07 08:31:57 +0000
commit2b8c2a5c3a71364e402b4df334a6f5aff5ed77a9 (patch)
tree66e59b58f919f5848780d5c7d6c954160e289cff /libvncclient/vncviewer.c
parent98e4f89569587c143a56e4dcf8162a035efc361e (diff)
downloadlibtdevnc-2b8c2a5c3a71364e402b4df334a6f5aff5ed77a9.tar.gz
libtdevnc-2b8c2a5c3a71364e402b4df334a6f5aff5ed77a9.zip
add client_examples/, add SDLvncviewer, libvncclient API changes, suppress automake CFLAGS nagging
Diffstat (limited to 'libvncclient/vncviewer.c')
-rw-r--r--libvncclient/vncviewer.c61
1 files changed, 56 insertions, 5 deletions
diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c
index 6288485..6a58e78 100644
--- a/libvncclient/vncviewer.c
+++ b/libvncclient/vncviewer.c
@@ -43,15 +43,35 @@ static rfbBool MallocFrameBuffer(rfbClient* client) {
return client->frameBuffer?TRUE:FALSE;
}
-rfbClient* rfbGetClient(int* argc,char** argv,
- int bitsPerSample,int samplesPerPixel,
+static void initAppData(AppData* data) {
+ data->shareDesktop=TRUE;
+ data->viewOnly=FALSE;
+ data->encodingsString="tight hextile zlib corre rre raw";
+ data->useBGR233=FALSE;
+ data->nColours=0;
+ data->forceOwnCmap=FALSE;
+ data->forceTrueColour=FALSE;
+ data->requestedDepth=0;
+ data->compressLevel=3;
+ data->qualityLevel=5;
+#ifdef LIBVNCSERVER_HAVE_LIBJPEG
+ data->enableJPEG=TRUE;
+#else
+ data->enableJPEG=FALSE;
+#endif
+ data->useRemoteCursor=FALSE;
+}
+
+rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
int bytesPerPixel) {
rfbClient* client=(rfbClient*)calloc(sizeof(rfbClient),1);
- client->programName = argv[0];
+ initAppData(&client->appData);
+ client->programName = 0;
client->endianTest = 1;
client->format.bitsPerPixel = bytesPerPixel*8;
client->format.depth = bitsPerSample*samplesPerPixel;
+ client->appData.requestedDepth=client->format.depth;
client->format.bigEndian = *(char *)&client->endianTest?FALSE:TRUE;
client->format.trueColour = TRUE;
@@ -94,13 +114,13 @@ rfbClient* rfbGetClient(int* argc,char** argv,
return client;
}
-rfbBool rfbInitClient(rfbClient* client,const char* vncServerHost,int vncServerPort)
+static rfbBool rfbInitConnection(rfbClient* client)
{
/* Unless we accepted an incoming connection, make a TCP connection to the
given VNC server */
if (!client->listenSpecified) {
- if (!ConnectToRFBServer(client,vncServerHost, vncServerPort))
+ if (!client->serverHost || !ConnectToRFBServer(client,client->serverHost,client->serverPort))
return FALSE;
}
@@ -122,6 +142,37 @@ rfbBool rfbInitClient(rfbClient* client,const char* vncServerHost,int vncServerP
return TRUE;
}
+rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) {
+ int i;
+
+ if(client->programName==0)
+ client->programName=argv[0];
+
+ for (i = 1; i < *argc; i++) {
+ if (strcmp(argv[i], "-listen") == 0) {
+ listenForIncomingConnections(client);
+ break;
+ } else {
+ char* colon=strchr(argv[i],':');
+
+ client->serverHost=argv[i];
+ if(colon) {
+ *colon=0;
+ client->serverPort=atoi(colon+1);
+ } else
+ client->serverPort=0;
+ client->serverPort+=5900;
+ }
+ }
+
+ if(!rfbInitConnection(client)) {
+ rfbClientCleanup(client);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
void rfbClientCleanup(rfbClient* client) {
free(client);
}