CVS: rdesktop/vnc vnc.c,1.4,1.5

Michael Gernoth <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop/vnc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19126/vnc

Modified Files:
	vnc.c 
Log Message:
VNC fixes from Johannes Schindelin <[email protected]>


Index: vnc.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/vnc/vnc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** vnc.c	15 Apr 2004 20:12:42 -0000	1.4
--- vnc.c	11 Sep 2004 17:08:49 -0000	1.5
***************
*** 85,89 ****
  vncHideCursor()
  {
! 	if (server->rfbClientHead)
  		rfbUndrawCursor(server);
  }
--- 85,89 ----
  vncHideCursor()
  {
! 	if (server->clientHead)
  		rfbUndrawCursor(server);
  }
***************
*** 219,223 ****
  
  	/* handle cursor */
! 	defaultPtrAddEvent(buttonMask, x, y, cl);
  }
  
--- 219,223 ----
  
  	/* handle cursor */
! 	rfbDefaultPtrAddEvent(buttonMask, x, y, cl);
  }
  
***************
*** 232,236 ****
  	int rfbListenSock, addrlen = sizeof(addr);
  
! 	rfbListenSock = ListenOnTCPPort(rfb_port);
  	fprintf(stderr, "Listening on VNC port %d\n", rfb_port);
  	if (rfbListenSock <= 0)
--- 232,236 ----
  	int rfbListenSock, addrlen = sizeof(addr);
  
! 	rfbListenSock = rfbListenOnTCPPort(rfb_port);
  	fprintf(stderr, "Listening on VNC port %d\n", rfb_port);
  	if (rfbListenSock <= 0)
***************
*** 260,265 ****
  				if (!fork())
  				{
  					printf("Connection successful.\n");
! 					rdp_main_loop();
  					printf("Disconnecting...\n");
  					rdp_disconnect();
--- 260,267 ----
  				if (!fork())
  				{
+ 					BOOL deactivated;
+ 					uint32_t ext_disc_reason;
  					printf("Connection successful.\n");
! 					rdp_main_loop(&deactivated,&ext_disc_reason);
  					printf("Disconnecting...\n");
  					rdp_disconnect();
***************
*** 294,309 ****
  #ifdef ENABLE_SHADOW
  	server->httpPort = 6124 + client_counter;
! 	server->rfbPort = 5924 + client_counter;
  	rfbInitSockets(server);
! 	server->rfbAlwaysShared = TRUE;
! 	server->rfbNeverShared = FALSE;
  #else
! 	server->rfbPort = -1;
! 	server->rfbAlwaysShared = FALSE;
! 	server->rfbNeverShared = FALSE;
  #endif
  	server->inetdSock = rfbClientSocket;
! 	server->rfbServerFormat.trueColour = FALSE;	/* activate colour maps */
! 	server->rfbDeferUpdateTime = defer_time;
  
  	frameBuffer = (vncBuffer *) malloc(sizeof(vncBuffer));
--- 296,311 ----
  #ifdef ENABLE_SHADOW
  	server->httpPort = 6124 + client_counter;
! 	server->port = 5924 + client_counter;
  	rfbInitSockets(server);
! 	server->alwaysShared = TRUE;
! 	server->neverShared = FALSE;
  #else
! 	server->port = -1;
! 	server->alwaysShared = FALSE;
! 	server->neverShared = FALSE;
  #endif
  	server->inetdSock = rfbClientSocket;
! 	server->serverFormat.trueColour = FALSE;	/* activate colour maps */
! 	server->deferUpdateTime = defer_time;
  
  	frameBuffer = (vncBuffer *) malloc(sizeof(vncBuffer));
***************
*** 313,317 ****
  	frameBuffer->data = server->frameBuffer;
  	frameBuffer->owner = FALSE;
! 	frameBuffer->format = &server->rfbServerFormat;
  
  	ui_set_clip(0, 0, g_width, g_height);
--- 315,319 ----
  	frameBuffer->data = server->frameBuffer;
  	frameBuffer->owner = FALSE;
! 	frameBuffer->format = &server->serverFormat;
  
  	ui_set_clip(0, 0, g_width, g_height);
***************
*** 319,326 ****
  	rfbInitServer(server);
  #ifndef ENABLE_SHADOW
! 	server->rfbPort = rfb_port;
  #else
! 	fprintf(stderr, "server listening on port %d (socket %d)\n", server->rfbPort,
! 		server->rfbListenSock);
  #endif
  
--- 321,328 ----
  	rfbInitServer(server);
  #ifndef ENABLE_SHADOW
! 	server->port = rfb_port;
  #else
! 	fprintf(stderr, "server listening on port %d (socket %d)\n", server->port,
! 		server->listenSock);
  #endif
  
***************
*** 333,337 ****
  ui_destroy_window()
  {
! 	rfbCloseClient(server->rfbClientHead);
  }
  
--- 335,339 ----
  ui_destroy_window()
  {
! 	rfbCloseClient(server->clientHead);
  }
  
***************
*** 355,359 ****
  		rfbProcessEvents(server, 0);
  		/* if client is gone, close connection */
! 		if (!server->rfbClientHead)
  			close(rdpSocket);
  		if (FD_ISSET(rdpSocket, &fds))
--- 357,361 ----
  		rfbProcessEvents(server, 0);
  		/* if client is gone, close connection */
! 		if (!server->clientHead)
  			close(rdpSocket);
  		if (FD_ISSET(rdpSocket, &fds))
***************
*** 466,469 ****
--- 468,472 ----
  	cursor->source = 0;
  	cursor->richSource = cdata;
+ 	cursor->cleanup = 0; // workaround: this produces a memleak
  
  	cursor->backRed = cursor->backGreen = cursor->backBlue = 0xffff;
***************
*** 934,939 ****
  
  	buf = vncGetRect(server, x, y, cx, cy);
! 	offset *= TOBYTES(server->rfbServerFormat.bitsPerPixel);
! 	cache_put_desktop(offset, cx, cy, cx, TOBYTES(server->rfbServerFormat.bitsPerPixel),
  			  (buf->data));
  }
--- 937,942 ----
  
  	buf = vncGetRect(server, x, y, cx, cy);
! 	offset *= TOBYTES(server->serverFormat.bitsPerPixel);
! 	cache_put_desktop(offset, cx, cy, cx, TOBYTES(server->serverFormat.bitsPerPixel),
  			  (buf->data));
  }
