1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/* Copyright (C) 2002-2004 RealVNC Ltd. All Rights Reserved.
*
* This 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.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
//
// CConn represents a client connection to a VNC server.
//
#ifndef __CCONN_H__
#define __CCONN_H__
#include <rfb/CConnection.h>
#include <rfb/Exception.h>
#include <rfb/UserPasswdGetter.h>
#include <rdr/FdInStream.h>
#include <list>
#include "TXWindow.h"
#include "AboutDialog.h"
#include "InfoDialog.h"
#include "TXMenu.h"
#include "OptionsDialog.h"
class TXWindow;
class TXViewport;
class DesktopWindow;
namespace network { class Socket; }
class CConn : public rfb::CConnection, public rfb::UserPasswdGetter,
public TXDeleteWindowCallback,
public rdr::FdInStreamBlockCallback,
public TXMenuCallback , public OptionsDialogCallback,
public TXEventHandler
{
public:
CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_,
char* vncServerName);
~CConn();
// TXDeleteWindowCallback methods
void deleteWindow(TXWindow* w);
// FdInStreamBlockCallback methods
void blockCallback();
// UserPasswdGetter methods
virtual bool getUserPasswd(char** user, char** password);
// TXMenuCallback methods
void menuSelect(long id, TXMenu* m);
// OptionsDialogCallback methods
virtual void setOptions();
virtual void getOptions();
// TXEventHandler callback method
virtual void handleEvent(TXWindow* w, XEvent* ev);
// CConnection callback methods
rfb::CSecurity* getCSecurity(int secType);
void serverInit();
void setDesktopSize(int w, int h);
void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
void bell();
void serverCutText(const char* str, int len);
void framebufferUpdateEnd();
void beginRect(const rfb::Rect& r, unsigned int encoding);
void endRect(const rfb::Rect& r, unsigned int encoding);
void fillRect(const rfb::Rect& r, rfb::Pixel p);
void imageRect(const rfb::Rect& r, void* p);
void copyRect(const rfb::Rect& r, int sx, int sy);
void setCursor(const rfb::Point& hotspot, const rfb::Point& size,
void* data, void* mask);
private:
void recreateViewport();
void reconfigureViewport();
void initMenu();
void showMenu(int x, int y);
void autoSelectFormatAndEncoding();
void checkEncodings();
void requestNewUpdate();
Display* dpy;
int argc;
char** argv;
char* serverHost;
int serverPort;
network::Socket* sock;
rfb::PixelFormat serverPF;
TXViewport* viewport;
DesktopWindow* desktop;
TXEventHandler* desktopEventHandler;
rfb::PixelFormat fullColourPF;
std::list<rfb::Rect> debugRects;
unsigned int currentEncoding, lastServerEncoding;
bool fullColour;
bool autoSelect;
bool shared;
bool formatChange;
bool encodingChange;
bool sameMachine;
bool fullScreen;
bool ctrlDown;
bool altDown;
KeySym menuKeysym;
TXMenu menu;
TXEventHandler* menuEventHandler;
OptionsDialog options;
AboutDialog about;
InfoDialog info;
};
#endif
|