Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
Pierre Ossman | 0ff2655 | 2016-02-05 10:26:56 +0100 | [diff] [blame] | 2 | * Copyright 2014-2019 Pierre Ossman for Cendio AB |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 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 | // ServerParams - structure describing the current state of the remote server |
| 21 | // |
| 22 | |
| 23 | #ifndef __RFB_SERVERPARAMS_H__ |
| 24 | #define __RFB_SERVERPARAMS_H__ |
| 25 | |
| 26 | #include <rfb/Cursor.h> |
| 27 | #include <rfb/PixelFormat.h> |
| 28 | #include <rfb/ScreenSet.h> |
| 29 | |
| 30 | namespace rfb { |
| 31 | |
| 32 | class ServerParams { |
| 33 | public: |
| 34 | ServerParams(); |
| 35 | ~ServerParams(); |
| 36 | |
| 37 | int majorVersion; |
| 38 | int minorVersion; |
| 39 | |
| 40 | void setVersion(int major, int minor) { |
| 41 | majorVersion = major; minorVersion = minor; |
| 42 | } |
| 43 | bool isVersion(int major, int minor) const { |
| 44 | return majorVersion == major && minorVersion == minor; |
| 45 | } |
| 46 | bool beforeVersion(int major, int minor) const { |
| 47 | return (majorVersion < major || |
| 48 | (majorVersion == major && minorVersion < minor)); |
| 49 | } |
| 50 | bool afterVersion(int major, int minor) const { |
| 51 | return !beforeVersion(major,minor+1); |
| 52 | } |
| 53 | |
Steve Kondik | c731da1 | 2019-09-06 13:27:47 -0700 | [diff] [blame] | 54 | int width() const { return width_; } |
| 55 | int height() const { return height_; } |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 56 | const ScreenSet& screenLayout() const { return screenLayout_; } |
| 57 | void setDimensions(int width, int height); |
| 58 | void setDimensions(int width, int height, const ScreenSet& layout); |
| 59 | |
| 60 | const PixelFormat& pf() const { return pf_; } |
| 61 | void setPF(const PixelFormat& pf); |
| 62 | |
| 63 | const char* name() const { return name_; } |
| 64 | void setName(const char* name); |
| 65 | |
| 66 | const Cursor& cursor() const { return *cursor_; } |
| 67 | void setCursor(const Cursor& cursor); |
| 68 | |
| 69 | unsigned int ledState() { return ledState_; } |
| 70 | void setLEDState(unsigned int state); |
| 71 | |
Pierre Ossman | 0ff2655 | 2016-02-05 10:26:56 +0100 | [diff] [blame] | 72 | rdr::U32 clipboardFlags() const { return clipFlags; } |
| 73 | void setClipboardCaps(rdr::U32 flags, const rdr::U32* lengths); |
| 74 | |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 75 | bool supportsQEMUKeyEvent; |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 76 | bool supportsSetDesktopSize; |
| 77 | bool supportsFence; |
| 78 | bool supportsContinuousUpdates; |
| 79 | |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 80 | private: |
| 81 | |
| 82 | int width_; |
| 83 | int height_; |
| 84 | ScreenSet screenLayout_; |
| 85 | |
| 86 | PixelFormat pf_; |
| 87 | char* name_; |
| 88 | Cursor* cursor_; |
| 89 | unsigned int ledState_; |
Pierre Ossman | 0ff2655 | 2016-02-05 10:26:56 +0100 | [diff] [blame] | 90 | rdr::U32 clipFlags; |
| 91 | rdr::U32 clipSizes[16]; |
Pierre Ossman | b14a6bc | 2018-06-18 15:44:26 +0200 | [diff] [blame] | 92 | }; |
| 93 | } |
| 94 | #endif |