diff options
author | steven_carr <steven_carr> | 2006-05-04 16:07:06 +0000 |
---|---|---|
committer | steven_carr <steven_carr> | 2006-05-04 16:07:06 +0000 |
commit | 5865f0c4b76a45e630ffc1899016ef99616b6fbf (patch) | |
tree | 27ecf26441ee092c4e441e2bdba3a3bb1b850907 | |
parent | 97fe75fdce41162dd3744850564694aab36a4615 (diff) | |
download | libtdevnc-5865f0c4b76a45e630ffc1899016ef99616b6fbf.tar.gz libtdevnc-5865f0c4b76a45e630ffc1899016ef99616b6fbf.zip |
Client side support for PalmVNC/UltraVNC 'Server Side Scaling'
-rw-r--r-- | libvncclient/rfbproto.c | 49 | ||||
-rw-r--r-- | libvncclient/vncviewer.c | 23 | ||||
-rw-r--r-- | rfb/rfbclient.h | 3 |
3 files changed, 71 insertions, 4 deletions
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index 33af0f8..fd6bdee 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -670,6 +670,27 @@ SendFramebufferUpdateRequest(rfbClient* client, int x, int y, int w, int h, rfbB /* + * SendScaleSetting. + */ +rfbBool +SendScaleSetting(rfbClient* client,int scaleSetting) +{ + rfbSetScaleMsg ssm; + + if (client->appData.palmVNC) + ssm.type = rfbPalmVNCSetScaleFactor; + else + ssm.type = rfbSetScale; + ssm.scale = scaleSetting; + ssm.pad = 0; + + if (!WriteToRFBServer(client, (char *)&ssm, sz_rfbSetScaleMsg)) + return FALSE; + + return TRUE; +} + +/* * SendPointerEvent. */ @@ -1132,6 +1153,32 @@ HandleRFBServerMessage(rfbClient* client) break; } + case rfbResizeFrameBuffer: + { + if (!ReadFromRFBServer(client, ((char *)&msg) + 1, + sz_rfbResizeFrameBufferMsg -1)) + return FALSE; + client->width = rfbClientSwap16IfLE(msg.rsfb.framebufferWidth); + client->height = rfbClientSwap16IfLE(msg.rsfb.framebufferHeigth); + client->MallocFrameBuffer(client); + SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE); + rfbClientLog("Got new framebuffer size: %dx%d\n", client->width, client->height); + break; + } + + case rfbPalmVNCReSizeFrameBuffer: + { + if (!ReadFromRFBServer(client, ((char *)&msg) + 1, + sz_rfbPalmVNCReSizeFrameBufferMsg -1)) + return FALSE; + client->width = rfbClientSwap16IfLE(msg.prsfb.buffer_w); + client->height = rfbClientSwap16IfLE(msg.prsfb.buffer_h); + client->MallocFrameBuffer(client); + SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE); + rfbClientLog("Got new framebuffer size: %dx%d\n", client->width, client->height); + break; + } + default: { rfbBool handled = FALSE; @@ -1143,8 +1190,8 @@ HandleRFBServerMessage(rfbClient* client) if(!handled) { char buffer[256]; - ReadFromRFBServer(client, buffer, 256); rfbClientLog("Unknown message type %d from VNC server\n",msg.type); + ReadFromRFBServer(client, buffer, 256); return FALSE; } } diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index 1a9784e..c66e02d 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -201,9 +201,23 @@ static rfbBool rfbInitConnection(rfbClient* client) client->width=client->si.framebufferWidth; client->height=client->si.framebufferHeight; client->MallocFrameBuffer(client); - if (!SendFramebufferUpdateRequest(client, - 0,0,client->width,client->height,FALSE)) - return FALSE; + + if (client->appData.scaleSetting>1) + { + if (!SendScaleSetting(client, client->appData.scaleSetting)) + return FALSE; + if (!SendFramebufferUpdateRequest(client, + 0,0, + client->width/client->appData.scaleSetting, + client->height/client->appData.scaleSetting,FALSE)) + return FALSE; + } + else + { + if (!SendFramebufferUpdateRequest(client, + 0,0,client->width,client->height,FALSE)) + return FALSE; + } return TRUE; } @@ -232,6 +246,9 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) { } else if (i+1<*argc && strcmp(argv[i], "-quality") == 0) { client->appData.qualityLevel = atoi(argv[i+1]); j+=2; + } else if (i+1<*argc && strcmp(argv[i], "-scale") == 0) { + client->appData.scaleSetting = atoi(argv[i+1]); + j+=2; } else { char* colon=strchr(argv[i],':'); diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h index 5a219a3..3454af4 100644 --- a/rfb/rfbclient.h +++ b/rfb/rfbclient.h @@ -89,6 +89,8 @@ typedef struct { int qualityLevel; rfbBool enableJPEG; rfbBool useRemoteCursor; + rfbBool palmVNC; /* use palmvnc specific SetScale (vs ultravnc) */ + int scaleSetting; /* 0 means no scale set, else 1/scaleSetting */ } AppData; @@ -239,6 +241,7 @@ extern rfbBool SendIncrementalFramebufferUpdateRequest(rfbClient* client); extern rfbBool SendFramebufferUpdateRequest(rfbClient* client, int x, int y, int w, int h, rfbBool incremental); +extern rfbBool SendScaleSetting(rfbClient* client,int scaleSetting); extern rfbBool SendPointerEvent(rfbClient* client,int x, int y, int buttonMask); extern rfbBool SendKeyEvent(rfbClient* client,uint32_t key, rfbBool down); extern rfbBool SendClientCutText(rfbClient* client,char *str, int len); |