1
0
mirror of https://invent.kde.org/network/krfb synced 2024-07-03 00:18:36 +00:00

sync (problems, still_)

svn path=/trunk/kdenetwork/krfb/; revision=130886
This commit is contained in:
Tim Jansen 2002-01-09 23:15:05 +00:00
parent 535748f4ea
commit 609aaccc8e
10 changed files with 81 additions and 26 deletions

View File

@ -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>
* 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
* lib/encodeRectangleHextile.cc: replaced cut&paste code with macros,

View File

@ -1,4 +1,3 @@
SUBDIRS = lib krfb po doc include
EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO NOTES \

1
TODO
View File

@ -1,4 +1,5 @@
Todo:
- reminder: enable non-raw in hextile, enable sendSingleHint
- i18n
- docs
- knotify

View File

@ -24,6 +24,11 @@
#include <qlineedit.h>
#include <qcheckbox.h>
void ConfigurationDialog2::closeEvent(QCloseEvent *)
{
emit closed();
}
Configuration::Configuration() :
preconfiguredFlag(false),
oneConnectionFlag(false)
@ -41,6 +46,7 @@ Configuration::Configuration() :
SLOT(cancelPressed()));
connect(confDlg.applyButton, SIGNAL(clicked()),
SLOT(applyPressed()));
connect(&confDlg, SIGNAL(closed()), SLOT(cancelPressed()));
}
Configuration::Configuration(bool oneConnection, bool askOnConnect,

View File

@ -24,6 +24,14 @@
#include <qvalidator.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'
* the configuration dialog.
@ -57,7 +65,7 @@ private:
void saveToKConfig();
void saveToDialog();
ConfigurationDialog confDlg;
ConfigurationDialog2 confDlg;
QIntValidator *portValidator;
bool preconfiguredFlag;

View File

@ -32,6 +32,8 @@
#include <qobject.h>
#include <qwindowdefs.h>
#include <signal.h>
#define VERSION "0.6"
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_REMOTE_CONTROL) ||
args->isSet(ARG_DONT_CONFIRM_CONNECT)) {
bool oneConnection = args->isSet(ARG_ONE_SESSION);
bool askOnConnect = !args->isSet(ARG_DONT_CONFIRM_CONNECT);
bool allowDesktopControl = args->isSet(ARG_REMOTE_CONTROL);
@ -127,14 +129,17 @@ int main(int argc, char *argv[])
return 1;
QObject::connect(&app, SIGNAL(lastWindowClosed()),
&app, SLOT(quit()));
&controller, SLOT(closeSession()));
QObject::connect(&trayicon, SIGNAL(showConfigure()),
config, SLOT(showDialog()));
QObject::connect(&app, SIGNAL(lastWindowClosed()),
&app, SLOT(quit()));
QObject::connect(&trayicon, SIGNAL(connectionClosed()),
&controller, SLOT(closeSession()));
QObject::connect(&trayicon, SIGNAL(showConfigure()),
config, SLOT(showDialog()));
QObject::connect(config, SIGNAL(portChanged()),
&controller, SLOT(rebind()));
@ -149,6 +154,11 @@ int main(int argc, char *argv[])
QObject::connect(&controller, SIGNAL(sessionFinished()),
&trayicon, SLOT(closeConnection()));
}
sigset_t sigs;
sigemptyset(&sigs);
sigaddset(&sigs, SIGPIPE);
sigprocmask(SIG_BLOCK, &sigs, 0);
return app.exec();
}

View File

