2011-03-09 10:42:34 +01:00
|
|
|
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
|
2014-01-31 13:12:18 +01:00
|
|
|
* Copyright 2009-2014 Pierre Ossman for Cendio AB
|
2011-03-09 10:42:34 +01:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CCONN_H__
|
|
|
|
#define __CCONN_H__
|
|
|
|
|
2014-01-27 16:52:35 +01:00
|
|
|
#include <FL/Fl.H>
|
|
|
|
|
2011-03-09 10:42:34 +01:00
|
|
|
#include <rfb/CConnection.h>
|
2014-01-31 13:12:18 +01:00
|
|
|
#include <rfb/encodings.h>
|
2011-03-09 10:42:34 +01:00
|
|
|
#include <network/Socket.h>
|
|
|
|
|
2014-01-31 13:12:18 +01:00
|
|
|
namespace rfb { class Decoder; }
|
|
|
|
|
2014-01-27 16:52:35 +01:00
|
|
|
class DesktopWindow;
|
2011-03-09 10:42:34 +01:00
|
|
|
|
|
|
|
class CConn : public rfb::CConnection,
|
|
|
|
public rdr::FdInStreamBlockCallback
|
|
|
|
{
|
|
|
|
public:
|
2013-02-15 09:33:39 +01:00
|
|
|
CConn(const char* vncServerName, network::Socket* sock);
|
2011-03-09 10:42:34 +01:00
|
|
|
~CConn();
|
|
|
|
|
2011-04-29 13:18:12 +02:00
|
|
|
void refreshFramebuffer();
|
|
|
|
|
2011-05-16 14:18:08 +02:00
|
|
|
const char *connectionInfo();
|
|
|
|
|
2011-03-09 10:42:34 +01:00
|
|
|
// FdInStreamBlockCallback methods
|
|
|
|
void blockCallback();
|
|
|
|
|
|
|
|
// Callback when socket is ready (or broken)
|
2013-02-26 11:34:22 +01:00
|
|
|
static void socketEvent(FL_SOCKET fd, void *data);
|
2011-03-09 10:42:34 +01:00
|
|
|
|
|
|
|
// CConnection callback methods
|
|
|
|
void serverInit();
|
|
|
|
|
|
|
|
void setDesktopSize(int w, int h);
|
2015-03-03 16:27:44 +01:00
|
|
|
void setExtendedDesktopSize(unsigned reason, unsigned result,
|
|
|
|
int w, int h, const rfb::ScreenSet& layout);
|
2011-03-09 10:42:34 +01:00
|
|
|
|
|
|
|
void setName(const char* name);
|
|
|
|
|
|
|
|
void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
|
|
|
|
|
|
|
|
void bell();
|
|
|
|
|
|
|
|
void serverCutText(const char* str, rdr::U32 len);
|
|
|
|
|
|
|
|
void framebufferUpdateStart();
|
|
|
|
void framebufferUpdateEnd();
|
2014-01-31 13:12:18 +01:00
|
|
|
void dataRect(const rfb::Rect& r, int encoding);
|
2011-03-09 10:42:34 +01:00
|
|
|
|
|
|
|
void setCursor(int width, int height, const rfb::Point& hotspot,
|
|
|
|
void* data, void* mask);
|
|
|
|
|
2011-11-14 17:02:06 +01:00
|
|
|
void fence(rdr::U32 flags, unsigned len, const char data[]);
|
|
|
|
|
2011-03-09 10:42:34 +01:00
|
|
|
private:
|
|
|
|
|
|
|
|
void resizeFramebuffer();
|
|
|
|
|
|
|
|
void autoSelectFormatAndEncoding();
|
|
|
|
void checkEncodings();
|
|
|
|
void requestNewUpdate();
|
|
|
|
|
2011-05-17 11:39:07 +02:00
|
|
|
static void handleOptions(void *data);
|
|
|
|
|
2011-03-09 10:42:34 +01:00
|
|
|
private:
|
|
|
|
char* serverHost;
|
|
|
|
int serverPort;
|
|
|
|
network::Socket* sock;
|
|
|
|
|
|
|
|
DesktopWindow *desktop;
|
|
|
|
|
|
|
|
rfb::PixelFormat serverPF;
|
|
|
|
rfb::PixelFormat fullColourPF;
|
|
|
|
|
2011-11-04 12:42:16 +01:00
|
|
|
bool pendingPFChange;
|
|
|
|
rfb::PixelFormat pendingPF;
|
|
|
|
|
2014-01-31 13:12:18 +01:00
|
|
|
rfb::Decoder *decoders[rfb::encodingMax+1];
|
|
|
|
|
2011-03-09 10:42:34 +01:00
|
|
|
int currentEncoding, lastServerEncoding;
|
|
|
|
|
|
|
|
bool formatChange;
|
|
|
|
bool encodingChange;
|
|
|
|
|
|
|
|
bool firstUpdate;
|
|
|
|
bool pendingUpdate;
|
2011-11-15 13:13:37 +01:00
|
|
|
bool continuousUpdates;
|
2011-04-29 13:18:12 +02:00
|
|
|
|
|
|
|
bool forceNonincremental;
|
2011-11-14 17:02:06 +01:00
|
|
|
|
|
|
|
bool supportsSyncFence;
|
2011-03-09 10:42:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|