summaryrefslogtreecommitdiffstats
path: root/krfb/krfb
diff options
context:
space:
mode:
Diffstat (limited to 'krfb/krfb')
-rw-r--r--krfb/krfb/CMakeLists.txt2
-rw-r--r--krfb/krfb/rfbcontroller.cc80
-rw-r--r--krfb/krfb/rfbcontroller.h5
3 files changed, 48 insertions, 39 deletions
diff --git a/krfb/krfb/CMakeLists.txt b/krfb/krfb/CMakeLists.txt
index 799444d2..4251ebdc 100644
--- a/krfb/krfb/CMakeLists.txt
+++ b/krfb/krfb/CMakeLists.txt
@@ -39,7 +39,7 @@ tde_add_executable( krfb AUTOMOC
rfbcontroller.cc xupdatescanner.cc main.cpp connectionwidget.ui
krfbifaceimpl.cc krfbiface.skel trayicon.cpp connectiondialog.cc
LINK
- krfbconfig-static vncserver-static srvloc-static tdeui-shared tdeio-shared jpeg Xext pthread ${XTST_LIBRARIES}
+ krfbconfig-static srvloc-static tdeui-shared tdeio-shared jpeg Xext pthread ${XTST_LIBRARIES} ${LIBVNCSERVER_LIBRARIES}
DESTINATION ${BIN_INSTALL_DIR}
)
diff --git a/krfb/krfb/rfbcontroller.cc b/krfb/krfb/rfbcontroller.cc
index 0db57514..c67134b9 100644
--- a/krfb/krfb/rfbcontroller.cc
+++ b/krfb/krfb/rfbcontroller.cc
@@ -132,7 +132,7 @@ static enum rfbNewClientAction newClientHook(struct _rfbClientRec *cl)
return self->handleNewClient(cl);
}
-static Bool passwordCheck(rfbClientPtr cl,
+static rfbBool passwordCheck(rfbClientPtr cl,
const char* encryptedPassword,
int len)
{
@@ -140,7 +140,7 @@ static Bool passwordCheck(rfbClientPtr cl,
return self->handleCheckPassword(cl, encryptedPassword, len);
}
-static void keyboardHook(Bool down, KeySym keySym, rfbClientPtr)
+static void keyboardHook(rfbBool down, rfbKeySym keySym, rfbClientPtr)
{
self->handleKeyEvent(down ? true : false, keySym);
}
@@ -155,6 +155,7 @@ static void clientGoneHook(rfbClientPtr)
self->handleClientGone();
}
+#ifdef USE_MODIFIED_BUILTIN_LIBVNCSERVER
static void negotiationFinishedHook(rfbClientPtr cl)
{
self->handleNegotiationFinished(cl);
@@ -164,6 +165,7 @@ static void inetdDisconnectHook()
{
self->handleClientGone();
}
+#endif
static void clipboardHook(char* str,int len, rfbClientPtr)
{
@@ -406,34 +408,34 @@ void RFBController::startServer(int inetdFd, bool xtestGrab)
server->paddedWidthInBytes = framebufferImage->bytes_per_line;
- server->rfbServerFormat.bitsPerPixel = framebufferImage->bits_per_pixel;
- server->rfbServerFormat.depth = framebufferImage->depth;
- server->rfbServerFormat.trueColour = (CARD8) TRUE;
- server->rfbServerFormat.bigEndian = (CARD8) ((framebufferImage->bitmap_bit_order == MSBFirst) ? TRUE : FALSE);
-
- if ( server->rfbServerFormat.bitsPerPixel == 8 ) {
- server->rfbServerFormat.redShift = 0;
- server->rfbServerFormat.greenShift = 3;
- server->rfbServerFormat.blueShift = 6;
- server->rfbServerFormat.redMax = 7;
- server->rfbServerFormat.greenMax = 7;
- server->rfbServerFormat.blueMax = 3;
+ server->serverFormat.bitsPerPixel = framebufferImage->bits_per_pixel;
+ server->serverFormat.depth = framebufferImage->depth;
+ server->serverFormat.trueColour = (uint8_t) TRUE;
+ server->serverFormat.bigEndian = (uint8_t) ((framebufferImage->bitmap_bit_order == MSBFirst) ? TRUE : FALSE);
+
+ if ( server->serverFormat.bitsPerPixel == 8 ) {
+ server->serverFormat.redShift = 0;
+ server->serverFormat.greenShift = 3;
+ server->serverFormat.blueShift = 6;
+ server->serverFormat.redMax = 7;
+ server->serverFormat.greenMax = 7;
+ server->serverFormat.blueMax = 3;
} else {
- server->rfbServerFormat.redShift = 0;
+ server->serverFormat.redShift = 0;
if ( framebufferImage->red_mask )
- while ( ! ( framebufferImage->red_mask & (1 << server->rfbServerFormat.redShift) ) )
- server->rfbServerFormat.redShift++;
- server->rfbServerFormat.greenShift = 0;
+ while ( ! ( framebufferImage->red_mask & (1 << server->serverFormat.redShift) ) )
+ server->serverFormat.redShift++;
+ server->serverFormat.greenShift = 0;
if ( framebufferImage->green_mask )
- while ( ! ( framebufferImage->green_mask & (1 << server->rfbServerFormat.greenShift) ) )
- server->rfbServerFormat.greenShift++;
- server->rfbServerFormat.blueShift = 0;
+ while ( ! ( framebufferImage->green_mask & (1 << server->serverFormat.greenShift) ) )
+ server->serverFormat.greenShift++;
+ server->serverFormat.blueShift = 0;
if ( framebufferImage->blue_mask )
- while ( ! ( framebufferImage->blue_mask & (1 << server->rfbServerFormat.blueShift) ) )
- server->rfbServerFormat.blueShift++;
- server->rfbServerFormat.redMax = framebufferImage->red_mask >> server->rfbServerFormat.redShift;
- server->rfbServerFormat.greenMax = framebufferImage->green_mask >> server->rfbServerFormat.greenShift;
- server->rfbServerFormat.blueMax = framebufferImage->blue_mask >> server->rfbServerFormat.blueShift;
+ while ( ! ( framebufferImage->blue_mask & (1 << server->serverFormat.blueShift) ) )
+ server->serverFormat.blueShift++;
+ server->serverFormat.redMax = framebufferImage->red_mask >> server->serverFormat.redShift;
+ server->serverFormat.greenMax = framebufferImage->green_mask >> server->serverFormat.greenShift;
+ server->serverFormat.blueMax = framebufferImage->blue_mask >> server->serverFormat.blueShift;
}
server->frameBuffer = fb;
@@ -443,7 +445,9 @@ void RFBController::startServer(int inetdFd, bool xtestGrab)
server->kbdAddEvent = keyboardHook;
server->ptrAddEvent = pointerHook;
server->newClientHook = newClientHook;
+#ifdef USE_MODIFIED_BUILTIN_LIBVNCSERVER
server->inetdDisconnectHook = inetdDisconnectHook;
+#endif // USE_MODIFIED_BUILTIN_LIBVNCSERVER
server->passwordCheck = passwordCheck;
server->setXCutText = clipboardHook;
@@ -458,7 +462,7 @@ void RFBController::startServer(int inetdFd, bool xtestGrab)
scanner = new XUpdateScanner(tqt_xdisplay(),
TQApplication::desktop()->winId(),
(unsigned char*)fb, w, h,
- server->rfbServerFormat.bitsPerPixel,
+ server->serverFormat.bitsPerPixel,
server->paddedWidthInBytes,
!configuration->disableXShm());
@@ -498,9 +502,9 @@ void RFBController::connectionAccepted(bool aRC)
initIdleTimer.stop();
idleTimer.start(IDLE_PAUSE);
- server->rfbClientHead->clientGoneHook = clientGoneHook;
+ server->clientHead->clientGoneHook = clientGoneHook;
state = RFB_CONNECTED;
- if (!server->rfbAuthPasswdData)
+ if (!server->authPasswdData)
emit sessionEstablished(remoteIp);
}
@@ -514,7 +518,7 @@ void RFBController::acceptConnection(bool aRemoteControl)
return;
connectionAccepted(aRemoteControl);
- rfbStartOnHoldClient(server->rfbClientHead);
+ rfbStartOnHoldClient(server->clientHead);
}
void RFBController::refuseConnection()
@@ -525,7 +529,7 @@ void RFBController::refuseConnection()
if (state != RFB_CONNECTING)
return;
- rfbRefuseOnHoldClient(server->rfbClientHead);
+ rfbRefuseOnHoldClient(server->clientHead);
state = RFB_WAITING;
}
@@ -590,7 +594,7 @@ void RFBController::closeConnection()
if (!checkAsyncEvents()) {
asyncMutex.lock();
if (!closePending)
- rfbCloseClient(server->rfbClientHead);
+ rfbCloseClient(server->clientHead);
asyncMutex.unlock();
}
}
@@ -611,8 +615,6 @@ void RFBController::idleSlot()
if (checkAsyncEvents() || forcedClose)
return;
- rfbUndrawCursor(server);
-
TQPtrList<Hint> v;
v.setAutoDelete(true);
TQPoint p = TQCursor::pos();
@@ -628,7 +630,7 @@ void RFBController::idleSlot()
asyncMutex.lock();
if (!closePending)
- defaultPtrAddEvent(0, p.x(),p.y(), server->rfbClientHead);
+ rfbDefaultPtrAddEvent(0, p.x(),p.y(), server->clientHead);
asyncMutex.unlock();
checkAsyncEvents(); // check 2nd time (see 3rd line)
@@ -664,7 +666,7 @@ bool checkPassword(const TQString &p,
strncpy(passwd, p.latin1(),
(MAXPWLEN <= p.length()) ? MAXPWLEN : p.length());
- vncEncryptBytes(challenge, passwd);
+ rfbEncryptBytes(challenge, passwd);
return memcmp(challenge, response, len) == 0;
}
@@ -717,7 +719,9 @@ bool RFBController::handleCheckPassword(rfbClientPtr cl,
enum rfbNewClientAction RFBController::handleNewClient(rfbClientPtr cl)
{
int socket = cl->sock;
+#ifdef USE_MODIFIED_BUILTIN_LIBVNCSERVER
cl->negotiationFinishedHook = negotiationFinishedHook;
+#endif // USE_MODIFIED_BUILTIN_LIBVNCSERVER
TQString host, port;
TDESocketAddress *ksa = KExtendedSocket::peerAddress(socket);
@@ -773,12 +777,14 @@ void RFBController::handleClientGone()
asyncMutex.unlock();
}
+#ifdef USE_MODIFIED_BUILTIN_LIBVNCSERVER
void RFBController::handleNegotiationFinished(rfbClientPtr cl)
{
asyncMutex.lock();
disableBackgroundPending = cl->disableBackground;
asyncMutex.unlock();
}
+#endif // USE_MODIFIED_BUILTIN_LIBVNCSERVER
void RFBController::handleKeyEvent(bool down, KeySym keySym) {
if (!allowDesktopControl)
@@ -854,7 +860,7 @@ void RFBController::passwordChanged() {
(configuration->password().length() != 0) ||
(configuration->invitations().count() > 0);
- server->rfbAuthPasswdData = (void*) (authRequired ? 1 : 0);
+ server->authPasswdData = (void*) (authRequired ? 1 : 0);
}
void RFBController::sendKNotifyEvent(const TQString &n, const TQString &d)
diff --git a/krfb/krfb/rfbcontroller.h b/krfb/krfb/rfbcontroller.h
index 223bbf5a..be1870ae 100644
--- a/krfb/krfb/rfbcontroller.h
+++ b/krfb/krfb/rfbcontroller.h
@@ -32,10 +32,11 @@
#include <tqmutex.h>
#define HAVE_PTHREADS
-#include "rfb.h"
+#include <rfb/rfb.h>
#include <X11/Xlib.h>
+// #define USE_MODIFIED_BUILTIN_LIBVNCSERVER
class TQCloseEvent;
@@ -142,7 +143,9 @@ public:
enum rfbNewClientAction handleNewClient(rfbClientPtr cl);
void clipboardToServer(const TQString &text);
void handleClientGone();
+#ifdef USE_MODIFIED_BUILTIN_LIBVNCSERVER
void handleNegotiationFinished(rfbClientPtr cl);
+#endif // USE_MODIFIED_BUILTIN_LIBVNCSERVER
int getPort();
void startServer(int inetdFd = -1, bool xtestGrab = true);