mirror of
https://invent.kde.org/network/krfb
synced 2024-07-05 09:28:35 +00:00
sync (problems, still_)
svn path=/trunk/kdenetwork/krfb/; revision=130886
This commit is contained in:
parent
535748f4ea
commit
609aaccc8e
23
ChangeLog
23
ChangeLog
|
@ -1,6 +1,27 @@
|
||||||
|
2002-01-09 Tim Jansen <tim@tjansen.de>
|
||||||
|
|
||||||
|
* Fixed problems with closing dialogs
|
||||||
|
|
||||||
|
* krfb/main.cpp (main): Bugfix: better cleanup if quit is called
|
||||||
|
during connection dialog
|
||||||
|
|
||||||
|
2002-01-07 Tim Jansen <tim@tjansen.de>
|
||||||
|
|
||||||
|
* krfb/main.cpp (main): blocks SIGPIPE to avoid crashes on
|
||||||
|
unexpected client death
|
||||||
|
|
||||||
|
2002-01-06 Tim Jansen <tim@tjansen.de>
|
||||||
|
|
||||||
|
* lib/rfbServer.cc: start to replace all standard rfblib encodings
|
||||||
|
with those from TightVNC because they compress better
|
||||||
|
|
||||||
|
* lib/Connection.cc: reserve more space when resizing, added
|
||||||
|
functions for simulated writing, delayed sending (reserve
|
||||||
|
buffer, write later)
|
||||||
|
|
||||||
2002-01-05 Tim Jansen <tim@tjansen.de>
|
2002-01-05 Tim Jansen <tim@tjansen.de>
|
||||||
|
|
||||||
* lib/rfbServer.cc (update): removed blocks, added more sophistacated
|
* lib/rfbServer.cc (update): removed blocks, added more sophisticated
|
||||||
Hint handling in preparation for ZLib and Tight encodings
|
Hint handling in preparation for ZLib and Tight encodings
|
||||||
|
|
||||||
* lib/encodeRectangleHextile.cc: replaced cut&paste code with macros,
|
* lib/encodeRectangleHextile.cc: replaced cut&paste code with macros,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
SUBDIRS = lib krfb po doc include
|
SUBDIRS = lib krfb po doc include
|
||||||
|
|
||||||
EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO NOTES \
|
EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO NOTES \
|
||||||
|
|
1
TODO
1
TODO
|
@ -1,4 +1,5 @@
|
||||||
Todo:
|
Todo:
|
||||||
|
- reminder: enable non-raw in hextile, enable sendSingleHint
|
||||||
- i18n
|
- i18n
|
||||||
- docs
|
- docs
|
||||||
- knotify
|
- knotify
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
|
|
||||||
|
void ConfigurationDialog2::closeEvent(QCloseEvent *)
|
||||||
|
{
|
||||||
|
emit closed();
|
||||||
|
}
|
||||||
|
|
||||||
Configuration::Configuration() :
|
Configuration::Configuration() :
|
||||||
preconfiguredFlag(false),
|
preconfiguredFlag(false),
|
||||||
oneConnectionFlag(false)
|
oneConnectionFlag(false)
|
||||||
|
@ -41,6 +46,7 @@ Configuration::Configuration() :
|
||||||
SLOT(cancelPressed()));
|
SLOT(cancelPressed()));
|
||||||
connect(confDlg.applyButton, SIGNAL(clicked()),
|
connect(confDlg.applyButton, SIGNAL(clicked()),
|
||||||
SLOT(applyPressed()));
|
SLOT(applyPressed()));
|
||||||
|
connect(&confDlg, SIGNAL(closed()), SLOT(cancelPressed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration::Configuration(bool oneConnection, bool askOnConnect,
|
Configuration::Configuration(bool oneConnection, bool askOnConnect,
|
||||||
|
|
|
@ -24,6 +24,14 @@
|
||||||
#include <qvalidator.h>
|
#include <qvalidator.h>
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
|
|
||||||
|
class ConfigurationDialog2 : public ConfigurationDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
virtual void closeEvent(QCloseEvent *);
|
||||||
|
signals:
|
||||||
|
void closed();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class stores the app's configuration and also 'drives'
|
* This class stores the app's configuration and also 'drives'
|
||||||
* the configuration dialog.
|
* the configuration dialog.
|
||||||
|
@ -57,7 +65,7 @@ private:
|
||||||
void saveToKConfig();
|
void saveToKConfig();
|
||||||
void saveToDialog();
|
void saveToDialog();
|
||||||
|
|
||||||
ConfigurationDialog confDlg;
|
ConfigurationDialog2 confDlg;
|
||||||
QIntValidator *portValidator;
|
QIntValidator *portValidator;
|
||||||
|
|
||||||
bool preconfiguredFlag;
|
bool preconfiguredFlag;
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <qwindowdefs.h>
|
#include <qwindowdefs.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#define VERSION "0.6"
|
#define VERSION "0.6"
|
||||||
|
|
||||||
static const char *description = I18N_NOOP("VNC-compatible server to share "
|
static const char *description = I18N_NOOP("VNC-compatible server to share "
|
||||||
|
@ -107,7 +109,7 @@ int main(int argc, char *argv[])
|
||||||
args->isSet(ARG_PASSWORD) ||
|
args->isSet(ARG_PASSWORD) ||
|
||||||
args->isSet(ARG_REMOTE_CONTROL) ||
|
args->isSet(ARG_REMOTE_CONTROL) ||
|
||||||
args->isSet(ARG_DONT_CONFIRM_CONNECT)) {
|
args->isSet(ARG_DONT_CONFIRM_CONNECT)) {
|
||||||
|
|
||||||
bool oneConnection = args->isSet(ARG_ONE_SESSION);
|
bool oneConnection = args->isSet(ARG_ONE_SESSION);
|
||||||
bool askOnConnect = !args->isSet(ARG_DONT_CONFIRM_CONNECT);
|
bool askOnConnect = !args->isSet(ARG_DONT_CONFIRM_CONNECT);
|
||||||
bool allowDesktopControl = args->isSet(ARG_REMOTE_CONTROL);
|
bool allowDesktopControl = args->isSet(ARG_REMOTE_CONTROL);
|
||||||
|
@ -127,14 +129,17 @@ int main(int argc, char *argv[])
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
QObject::connect(&app, SIGNAL(lastWindowClosed()),
|
QObject::connect(&app, SIGNAL(lastWindowClosed()),
|
||||||
&app, SLOT(quit()));
|
&controller, SLOT(closeSession()));
|
||||||
|
|
||||||
QObject::connect(&trayicon, SIGNAL(showConfigure()),
|
QObject::connect(&app, SIGNAL(lastWindowClosed()),
|
||||||
config, SLOT(showDialog()));
|
&app, SLOT(quit()));
|
||||||
|
|
||||||
QObject::connect(&trayicon, SIGNAL(connectionClosed()),
|
QObject::connect(&trayicon, SIGNAL(connectionClosed()),
|
||||||
&controller, SLOT(closeSession()));
|
&controller, SLOT(closeSession()));
|
||||||
|
|
||||||
|
QObject::connect(&trayicon, SIGNAL(showConfigure()),
|
||||||
|
config, SLOT(showDialog()));
|
||||||
|
|
||||||
QObject::connect(config, SIGNAL(portChanged()),
|
QObject::connect(config, SIGNAL(portChanged()),
|
||||||
&controller, SLOT(rebind()));
|
&controller, SLOT(rebind()));
|
||||||
|
|
||||||
|
@ -149,6 +154,11 @@ int main(int argc, char *argv[])
|
||||||
QObject::connect(&controller, SIGNAL(sessionFinished()),
|
QObject::connect(&controller, SIGNAL(sessionFinished()),
|
||||||
&trayicon, SLOT(closeConnection()));
|
&trayicon, SLOT(closeConnection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sigset_t sigs;
|
||||||
|
sigemptyset(&sigs);
|
||||||
|
sigaddset(&sigs, SIGPIPE);
|
||||||
|
sigprocmask(SIG_BLOCK, &sigs, 0);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,7 @@ RFBConnection::RFBConnection(Display *_dpy,
|
||||||
strncpy(password, cpassword.latin1(),
|
strncpy(password, cpassword.latin1(),
|
||||||
(8 <= cpassword.length()) ? 8 : cpassword.length());
|
(8 <= cpassword.length()) ? 8 : cpassword.length());
|
||||||
|
|
||||||
bufferedConnection = new BufferedConnection(32768, 32768);
|
connection = new BufferedConnection(32768, 16384);
|
||||||
connection = bufferedConnection;
|
|
||||||
|
|
||||||
XTestGrabControl(dpy, true);
|
XTestGrabControl(dpy, true);
|
||||||
disabler.disable = false;
|
disabler.disable = false;
|
||||||
|
@ -60,7 +59,7 @@ RFBConnection::RFBConnection(Display *_dpy,
|
||||||
|
|
||||||
RFBConnection::~RFBConnection() {
|
RFBConnection::~RFBConnection() {
|
||||||
destroyFramebuffer();
|
destroyFramebuffer();
|
||||||
delete bufferedConnection;
|
delete connection;
|
||||||
|
|
||||||
disabler.disable = true;
|
disabler.disable = true;
|
||||||
disabler.dpy = dpy;
|
disabler.dpy = dpy;
|
||||||
|
|
|
@ -53,14 +53,12 @@ public:
|
||||||
RFBConnection(Display *dpy, int fd,
|
RFBConnection(Display *dpy, int fd,
|
||||||
const QString &cpassword,
|
const QString &cpassword,
|
||||||
bool allowInput);
|
bool allowInput);
|
||||||
~RFBConnection();
|
virtual ~RFBConnection();
|
||||||
virtual void handleKeyEvent(KeyEvent &keyEvent);
|
virtual void handleKeyEvent(KeyEvent &keyEvent);
|
||||||
virtual void handlePointerEvent(PointerEvent &pointerEvent);
|
virtual void handlePointerEvent(PointerEvent &pointerEvent);
|
||||||
virtual void getServerInitialisation( ServerInitialisation &_serverInitialisation );
|
virtual void getServerInitialisation( ServerInitialisation &_serverInitialisation );
|
||||||
void scanUpdates();
|
void scanUpdates();
|
||||||
|
|
||||||
BufferedConnection *bufferedConnection;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createFramebuffer();
|
void createFramebuffer();
|
||||||
void destroyFramebuffer();
|
void destroyFramebuffer();
|
||||||
|
|
|
@ -41,6 +41,11 @@
|
||||||
#define ASSERT(x) Q_ASSERT(x)
|
#define ASSERT(x) Q_ASSERT(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void ConnectionDialog::closeEvent(QCloseEvent *)
|
||||||
|
{
|
||||||
|
emit closed();
|
||||||
|
}
|
||||||
|
|
||||||
RFBController::RFBController(Configuration *c) :
|
RFBController::RFBController(Configuration *c) :
|
||||||
configuration(c),
|
configuration(c),
|
||||||
socket(0),
|
socket(0),
|
||||||
|
@ -51,6 +56,7 @@ RFBController::RFBController(Configuration *c) :
|
||||||
SLOT(dialogAccepted()));
|
SLOT(dialogAccepted()));
|
||||||
connect(dialog.refuseConnectionButton, SIGNAL(clicked()),
|
connect(dialog.refuseConnectionButton, SIGNAL(clicked()),
|
||||||
SLOT(dialogRefused()));
|
SLOT(dialogRefused()));
|
||||||
|
connect(&dialog, SIGNAL(closed()), SLOT(dialogRefused()));
|
||||||
|
|
||||||
startServer();
|
startServer();
|
||||||
}
|
}
|
||||||
|
@ -152,7 +158,7 @@ void RFBController::idleSlot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RFBController::checkWriteBuffer() {
|
void RFBController::checkWriteBuffer() {
|
||||||
BufferedConnection *bc = connection->bufferedConnection;
|
BufferedConnection *bc = connection->connection;
|
||||||
bool bufferEmpty = (bc->senderBuffer.end - bc->senderBuffer.pos) == 0;
|
bool bufferEmpty = (bc->senderBuffer.end - bc->senderBuffer.pos) == 0;
|
||||||
socket->enableWrite(!bufferEmpty);
|
socket->enableWrite(!bufferEmpty);
|
||||||
if (bufferEmpty && !idleUpdateScheduled && connection) {
|
if (bufferEmpty && !idleUpdateScheduled && connection) {
|
||||||
|
@ -165,7 +171,7 @@ void RFBController::socketReadable() {
|
||||||
if ((!socket) || (!connection))
|
if ((!socket) || (!connection))
|
||||||
return;
|
return;
|
||||||
int fd = socket->socket();
|
int fd = socket->socket();
|
||||||
BufferedConnection *bc = connection->bufferedConnection;
|
BufferedConnection *bc = connection->connection;
|
||||||
int count = read(fd,
|
int count = read(fd,
|
||||||
bc->receiverBuffer.data,
|
bc->receiverBuffer.data,
|
||||||
bc->receiverBuffer.size);
|
bc->receiverBuffer.size);
|
||||||
|
@ -173,9 +179,6 @@ void RFBController::socketReadable() {
|
||||||
bc->receiverBuffer.end += count;
|
bc->receiverBuffer.end += count;
|
||||||
else {
|
else {
|
||||||
closeSession();
|
closeSession();
|
||||||
KMessageBox::error(0,
|
|
||||||
i18n("An error occurred while reading from the remote client. The connection will be terminated."),
|
|
||||||
i18n("KRfb Error"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (connection->currentState && bc->hasReceiverBufferData()) {
|
while (connection->currentState && bc->hasReceiverBufferData()) {
|
||||||
|
@ -194,7 +197,7 @@ void RFBController::socketWritable() {
|
||||||
return;
|
return;
|
||||||
int fd = socket->socket();
|
int fd = socket->socket();
|
||||||
|
|
||||||
BufferedConnection *bc = connection->bufferedConnection;
|
BufferedConnection *bc = connection->connection;
|
||||||
ASSERT((bc->senderBuffer.end - bc->senderBuffer.pos) > 0);
|
ASSERT((bc->senderBuffer.end - bc->senderBuffer.pos) > 0);
|
||||||
int count = write(fd,
|
int count = write(fd,
|
||||||
bc->senderBuffer.data + bc->senderBuffer.pos,
|
bc->senderBuffer.data + bc->senderBuffer.pos,
|
||||||
|
@ -204,9 +207,6 @@ void RFBController::socketWritable() {
|
||||||
checkWriteBuffer();
|
checkWriteBuffer();
|
||||||
} else {
|
} else {
|
||||||
closeSession();
|
closeSession();
|
||||||
KMessageBox::error(0,
|
|
||||||
i18n("An error occurred while writing to the remote client. The connection will be terminated."),
|
|
||||||
i18n("KRfb Error"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,8 @@ void RFBController::closeSession() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RFBController::dialogAccepted() {
|
void RFBController::dialogAccepted() {
|
||||||
ASSERT(socket);
|
if (!socket)
|
||||||
|
return;
|
||||||
ASSERT(!connection);
|
ASSERT(!connection);
|
||||||
|
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
|
@ -230,7 +231,8 @@ void RFBController::dialogAccepted() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RFBController::dialogRefused() {
|
void RFBController::dialogRefused() {
|
||||||
ASSERT(socket);
|
if (!socket)
|
||||||
|
return;
|
||||||
ASSERT(!connection);
|
ASSERT(!connection);
|
||||||
|
|
||||||
closeSocket();
|
closeSocket();
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
// rfbconnection must be last because of X11 headers
|
// rfbconnection must be last because of X11 headers
|
||||||
#include "rfbconnection.h"
|
#include "rfbconnection.h"
|
||||||
|
|
||||||
|
class QCloseEvent;
|
||||||
|
|
||||||
using namespace rfb;
|
using namespace rfb;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -39,6 +41,15 @@ typedef enum {
|
||||||
RFB_CONNECTED
|
RFB_CONNECTED
|
||||||
} RFBState;
|
} RFBState;
|
||||||
|
|
||||||
|
class ConnectionDialog : public KRFBConnectionDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
virtual void closeEvent(QCloseEvent *);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void closed();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages sockets, drives the RGBConnection and triggers the connection
|
* Manages sockets, drives the RGBConnection and triggers the connection
|
||||||
* dialog.
|
* dialog.
|
||||||
|
@ -52,7 +63,7 @@ class RFBController : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
RFBController(Configuration *c);
|
RFBController(Configuration *c);
|
||||||
~RFBController();
|
virtual ~RFBController();
|
||||||
|
|
||||||
RFBState state();
|
RFBState state();
|
||||||
|
|
||||||
|
@ -75,7 +86,7 @@ private:
|
||||||
KServerSocket *serversocket;
|
KServerSocket *serversocket;
|
||||||
KSocket *socket;
|
KSocket *socket;
|
||||||
RFBConnection *connection;
|
RFBConnection *connection;
|
||||||
KRFBConnectionDialog dialog;
|
ConnectionDialog dialog;
|
||||||
bool idleUpdateScheduled;
|
bool idleUpdateScheduled;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user