1 /***************************************************************************
2 threads.h - threads for kvncview
4 begin : Thu May 09 16:01:42 CET 2002
5 copyright : (C) 2002 by Tim Jansen
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
25 #include <QWaitCondition>
60 class WriterThread
: public QThread
{
63 QWaitCondition m_waiter
;
64 volatile bool &m_quitFlag
;
67 QTime m_lastIncrUpdate
; // start()ed when a incr update is sent
68 bool m_lastIncrUpdatePostponed
;
70 // all things that can be send follow:
71 bool m_incrementalUpdateRQ
; // for sending an incremental request
72 bool m_incrementalUpdateAnnounced
; // set when a RQ will come soon
73 QRegion m_updateRegionRQ
; // for sending updates, null if it is done
74 QList
<InputEvent
> m_inputEvents
; // list of unsent input events
75 MouseEvent m_lastMouseEvent
;
76 int m_mouseEventNum
, m_keyEventNum
;
79 void sendFatalError(KRemoteView::ErrorCode s
);
82 WriterThread(KVncView
*v
, volatile bool &quitFlag
);
84 void queueIncrementalUpdateRequest();
85 void announceIncrementalUpdateRequest();
86 void queueUpdateRequest(const QRegion
&r
);
87 void queueMouseEvent(int x
, int y
, int buttonMask
);
88 void queueKeyEvent(unsigned int k
, bool down
);
89 void queueClientCut(const QString
&text
);
94 bool sendIncrementalUpdateRequest();
95 bool sendUpdateRequest(const QRegion
&r
);
96 bool sendInputEvents(const QList
<InputEvent
> &events
);
101 class ControllerThread
: public QThread
{
104 KRemoteView::RemoteStatus m_status
;
105 WriterThread
&m_wthread
;
106 volatile bool &m_quitFlag
;
107 volatile bool m_desktopInitialized
;
108 QWaitCondition m_waiter
;
110 void changeStatus(KRemoteView::RemoteStatus s
);
111 void sendFatalError(KRemoteView::ErrorCode s
);
114 ControllerThread(KVncView
*v
, WriterThread
&wt
, volatile bool &quitFlag
);
115 KRemoteView::RemoteStatus
status();