mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:41:17 -07:00
working, but buggy
svn path=/trunk/kdenetwork/krfb/; revision=135649
This commit is contained in:
@@ -1 +0,0 @@
|
||||
3.0 support has been removed for this release, but will re-appear soon.
|
||||
16
ROADMAP
16
ROADMAP
@@ -1,25 +1,19 @@
|
||||
Version 0.5 (2002/01/02): First release
|
||||
- first release
|
||||
- port x0rfbserver wiith simplified KDE/Qt interface
|
||||
- port x0rfbserver with simplified KDE/Qt interface
|
||||
|
||||
|
||||
Version 0.6 (2002/02/??): Improve RFB backend
|
||||
- improve RFB backend
|
||||
- replace x0rfbserver's encoders with those from TightVNCs WinVNC
|
||||
<- port ZLib and Tight encodings from TightVNCs WinVNC
|
||||
<- clip framebuffer updates to requested region
|
||||
<- rewrite Connection to use linked buffers
|
||||
- replace x0rfbserver's backend with libvncserver
|
||||
<- knotify
|
||||
<- UI for multiple users (if libvncserver is chosen)
|
||||
|
||||
Version 0.7 (2002/??/??): Better integration with KDE, more end-user friendly
|
||||
- i18n
|
||||
- kded module or some other way to have a small module listening on the Rfb
|
||||
port (like inetd) that then starts KRfb
|
||||
- kded module 'kinetd' to listening on the Rfb port that then starts KRfb
|
||||
- kcontrol module to configure the kded thing
|
||||
- on startup a dialog appears that allows the user to invite somebody
|
||||
else using email (and later other mechanisms). Dialog can be turned
|
||||
off, of course
|
||||
using email (and later other mechanisms). Dialog can be turned off forever,
|
||||
of course
|
||||
|
||||
Version 0.8 (2002/??/??):
|
||||
- docs
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "XUpdateScanner.h"
|
||||
|
||||
unsigned int scanlines[32] = { 0, 16, 8, 24,
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <kmessagebox.h>
|
||||
#include <klocale.h>
|
||||
#include <kextsock.h>
|
||||
#include <qcursor.h>
|
||||
#include <qwindowdefs.h>
|
||||
#include <qtimer.h>
|
||||
#include <qcheckbox.h>
|
||||
@@ -59,13 +60,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static void keyboardHook(Bool down, KeySym keySym, rfbClientPtr cl)
|
||||
static void keyboardHook(Bool down, KeySym keySym, rfbClientPtr)
|
||||
{
|
||||
AppLocker a;
|
||||
self->handleKeyEvent(down?true:false, keySym);
|
||||
}
|
||||
|
||||
static void pointerHook(int bm, int x, int y, rfbClientPtr cl)
|
||||
static void pointerHook(int bm, int x, int y, rfbClientPtr)
|
||||
{
|
||||
AppLocker a;
|
||||
self->handlePointerEvent(bm, x, y);
|
||||
@@ -110,6 +111,7 @@ RFBController::RFBController(Configuration *c) :
|
||||
connect(dialog.refuseConnectionButton, SIGNAL(clicked()),
|
||||
SLOT(dialogRefused()));
|
||||
connect(&dialog, SIGNAL(closed()), SLOT(dialogRefused()));
|
||||
connect(&idleTimer, SIGNAL(timeout()), SLOT(idleSlot()));
|
||||
|
||||
startServer();
|
||||
}
|
||||
@@ -136,10 +138,38 @@ void RFBController::startServer(bool xtestGrab)
|
||||
int h = framebufferImage->height;
|
||||
int bpp = framebufferImage->depth;
|
||||
char *fb = framebufferImage->data;
|
||||
|
||||
int red_max, green_max, blue_max;
|
||||
int red_shift, green_shift, blue_shift;
|
||||
|
||||
server = rfbGetScreen(0, 0, w, h,
|
||||
(bpp==4) ? 8 : 5,
|
||||
0, bpp);
|
||||
if (bpp == 8) {
|
||||
red_max = 3;
|
||||
green_max = 7;
|
||||
blue_max = 3;
|
||||
red_shift = 0;
|
||||
green_shift = 2;
|
||||
blue_shift = 5;
|
||||
} else {
|
||||
red_shift = 0;
|
||||
if ( framebufferImage->red_mask )
|
||||
while (!(framebufferImage->red_mask & (1 << red_shift)))
|
||||
red_shift++;
|
||||
green_shift = 0;
|
||||
if (framebufferImage->green_mask)
|
||||
while (!(framebufferImage->green_mask & (1 << green_shift)))
|
||||
green_shift++;
|
||||
blue_shift = 0;
|
||||
if (framebufferImage->blue_mask)
|
||||
while (!(framebufferImage->blue_mask & (1 << blue_shift)))
|
||||
blue_shift++;
|
||||
red_max = framebufferImage->red_mask >> red_shift;
|
||||
green_max = framebufferImage->green_mask >> green_shift;
|
||||
blue_max = framebufferImage->blue_mask >> blue_shift;
|
||||
}
|
||||
|
||||
server = rfbGetScreen2(0, 0, w, h, bpp/8,
|
||||
red_max, green_max, blue_max,
|
||||
red_shift, green_shift, blue_shift);
|
||||
server->frameBuffer = fb;
|
||||
server->rfbPort = configuration->port();
|
||||
//server->udpPort = configuration->port();
|
||||
@@ -245,12 +275,12 @@ void RFBController::idleSlot()
|
||||
|
||||
Hint *h;
|
||||
|
||||
for (h = v.first(); h != 0; h = v.next())
|
||||
for (h = v.first(); h != 0; h = v.next()) {
|
||||
rfbMarkRectAsModified(server, h->left(),
|
||||
h->top(),
|
||||
h->right(),
|
||||
h->bottom());
|
||||
|
||||
}
|
||||
QPoint p = QCursor::pos();
|
||||
defaultPtrAddEvent(0, p.x(),p.y(), client);
|
||||
}
|
||||
@@ -268,7 +298,7 @@ void RFBController::dialogRefused()
|
||||
emit sessionRefused();
|
||||
}
|
||||
|
||||
bool RFBController::handleCheckPassword(const char *p, int len)
|
||||
bool RFBController::handleCheckPassword(const char *, int)
|
||||
{
|
||||
return TRUE;
|
||||
// TODO
|
||||
|
||||
@@ -10,7 +10,7 @@ libvncserver_a_SOURCES = main.c rfbserver.c sraRegion.c auth.c sockets.c \
|
||||
EXTRA_DIST = $(libvncserver_a_SOURCES) CHANGES COPYING \
|
||||
README TODO
|
||||
|
||||
CFLAGS = @CFLAGS@ -DHAVE_PTHREADS
|
||||
CFLAGS = @CFLAGS@ -DHAVE_PTHREADS -DALLOW24BPP
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ rfbSendCursorShape(cl)
|
||||
CARD8 bitmapByte;
|
||||
|
||||
pCursor = cl->screen->getCursorPtr(cl);
|
||||
//if(!pCursor) return TRUE;
|
||||
/*if(!pCursor) return TRUE;*/
|
||||
|
||||
if (cl->useRichCursorEncoding) {
|
||||
if(pCursor && !pCursor->richSource)
|
||||
@@ -227,7 +227,7 @@ rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskSt
|
||||
|
||||
cursor->width=width;
|
||||
cursor->height=height;
|
||||
//cursor->backRed=cursor->backGreen=cursor->backBlue=0xffff;
|
||||
/*cursor->backRed=cursor->backGreen=cursor->backBlue=0xffff;*/
|
||||
cursor->foreRed=cursor->foreGreen=cursor->foreBlue=0xffff;
|
||||
|
||||
cursor->source = (char*)calloc(w,height);
|
||||
|
||||
@@ -92,7 +92,7 @@ httpInitSockets(rfbScreenInfoPtr rfbScreen)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//AddEnabledDevice(httpListenSock);
|
||||
/*AddEnabledDevice(httpListenSock);*/
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ httpCheckFds(rfbScreenInfoPtr rfbScreen)
|
||||
return;
|
||||
}
|
||||
|
||||
//AddEnabledDevice(httpSock);
|
||||
/*AddEnabledDevice(httpSock);*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ httpCloseSock(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
fclose(rfbScreen->httpFP);
|
||||
rfbScreen->httpFP = NULL;
|
||||
//RemoveEnabledDevice(httpSock);
|
||||
/*RemoveEnabledDevice(httpSock);*/
|
||||
rfbScreen->httpSock = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ char rfbEndianTest = (_BYTE_ORDER == _LITTLE_ENDIAN);
|
||||
*/
|
||||
|
||||
void
|
||||
rfbLog(char *format, ...)
|
||||
rfbLog(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[256];
|
||||
@@ -61,7 +61,7 @@ rfbLog(char *format, ...)
|
||||
UNLOCK(logMutex);
|
||||
}
|
||||
|
||||
void rfbLogPerror(char *str)
|
||||
void rfbLogPerror(const char *str)
|
||||
{
|
||||
rfbLog("%s: %s\n", str, strerror(errno));
|
||||
}
|
||||
@@ -302,7 +302,7 @@ listenerRun(void *data)
|
||||
|
||||
len = sizeof(peer);
|
||||
while ((client_fd = accept(rfbScreen->rfbListenSock,
|
||||
(struct sockaddr *)&peer, &len)) >= 0) {
|
||||
(struct sockaddr*)&peer, &len)) >= 0) {
|
||||
cl = rfbNewClient(rfbScreen,client_fd);
|
||||
len = sizeof(peer);
|
||||
cl->client_thread = &client_thread;
|
||||
@@ -338,7 +338,7 @@ rfbRefuseOnHoldClient(rfbClientPtr cl)
|
||||
rfbClientConnectionGone(cl);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
defaultKbdAddEvent(Bool down, KeySym keySym, rfbClientPtr cl)
|
||||
{
|
||||
}
|
||||
@@ -452,10 +452,33 @@ enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl)
|
||||
return RFB_CLIENT_ACCEPT;
|
||||
}
|
||||
|
||||
|
||||
rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
|
||||
int width,int height,int bitsPerSample,int samplesPerPixel,
|
||||
int bytesPerPixel)
|
||||
{
|
||||
if(bytesPerPixel == 1) {
|
||||
return rfbGetScreen2(argc, argv, width, height, bytesPerPixel,
|
||||
7, 7, 3, 0, 3, 6);
|
||||
} else {
|
||||
int redMax = (1 << bitsPerSample) - 1;
|
||||
int greenMax = (1 << bitsPerSample) - 1;
|
||||
int blueMax = (1 << bitsPerSample) - 1;
|
||||
if(rfbEndianTest) {
|
||||
return rfbGetScreen2(argc, argv, width, height, bytesPerPixel,
|
||||
redMax, greenMax, blueMax,
|
||||
0, bitsPerSample, bitsPerSample * 2);
|
||||
} else {
|
||||
return rfbGetScreen2(argc, argv, width, height, bytesPerPixel,
|
||||
redMax, greenMax, blueMax,
|
||||
bitsPerSample*3, bitsPerSample*2, bitsPerSample);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rfbScreenInfoPtr rfbGetScreen2(int* argc,char** argv,
|
||||
int width,int height,int bytesPerPixel,
|
||||
int redMax, int greenMax, int blueMax,
|
||||
int redShift, int greenShift, int blueShift)
|
||||
{
|
||||
rfbScreenInfoPtr rfbScreen=malloc(sizeof(rfbScreenInfo));
|
||||
rfbPixelFormat* format=&rfbScreen->rfbServerFormat;
|
||||
@@ -522,27 +545,12 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
|
||||
rfbScreen->colourMap.is16 = 0;
|
||||
rfbScreen->colourMap.data.bytes = NULL;
|
||||
|
||||
if(bytesPerPixel == 1) {
|
||||
format->redMax = 7;
|
||||
format->greenMax = 7;
|
||||
format->blueMax = 3;
|
||||
format->redShift = 0;
|
||||
format->greenShift = 3;
|
||||
format->blueShift = 6;
|
||||
} else {
|
||||
format->redMax = (1 << bitsPerSample) - 1;
|
||||
format->greenMax = (1 << bitsPerSample) - 1;
|
||||
format->blueMax = (1 << bitsPerSample) - 1;
|
||||
if(rfbEndianTest) {
|
||||
format->redShift = 0;
|
||||
format->greenShift = bitsPerSample;
|
||||
format->blueShift = bitsPerSample * 2;
|
||||
} else {
|
||||
format->redShift = bitsPerSample*3;
|
||||
format->greenShift = bitsPerSample*2;
|
||||
format->blueShift = bitsPerSample;
|
||||
}
|
||||
}
|
||||
format->redMax = redMax;
|
||||
format->greenMax = greenMax;
|
||||
format->blueMax = blueMax;
|
||||
format->redShift = redShift;
|
||||
format->greenShift = greenShift;
|
||||
format->blueShift = blueShift;
|
||||
|
||||
/* cursor */
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ typedef unsigned long KeySym;
|
||||
#undef SOCKET
|
||||
#define SOCKET int
|
||||
#else
|
||||
int max(int,int);
|
||||
#define max(a,b) (((a)>(b))?(a):(b))
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#define SOCKET int
|
||||
@@ -757,8 +757,8 @@ extern void rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, c
|
||||
|
||||
/* main.c */
|
||||
|
||||
extern void rfbLog(char *format, ...);
|
||||
extern void rfbLogPerror(char *str);
|
||||
extern void rfbLog(const char *format, ...);
|
||||
extern void rfbLogPerror(const char *str);
|
||||
|
||||
void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy);
|
||||
void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy);
|
||||
@@ -778,6 +778,10 @@ Bool rfbCheckPasswordByList(rfbClientPtr cl,char* response,int len);
|
||||
extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
|
||||
int width,int height,int bitsPerSample,int samplesPerPixel,
|
||||
int bytesPerPixel);
|
||||
extern rfbScreenInfoPtr rfbGetScreen2(int* argc,char** argv,
|
||||
int width,int height,int bytesPerPixel,
|
||||
int redMax, int greenMax, int blueMax,
|
||||
int redShift, int greenShift, int blueShift);
|
||||
extern void rfbInitServer(rfbScreenInfoPtr rfbScreen);
|
||||
extern void rfbScreenCleanup(rfbScreenInfoPtr screenInfo);
|
||||
|
||||
|
||||
@@ -271,9 +271,10 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
|
||||
if (WriteExact(cl, pv, sz_rfbProtocolVersionMsg) < 0) {
|
||||
rfbLogPerror("rfbNewClient: write");
|
||||
rfbCloseClient(cl);
|
||||
// TODO: memory leak here (cl is never freed)
|
||||
// can rfbClientConnectionGone called at this time?
|
||||
// tim@tjansen.de
|
||||
/* TODO: memory leak here (cl is never freed)
|
||||
* can rfbClientConnectionGone called at this time?
|
||||
* tim@tjansen.de
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,10 @@ struct timeval
|
||||
|
||||
#include "rfb.h"
|
||||
|
||||
//#ifndef WIN32
|
||||
/*#ifndef WIN32
|
||||
int max(int i,int j) { return(i<j?j:i); }
|
||||
//#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
int rfbMaxClientWait = 20000; /* time (ms) after which we decide client has
|
||||
gone away - needed to stop us hanging */
|
||||
@@ -270,9 +271,11 @@ rfbCloseClient(cl)
|
||||
rfbClientPtr cl;
|
||||
{
|
||||
LOCK(cl->updateMutex);
|
||||
FD_CLR(cl->sock,&(cl->screen->allFds));
|
||||
close(cl->sock);
|
||||
cl->sock = -1;
|
||||
if (cl->sock != -1) {
|
||||
FD_CLR(cl->sock,&(cl->screen->allFds));
|
||||
close(cl->sock);
|
||||
cl->sock = -1;
|
||||
}
|
||||
TSIGNAL(cl->updateCond);
|
||||
UNLOCK(cl->updateMutex);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
//#include <stdio.h>
|
||||
/*#include <stdio.h>*/
|
||||
#include "rfb.h"
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#include <jpeglib.h>
|
||||
|
||||
|
||||
/* Note: The following constant should not be changed. */
|
||||
#define TIGHT_MIN_TO_COMPRESS 12
|
||||
|
||||
|
||||
@@ -259,8 +259,9 @@ rfbSetTranslateFunction(cl)
|
||||
#endif
|
||||
(cl->screen->rfbServerFormat.bitsPerPixel != 32))
|
||||
{
|
||||
rfbLog("%s: server bits per pixel not 8, 16 or 32\n",
|
||||
"rfbSetTranslateFunction");
|
||||
rfbLog("%s: server bits per pixel not 8, 16 or 32 (is %d)\n",
|
||||
"rfbSetTranslateFunction",
|
||||
cl->screen->rfbServerFormat.bitsPerPixel);
|
||||
rfbCloseClient(cl);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user