blob: 45928878f3651d3f50ce5184b992fb7da410eeae [file] [log] [blame]
Pierre Ossman5156d5e2011-03-09 09:42:34 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 * Copyright 2009-2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
3 *
4 * This is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this software; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA.
18 */
19
20#ifndef __CCONN_H__
21#define __CCONN_H__
22
23#include <rfb/CConnection.h>
24#include <network/Socket.h>
25
26#include "DesktopWindow.h"
27
28class CConn : public rfb::CConnection,
29 public rdr::FdInStreamBlockCallback
30{
31public:
32 CConn(const char* vncServerName);
33 ~CConn();
34
Pierre Ossmand4c61ce2011-04-29 11:18:12 +000035 void refreshFramebuffer();
36
Pierre Ossman5156d5e2011-03-09 09:42:34 +000037 // FdInStreamBlockCallback methods
38 void blockCallback();
39
40 // Callback when socket is ready (or broken)
41 static void socketEvent(int fd, void *data);
42
43 // CConnection callback methods
44 void serverInit();
45
46 void setDesktopSize(int w, int h);
47 void setExtendedDesktopSize(int reason, int result, int w, int h,
48 const rfb::ScreenSet& layout);
49
50 void setName(const char* name);
51
52 void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
53
54 void bell();
55
56 void serverCutText(const char* str, rdr::U32 len);
57
58 void framebufferUpdateStart();
59 void framebufferUpdateEnd();
60
61 void beginRect(const rfb::Rect& r, int encoding);
62 void endRect(const rfb::Rect& r, int encoding);
63
64 void fillRect(const rfb::Rect& r, rfb::Pixel p);
65 void imageRect(const rfb::Rect& r, void* p);
66 void copyRect(const rfb::Rect& r, int sx, int sy);
67
68 void setCursor(int width, int height, const rfb::Point& hotspot,
69 void* data, void* mask);
70
71private:
72
73 void resizeFramebuffer();
74
75 void autoSelectFormatAndEncoding();
76 void checkEncodings();
77 void requestNewUpdate();
78
79private:
80 char* serverHost;
81 int serverPort;
82 network::Socket* sock;
83
84 DesktopWindow *desktop;
85
86 rfb::PixelFormat serverPF;
87 rfb::PixelFormat fullColourPF;
88
89 int currentEncoding, lastServerEncoding;
90
91 bool formatChange;
92 bool encodingChange;
93
94 bool firstUpdate;
95 bool pendingUpdate;
Pierre Ossmand4c61ce2011-04-29 11:18:12 +000096
97 bool forceNonincremental;
Pierre Ossman5156d5e2011-03-09 09:42:34 +000098};
99
100#endif