@ -47,8 +47,7 @@ RFBConnection::RFBConnection(Display *_dpy,
strncpy(password, cpassword.latin1(),
(8 <= cpassword.length()) ? 8 : cpassword.length());
bufferedConnection = new BufferedConnection(32768, 32768);
connection = bufferedConnection;
connection = new BufferedConnection(32768, 16384);
XTestGrabControl(dpy, true);
disabler.disable = false;
@ -60,7 +59,7 @@ RFBConnection::RFBConnection(Display *_dpy,
RFBConnection::~RFBConnection() {
destroyFramebuffer();
delete bufferedConnection;
delete connection;
disabler.disable = true;
disabler.dpy = dpy;

View File

@ -53,14 +53,12 @@ public:
RFBConnection(Display *dpy, int fd,
const QString &cpassword,
bool allowInput);
~RFBConnection();
virtual ~RFBConnection();
virtual void handleKeyEvent(KeyEvent &keyEvent);
virtual void handlePointerEvent(PointerEvent &pointerEvent);
virtual void getServerInitialisation( ServerInitialisation &_serverInitialisation );
void scanUpdates();
BufferedConnection *bufferedConnection;
private:
void createFramebuffer();
void destroyFramebuffer();

View File

@ -41,6 +41,11 @@
#define ASSERT(x) Q_ASSERT(x)
#endif
void ConnectionDialog::closeEvent(QCloseEvent *)
{
emit closed();
}
RFBController::RFBController(Configuration *c) :
configuration(c),
socket(0),
@ -51,6 +56,7 @@ RFBController::RFBController(Configuration *c) :
SLOT(dialogAccepted()));
connect(dialog.refuseConnectionButton, SIGNAL(clicked()),
SLOT(dialogRefused()));
connect(&dialog, SIGNAL(closed()), SLOT(dialogRefused()));
startServer();
}
@ -152,7 +158,7 @@ void RFBController::idleSlot() {
}
void RFBController::checkWriteBuffer() {
BufferedConnection *bc = connection->bufferedConnection;
BufferedConnection *bc = connection->connection;
bool bufferEmpty = (bc->senderBuffer.end - bc->senderBuffer.pos) == 0;
socket->enableWrite(!bufferEmpty);
if (bufferEmpty && !idleUpdateScheduled && connection) {
@ -165,7 +171,7 @@ void RFBController::socketReadable() {
if ((!socket) || (!connection))
return;
int fd = socket->socket();
BufferedConnection *bc = connection->bufferedConnection;
BufferedConnection *bc = connection->connection;
int count = read(fd,
bc->receiverBuffer.data,
bc->receiverBuffer.size);
@ -173,9 +179,6 @@ void RFBController::socketReadable() {
bc->receiverBuffer.end += count;
else {
closeSession();
KMessageBox::error(0,
i18n("An error occurred while reading from the remote client. The connection will be terminated."),
i18n("KRfb Error"));
return;
}
while (connection->currentState && bc->hasReceiverBufferData()) {
@ -194,7 +197,7 @@ void RFBController::socketWritable() {
return;
int fd = socket->socket();
BufferedConnection *bc = connection->bufferedConnection;
BufferedConnection *bc = connection->connection;
ASSERT((bc->senderBuffer.end - bc->senderBuffer.pos) > 0);
int count = write(fd,
bc->senderBuffer.data + bc->senderBuffer.pos,
@ -204,9 +207,6 @@ void RFBController::socketWritable() {
checkWriteBuffer();
} else {
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() {
ASSERT(socket);
if (!socket)
return;
ASSERT(!connection);
dialog.hide();
@ -230,7 +231,8 @@ void RFBController::dialogAccepted() {
}
void RFBController::dialogRefused() {
ASSERT(socket);
if (!socket)
return;
ASSERT(!connection);
closeSocket();

View File

@ -30,6 +30,8 @@
// rfbconnection must be last because of X11 headers
#include "rfbconnection.h"
class QCloseEvent;
using namespace rfb;
typedef enum {
@ -39,6 +41,15 @@ typedef enum {
RFB_CONNECTED
} RFBState;
class ConnectionDialog : public KRFBConnectionDialog {
Q_OBJECT
public:
virtual void closeEvent(QCloseEvent *);
signals:
void closed();
};
/**
* Manages sockets, drives the RGBConnection and triggers the connection
* dialog.
@ -52,7 +63,7 @@ class RFBController : public QObject {
Q_OBJECT
public:
RFBController(Configuration *c);
~RFBController();
virtual ~RFBController();
RFBState state();
@ -75,7 +86,7 @@ private:
KServerSocket *serversocket;
KSocket *socket;
RFBConnection *connection;
KRFBConnectionDialog dialog;
ConnectionDialog dialog;
bool idleUpdateScheduled;
private slots: