blob: b56c94074b1f86bc0908c5ca15767245399d1b0f [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
Pierre Ossmanb948a912014-01-15 13:23:43 +01002 * Copyright 2014 Pierre Ossman for Cendio AB
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00003 *
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// ConnParams - structure containing the connection parameters.
21//
22
23#ifndef __RFB_CONNPARAMS_H__
24#define __RFB_CONNPARAMS_H__
25
Pierre Ossmanc0397262014-03-14 15:59:46 +010026#include <set>
27
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000028#include <rdr/types.h>
Pierre Ossman126e5642014-02-13 14:40:25 +010029#include <rfb/Cursor.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000030#include <rfb/PixelFormat.h>
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000031#include <rfb/ScreenSet.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000032
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000033namespace rfb {
34
Pierre Ossmanb948a912014-01-15 13:23:43 +010035 const int subsampleUndefined = -1;
36 const int subsampleNone = 0;
37 const int subsampleGray = 1;
38 const int subsample2X = 2;
39 const int subsample4X = 3;
40 const int subsample8X = 4;
41 const int subsample16X = 5;
42
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000043 class ConnParams {
44 public:
45 ConnParams();
46 ~ConnParams();
47
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000048 int majorVersion;
49 int minorVersion;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000050
51 void setVersion(int major, int minor) {
52 majorVersion = major; minorVersion = minor;
53 }
Pierre Ossmanf22d3502015-11-10 12:58:49 +010054 bool isVersion(int major, int minor) const {
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000055 return majorVersion == major && minorVersion == minor;
56 }
Pierre Ossmanf22d3502015-11-10 12:58:49 +010057 bool beforeVersion(int major, int minor) const {
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000058 return (majorVersion < major ||
59 (majorVersion == major && minorVersion < minor));
60 }
Pierre Ossmanf22d3502015-11-10 12:58:49 +010061 bool afterVersion(int major, int minor) const {
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000062 return !beforeVersion(major,minor+1);
63 }
64
65 int width;
66 int height;
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000067 ScreenSet screenLayout;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000068
Pierre Ossmanf22d3502015-11-10 12:58:49 +010069 const PixelFormat& pf() const { return pf_; }
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000070 void setPF(const PixelFormat& pf);
71
Pierre Ossmanf22d3502015-11-10 12:58:49 +010072 const char* name() const { return name_; }
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000073 void setName(const char* name);
74
Pierre Ossman6a1a0d02017-02-19 15:48:17 +010075 const Cursor& cursor() const { return *cursor_; }
Pierre Ossman126e5642014-02-13 14:40:25 +010076 void setCursor(const Cursor& cursor);
77
Pierre Ossmanf22d3502015-11-10 12:58:49 +010078 bool supportsEncoding(rdr::S32 encoding) const;
Pierre Ossman941d2902014-01-15 13:51:53 +010079
Peter Åstrand98fe98c2010-02-10 07:43:02 +000080 void setEncodings(int nEncodings, const rdr::S32* encodings);
Pierre Ossman941d2902014-01-15 13:51:53 +010081
Pierre Ossman2fa63f82016-12-05 15:26:21 +010082 unsigned int ledState() { return ledState_; }
83 void setLEDState(unsigned int state);
84
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000085 bool useCopyRect;
86
87 bool supportsLocalCursor;
88 bool supportsLocalXCursor;
Pierre Ossman8053c8e2017-02-21 12:59:04 +010089 bool supportsLocalCursorWithAlpha;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000090 bool supportsDesktopResize;
Pierre Ossmanc5e25602009-03-20 12:59:05 +000091 bool supportsExtendedDesktopSize;
Peter Åstrandc39e0782009-01-15 12:21:42 +000092 bool supportsDesktopRename;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000093 bool supportsLastRect;
Pierre Ossman2fa63f82016-12-05 15:26:21 +010094 bool supportsLEDState;
Pierre Ossman5ae28212017-05-16 14:30:38 +020095 bool supportsQEMUKeyEvent;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000096
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000097 bool supportsSetDesktopSize;
Pierre Ossmanc754cce2011-11-14 15:44:11 +000098 bool supportsFence;
Pierre Ossmanc898d9a2011-11-14 16:22:23 +000099 bool supportsContinuousUpdates;
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +0000100
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000101 int compressLevel;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000102 int qualityLevel;
DRCb4a83232011-08-19 04:57:18 +0000103 int fineQualityLevel;
Pierre Ossmanb948a912014-01-15 13:23:43 +0100104 int subsampling;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000105
106 private:
107
108 PixelFormat pf_;
109 char* name_;
Pierre Ossman6a1a0d02017-02-19 15:48:17 +0100110 Cursor* cursor_;
Pierre Ossmanc0397262014-03-14 15:59:46 +0100111 std::set<rdr::S32> encodings_;
Pierre Ossman2fa63f82016-12-05 15:26:21 +0100112 unsigned int ledState_;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +0000113 };
114}
115#endif