***************
*** 950,955 ****
  	oy = y;
  
! 	offset *= TOBYTES(server->rfbServerFormat.bitsPerPixel);
! 	data = cache_get_desktop(offset, cx, cy, TOBYTES(server->rfbServerFormat.bitsPerPixel));
  	if (data == NULL)
  		return;
--- 953,958 ----
  	oy = y;
  
! 	offset *= TOBYTES(server->serverFormat.bitsPerPixel);
! 	data = cache_get_desktop(offset, cx, cy, TOBYTES(server->serverFormat.bitsPerPixel));
  	if (data == NULL)
  		return;
***************
*** 1008,1013 ****
  vncPrintStats()
  {
! 	if (server && server->rfbClientHead)
! 		rfbPrintStats(server->rfbClientHead);
  }
  
--- 1011,1016 ----
  vncPrintStats()
  {
! 	if (server && server->clientHead)
! 		rfbPrintStats(server->clientHead);
  }
  
***************
*** 1027,1031 ****
  	vncHideCursor();
  
! 	if (s->rfbServerFormat.bitsPerPixel == src->format->bitsPerPixel
  	    && srcx + w <= src->w && srcy + h <= src->h)
  	{
--- 1030,1034 ----
  	vncHideCursor();
  
! 	if (s->serverFormat.bitsPerPixel == src->format->bitsPerPixel
  	    && srcx + w <= src->w && srcy + h <= src->h)
  	{
***************
*** 1241,1245 ****
  
  	// - Fill the rect in the local framebuffer
! 	if (s->rfbServerFormat.bitsPerPixel == 8)
  	{
  		// - Simple 8-bit fill
--- 1244,1248 ----
  
  	// - Fill the rect in the local framebuffer
! 	if (s->serverFormat.bitsPerPixel == 8)
  	{
  		// - Simple 8-bit fill
***************
*** 1270,1286 ****
  {
  	int xx, yy;
! 	vncBuffer *b = vncNewBuffer(w, h, s->rfbServerFormat.depth);
  
  	vncHideCursor();
  
! 	if (s->rfbServerFormat.bitsPerPixel == 8)
  	{
  		//simple copy
  		int srcstep, dststep;
  		char *srcdata, *dstdata;
! 		srcstep = s->paddedWidthInBytes * s->rfbServerFormat.bitsPerPixel / 8;
! 		dststep = w * s->rfbServerFormat.bitsPerPixel / 8;
  		dstdata = b->data;
! 		srcdata = s->frameBuffer + (y * srcstep + x * s->rfbServerFormat.bitsPerPixel / 8);
  		for (yy = 0; yy < h; yy++)
  		{
--- 1273,1289 ----
  {
  	int xx, yy;
! 	vncBuffer *b = vncNewBuffer(w, h, s->serverFormat.depth);
  
  	vncHideCursor();
  
! 	if (s->serverFormat.bitsPerPixel == 8)
  	{
  		//simple copy
  		int srcstep, dststep;
  		char *srcdata, *dstdata;
! 		srcstep = s->paddedWidthInBytes * s->serverFormat.bitsPerPixel / 8;
! 		dststep = w * s->serverFormat.bitsPerPixel / 8;
  		dstdata = b->data;
! 		srcdata = s->frameBuffer + (y * srcstep + x * s->serverFormat.bitsPerPixel / 8);
  		for (yy = 0; yy < h; yy++)
  		{
***************
*** 1342,1343 ****
--- 1345,1377 ----
  	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);
+ }
+ 



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.