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