summaryrefslogtreecommitdiffstats
path: root/krdc/vnc/threads.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /krdc/vnc/threads.h
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krdc/vnc/threads.h')
-rw-r--r--krdc/vnc/threads.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/krdc/vnc/threads.h b/krdc/vnc/threads.h
new file mode 100644
index 00000000..5f38b71f
--- /dev/null
+++ b/krdc/vnc/threads.h
@@ -0,0 +1,126 @@
+/***************************************************************************
+ threads.h - threads for kvncview
+ -------------------
+ begin : Thu May 09 16:01:42 CET 2002
+ copyright : (C) 2002 by Tim Jansen
+ email : tim@tjansen.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef THREADS_H
+#define THREADS_H
+
+#include <qthread.h>
+#include <qregion.h>
+#include <qrect.h>
+#include <qmutex.h>
+#include <qwaitcondition.h>
+#include <qevent.h>
+#include <qvaluelist.h>
+#include <qdatetime.h>
+
+#include <stdlib.h>
+
+#include "events.h"
+#include "vnctypes.h"
+
+class KVncView;
+
+enum EventType {
+ MouseEventType,
+ KeyEventType
+};
+
+
+struct MouseEvent {
+ int x, y, buttons;
+};
+
+struct KeyEvent {
+ unsigned int k;
+ bool down;
+};
+
+struct InputEvent {
+ EventType type;
+ union {
+ MouseEvent m;
+ KeyEvent k;
+ } e;
+};
+
+
+class WriterThread : public QThread {
+private:
+ QMutex m_lock;
+ QWaitCondition m_waiter;
+ volatile bool &m_quitFlag;
+ KVncView *m_view;
+
+ QTime m_lastIncrUpdate; // start()ed when a incr update is sent
+ bool m_lastIncrUpdatePostponed;
+
+ // all things that can be send follow:
+ bool m_incrementalUpdateRQ; // for sending an incremental request
+ bool m_incrementalUpdateAnnounced; // set when a RQ will come soon
+ QRegion m_updateRegionRQ; // for sending updates, null if it is done
+ QValueList<InputEvent> m_inputEvents; // list of unsent input events
+ MouseEvent m_lastMouseEvent;
+ int m_mouseEventNum, m_keyEventNum;
+ QString m_clientCut;
+
+ void sendFatalError(ErrorCode s);
+
+public:
+ WriterThread(KVncView *v, volatile bool &quitFlag);
+
+ void queueIncrementalUpdateRequest();
+ void announceIncrementalUpdateRequest();
+ void queueUpdateRequest(const QRegion &r);
+ void queueMouseEvent(int x, int y, int buttonMask);
+ void queueKeyEvent(unsigned int k, bool down);
+ void queueClientCut(const QString &text);
+ void kick();
+
+protected:
+ void run();
+ bool sendIncrementalUpdateRequest();
+ bool sendUpdateRequest(const QRegion &r);
+ bool sendInputEvents(const QValueList<InputEvent> &events);
+};
+
+
+
+class ControllerThread : public QThread {
+private:
+ KVncView *m_view;
+ enum RemoteViewStatus m_status;
+ WriterThread &m_wthread;
+ volatile bool &m_quitFlag;
+ volatile bool m_desktopInitialized;
+ QWaitCondition m_waiter;
+
+ void changeStatus(RemoteViewStatus s);
+ void sendFatalError(ErrorCode s);
+
+public:
+ ControllerThread(KVncView *v, WriterThread &wt, volatile bool &quitFlag);
+ enum RemoteViewStatus status();
+ void desktopInit();
+ void kick();
+
+protected:
+ void run();
+};
+
+
+
+#endif