VNC fixes from Johannes Schindelin <Johannes.Schindelin@gmx.de>
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@770 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
7b1e71ca6e
commit
4b2941c764
96
vnc/vnc.c
96
vnc/vnc.c
@ -84,7 +84,7 @@ BOOL enable_compose = False;
|
|||||||
void
|
void
|
||||||
vncHideCursor()
|
vncHideCursor()
|
||||||
{
|
{
|
||||||
if (server->rfbClientHead)
|
if (server->clientHead)
|
||||||
rfbUndrawCursor(server);
|
rfbUndrawCursor(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ vncMouse(int buttonMask, int x, int y, struct _rfbClientRec *cl)
|
|||||||
lastbuttons = buttonMask;
|
lastbuttons = buttonMask;
|
||||||
|
|
||||||
/* handle cursor */
|
/* handle cursor */
|
||||||
defaultPtrAddEvent(buttonMask, x, y, cl);
|
rfbDefaultPtrAddEvent(buttonMask, x, y, cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ rdp2vnc_connect(char *server, uint32 flags, char *domain, char *password,
|
|||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
int rfbListenSock, addrlen = sizeof(addr);
|
int rfbListenSock, addrlen = sizeof(addr);
|
||||||
|
|
||||||
rfbListenSock = ListenOnTCPPort(rfb_port);
|
rfbListenSock = rfbListenOnTCPPort(rfb_port);
|
||||||
fprintf(stderr, "Listening on VNC port %d\n", rfb_port);
|
fprintf(stderr, "Listening on VNC port %d\n", rfb_port);
|
||||||
if (rfbListenSock <= 0)
|
if (rfbListenSock <= 0)
|
||||||
error("Cannot listen on port %d", rfb_port);
|
error("Cannot listen on port %d", rfb_port);
|
||||||
@ -259,8 +259,10 @@ rdp2vnc_connect(char *server, uint32 flags, char *domain, char *password,
|
|||||||
}
|
}
|
||||||
if (!fork())
|
if (!fork())
|
||||||
{
|
{
|
||||||
|
BOOL deactivated;
|
||||||
|
uint32_t ext_disc_reason;
|
||||||
printf("Connection successful.\n");
|
printf("Connection successful.\n");
|
||||||
rdp_main_loop();
|
rdp_main_loop(&deactivated,&ext_disc_reason);
|
||||||
printf("Disconnecting...\n");
|
printf("Disconnecting...\n");
|
||||||
rdp_disconnect();
|
rdp_disconnect();
|
||||||
ui_destroy_window();
|
ui_destroy_window();
|
||||||
@ -293,18 +295,18 @@ ui_create_window()
|
|||||||
server->kbdAddEvent = vncKey;
|
server->kbdAddEvent = vncKey;
|
||||||
#ifdef ENABLE_SHADOW
|
#ifdef ENABLE_SHADOW
|
||||||
server->httpPort = 6124 + client_counter;
|
server->httpPort = 6124 + client_counter;
|
||||||
server->rfbPort = 5924 + client_counter;
|
server->port = 5924 + client_counter;
|
||||||
rfbInitSockets(server);
|
rfbInitSockets(server);
|
||||||
server->rfbAlwaysShared = TRUE;
|
server->alwaysShared = TRUE;
|
||||||
server->rfbNeverShared = FALSE;
|
server->neverShared = FALSE;
|
||||||
#else
|
#else
|
||||||
server->rfbPort = -1;
|
server->port = -1;
|
||||||
server->rfbAlwaysShared = FALSE;
|
server->alwaysShared = FALSE;
|
||||||
server->rfbNeverShared = FALSE;
|
server->neverShared = FALSE;
|
||||||
#endif
|
#endif
|
||||||
server->inetdSock = rfbClientSocket;
|
server->inetdSock = rfbClientSocket;
|
||||||
server->rfbServerFormat.trueColour = FALSE; /* activate colour maps */
|
server->serverFormat.trueColour = FALSE; /* activate colour maps */
|
||||||
server->rfbDeferUpdateTime = defer_time;
|
server->deferUpdateTime = defer_time;
|
||||||
|
|
||||||
frameBuffer = (vncBuffer *) malloc(sizeof(vncBuffer));
|
frameBuffer = (vncBuffer *) malloc(sizeof(vncBuffer));
|
||||||
frameBuffer->w = g_width;
|
frameBuffer->w = g_width;
|
||||||
@ -312,16 +314,16 @@ ui_create_window()
|
|||||||
frameBuffer->linew = g_width;
|
frameBuffer->linew = g_width;
|
||||||
frameBuffer->data = server->frameBuffer;
|
frameBuffer->data = server->frameBuffer;
|
||||||
frameBuffer->owner = FALSE;
|
frameBuffer->owner = FALSE;
|
||||||
frameBuffer->format = &server->rfbServerFormat;
|
frameBuffer->format = &server->serverFormat;
|
||||||
|
|
||||||
ui_set_clip(0, 0, g_width, g_height);
|
ui_set_clip(0, 0, g_width, g_height);
|
||||||
|
|
||||||
rfbInitServer(server);
|
rfbInitServer(server);
|
||||||
#ifndef ENABLE_SHADOW
|
#ifndef ENABLE_SHADOW
|
||||||
server->rfbPort = rfb_port;
|
server->port = rfb_port;
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "server listening on port %d (socket %d)\n", server->rfbPort,
|
fprintf(stderr, "server listening on port %d (socket %d)\n", server->port,
|
||||||
server->rfbListenSock);
|
server->listenSock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
init_keyboard();
|
init_keyboard();
|
||||||
@ -332,7 +334,7 @@ ui_create_window()
|
|||||||
void
|
void
|
||||||
ui_destroy_window()
|
ui_destroy_window()
|
||||||
{
|
{
|
||||||
rfbCloseClient(server->rfbClientHead);
|
rfbCloseClient(server->clientHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -354,7 +356,7 @@ ui_select(int rdpSocket)
|
|||||||
n = select(m + 1, &fds, NULL, NULL, &tv);
|
n = select(m + 1, &fds, NULL, NULL, &tv);
|
||||||
rfbProcessEvents(server, 0);
|
rfbProcessEvents(server, 0);
|
||||||
/* if client is gone, close connection */
|
/* if client is gone, close connection */
|
||||||
if (!server->rfbClientHead)
|
if (!server->clientHead)
|
||||||
close(rdpSocket);
|
close(rdpSocket);
|
||||||
if (FD_ISSET(rdpSocket, &fds))
|
if (FD_ISSET(rdpSocket, &fds))
|
||||||
return 1;
|
return 1;
|
||||||
@ -465,6 +467,7 @@ ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 *
|
|||||||
cursor->mask = (char *) d0;
|
cursor->mask = (char *) d0;
|
||||||
cursor->source = 0;
|
cursor->source = 0;
|
||||||
cursor->richSource = cdata;
|
cursor->richSource = cdata;
|
||||||
|
cursor->cleanup = 0; // workaround: this produces a memleak
|
||||||
|
|
||||||
cursor->backRed = cursor->backGreen = cursor->backBlue = 0xffff;
|
cursor->backRed = cursor->backGreen = cursor->backBlue = 0xffff;
|
||||||
cursor->foreRed = cursor->foreGreen = cursor->foreBlue = 0;
|
cursor->foreRed = cursor->foreGreen = cursor->foreBlue = 0;
|
||||||
@ -933,8 +936,8 @@ ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)
|
|||||||
vncBuffer *buf;
|
vncBuffer *buf;
|
||||||
|
|
||||||
buf = vncGetRect(server, x, y, cx, cy);
|
buf = vncGetRect(server, x, y, cx, cy);
|
||||||
offset *= TOBYTES(server->rfbServerFormat.bitsPerPixel);
|
offset *= TOBYTES(server->serverFormat.bitsPerPixel);
|
||||||
cache_put_desktop(offset, cx, cy, cx, TOBYTES(server->rfbServerFormat.bitsPerPixel),
|
cache_put_desktop(offset, cx, cy, cx, TOBYTES(server->serverFormat.bitsPerPixel),
|
||||||
(buf->data));
|
(buf->data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,8 +952,8 @@ ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
|
|||||||
ox = x;
|
ox = x;
|
||||||
oy = y;
|
oy = y;
|
||||||
|
|
||||||
offset *= TOBYTES(server->rfbServerFormat.bitsPerPixel);
|
offset *= TOBYTES(server->serverFormat.bitsPerPixel);
|
||||||
data = cache_get_desktop(offset, cx, cy, TOBYTES(server->rfbServerFormat.bitsPerPixel));
|
data = cache_get_desktop(offset, cx, cy, TOBYTES(server->serverFormat.bitsPerPixel));
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1007,8 +1010,8 @@ vncDupBuffer(vncBuffer * b)
|
|||||||
void
|
void
|
||||||
vncPrintStats()
|
vncPrintStats()
|
||||||
{
|
{
|
||||||
if (server && server->rfbClientHead)
|
if (server && server->clientHead)
|
||||||
rfbPrintStats(server->rfbClientHead);
|
rfbPrintStats(server->clientHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* blit */
|
/* blit */
|
||||||
@ -1026,7 +1029,7 @@ vncCopyBlitFromNoEncode(rfbScreenInfoPtr s, int x, int y, int w, int h,
|
|||||||
|
|
||||||
vncHideCursor();
|
vncHideCursor();
|
||||||
|
|
||||||
if (s->rfbServerFormat.bitsPerPixel == src->format->bitsPerPixel
|
if (s->serverFormat.bitsPerPixel == src->format->bitsPerPixel
|
||||||
&& srcx + w <= src->w && srcy + h <= src->h)
|
&& srcx + w <= src->w && srcy + h <= src->h)
|
||||||
{
|
{
|
||||||
//simple copy
|
//simple copy
|
||||||
@ -1240,7 +1243,7 @@ vncSetRect(rfbScreenInfoPtr s, int x, int y, int w, int h, vncPixel c)
|
|||||||
vncHideCursor();
|
vncHideCursor();
|
||||||
|
|
||||||
// - Fill the rect in the local framebuffer
|
// - Fill the rect in the local framebuffer
|
||||||
if (s->rfbServerFormat.bitsPerPixel == 8)
|
if (s->serverFormat.bitsPerPixel == 8)
|
||||||
{
|
{
|
||||||
// - Simple 8-bit fill
|
// - Simple 8-bit fill
|
||||||
uint8_t *dstdata;
|
uint8_t *dstdata;
|
||||||
@ -1269,19 +1272,19 @@ vncBuffer *
|
|||||||
vncGetRect(rfbScreenInfoPtr s, int x, int y, int w, int h)
|
vncGetRect(rfbScreenInfoPtr s, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
int xx, yy;
|
int xx, yy;
|
||||||
vncBuffer *b = vncNewBuffer(w, h, s->rfbServerFormat.depth);
|
vncBuffer *b = vncNewBuffer(w, h, s->serverFormat.depth);
|
||||||
|
|
||||||
vncHideCursor();
|
vncHideCursor();
|
||||||
|
|
||||||
if (s->rfbServerFormat.bitsPerPixel == 8)
|
if (s->serverFormat.bitsPerPixel == 8)
|
||||||
{
|
{
|
||||||
//simple copy
|
//simple copy
|
||||||
int srcstep, dststep;
|
int srcstep, dststep;
|
||||||
char *srcdata, *dstdata;
|
char *srcdata, *dstdata;
|
||||||
srcstep = s->paddedWidthInBytes * s->rfbServerFormat.bitsPerPixel / 8;
|
srcstep = s->paddedWidthInBytes * s->serverFormat.bitsPerPixel / 8;
|
||||||
dststep = w * s->rfbServerFormat.bitsPerPixel / 8;
|
dststep = w * s->serverFormat.bitsPerPixel / 8;
|
||||||
dstdata = b->data;
|
dstdata = b->data;
|
||||||
srcdata = s->frameBuffer + (y * srcstep + x * s->rfbServerFormat.bitsPerPixel / 8);
|
srcdata = s->frameBuffer + (y * srcstep + x * s->serverFormat.bitsPerPixel / 8);
|
||||||
for (yy = 0; yy < h; yy++)
|
for (yy = 0; yy < h; yy++)
|
||||||
{
|
{
|
||||||
memcpy(dstdata, srcdata, dststep);
|
memcpy(dstdata, srcdata, dststep);
|
||||||
@ -1341,3 +1344,34 @@ vncSetColourMap(rfbScreenInfoPtr s, rfbColourMap * m)
|
|||||||
s->colourMap = *m;
|
s->colourMap = *m;
|
||||||
rfbSetClientColourMaps(s, 0, 0);
|
rfbSetClientColourMaps(s, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_begin_update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_end_update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_resize_window()
|
||||||
|
{
|
||||||
|
rfbClientIteratorPtr iter;
|
||||||
|
rfbClientPtr cl;
|
||||||
|
|
||||||
|
server->width = g_width;
|
||||||
|
server->height = g_height;
|
||||||
|
server->frameBuffer = (char *) realloc(server->frameBuffer, g_width * g_height);
|
||||||
|
server->paddedWidthInBytes = g_width;
|
||||||
|
|
||||||
|
iter=rfbGetClientIterator(server);
|
||||||
|
while((cl=rfbClientIteratorNext(iter)))
|
||||||
|
if(cl->useNewFBSize)
|
||||||
|
cl->newFBSizePending = TRUE;
|
||||||
|
else
|
||||||
|
rfbLog("Warning: Client %s does not support NewFBSize!\n ",cl->host);
|
||||||
|
rfbReleaseClientIterator(iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user