1
0
mirror of https://github.com/KDE/krfb synced 2026-07-01 07:41:17 -07:00

-include cleanups

-invitationmanager now really manages invitations
-invitation dialog displays invitations too
-start porting the real server code


svn path=/trunk/KDE/kdenetwork/krfb/; revision=649569
This commit is contained in:
Alessandro Praduroux
2007-04-02 20:44:39 +00:00
parent 171ffcfc95
commit cecfaa69b6
11 changed files with 122 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
(C) 2001-2003 by Tim Jansen <tim@tjansen.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
@@ -16,9 +17,21 @@
#include <QTcpServer>
#include <QTcpSocket>
#include <QTimer>
#include <QHostInfo>
#include <QApplication>
#include <QDesktopWidget>
#include <KConfig>
#include <KGlobal>
#include <KUser>
#include <KLocale>
#include <X11/Xutil.h>
#include <X11/extensions/XTest.h>
#include <QX11Info>
#include <rfb/rfb.h>
const int DEFAULT_TCP_PORT = 5900;
@@ -64,9 +77,8 @@ void KrfbServer::newConnection()
connect (conn, SIGNAL(disconnected()), SIGNAL(sessionFinished()));
fdNum = conn->socketDescriptor();
conn->close();
// TODO: start the actual sharing implementation
//_controller->startServer(fdNum);
startServer(fdNum);
}
void KrfbServer::enableDesktopControl(bool enable)
@@ -81,4 +93,45 @@ void KrfbServer::disconnectAndQuit()
emit quitApp();
}
void KrfbServer::startServer(int fd)
{
rfbScreenInfoPtr server;
XImage *framebufferImage;
framebufferImage = XGetImage(QX11Info::display(),
QApplication::desktop()->winId(),
0,
0,
QApplication::desktop()->width(),
QApplication::desktop()->height(),
AllPlanes,
ZPixmap);
int w = framebufferImage->width;
int h = framebufferImage->height;
char *fb = framebufferImage->data;
rfbLogEnable(0);
server = rfbGetScreen(0, 0, w, h,
framebufferImage->bits_per_pixel,
8,
framebufferImage->bits_per_pixel/8);
server->paddedWidthInBytes = framebufferImage->bytes_per_line;
server->frameBuffer = fb;
server->autoPort = TRUE;
server->inetdSock = fd;
server->desktopName = i18n("%1@%2 (shared desktop)", KUser().loginName(), QHostInfo::localHostName()).toLatin1();
// if (!myCursor)
// myCursor = rfbMakeXCursor(19, 19, (char*) cur, (char*) mask);
// server->cursor = myCursor;
rfbInitServer(server);
rfbRunEventLoop(server, -1, TRUE);
}