You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ClientParams.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2014-2019 Pierre Ossman 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. // ClientParams - structure describing the current state of the remote client
  21. //
  22. #ifndef __RFB_CLIENTPARAMS_H__
  23. #define __RFB_CLIENTPARAMS_H__
  24. #include <set>
  25. #include <string>
  26. #include <stdint.h>
  27. #include <rfb/Cursor.h>
  28. #include <rfb/PixelFormat.h>
  29. #include <rfb/ScreenSet.h>
  30. namespace rfb {
  31. const int subsampleUndefined = -1;
  32. const int subsampleNone = 0;
  33. const int subsampleGray = 1;
  34. const int subsample2X = 2;
  35. const int subsample4X = 3;
  36. const int subsample8X = 4;
  37. const int subsample16X = 5;
  38. class ClientParams {
  39. public:
  40. ClientParams();
  41. ~ClientParams();
  42. int majorVersion;
  43. int minorVersion;
  44. void setVersion(int major, int minor) {
  45. majorVersion = major; minorVersion = minor;
  46. }
  47. bool isVersion(int major, int minor) const {
  48. return majorVersion == major && minorVersion == minor;
  49. }
  50. bool beforeVersion(int major, int minor) const {
  51. return (majorVersion < major ||
  52. (majorVersion == major && minorVersion < minor));
  53. }
  54. bool afterVersion(int major, int minor) const {
  55. return !beforeVersion(major,minor+1);
  56. }
  57. int width() const { return width_; }
  58. int height() const { return height_; }
  59. const ScreenSet& screenLayout() const { return screenLayout_; }
  60. void setDimensions(int width, int height);
  61. void setDimensions(int width, int height, const ScreenSet& layout);
  62. const PixelFormat& pf() const { return pf_; }
  63. void setPF(const PixelFormat& pf);
  64. const char* name() const { return name_.c_str(); }
  65. void setName(const char* name);
  66. const Cursor& cursor() const { return *cursor_; }
  67. void setCursor(const Cursor& cursor);
  68. const Point& cursorPos() const { return cursorPos_; }
  69. void setCursorPos(const Point& pos);
  70. bool supportsEncoding(int32_t encoding) const;
  71. void setEncodings(int nEncodings, const int32_t* encodings);
  72. unsigned int ledState() { return ledState_; }
  73. void setLEDState(unsigned int state);
  74. uint32_t clipboardFlags() const { return clipFlags; }
  75. uint32_t clipboardSize(unsigned int format) const;
  76. void setClipboardCaps(uint32_t flags, const uint32_t* lengths);
  77. // Wrappers to check for functionality rather than specific
  78. // encodings
  79. bool supportsLocalCursor() const;
  80. bool supportsCursorPosition() const;
  81. bool supportsDesktopSize() const;
  82. bool supportsLEDState() const;
  83. bool supportsFence() const;
  84. bool supportsContinuousUpdates() const;
  85. int compressLevel;
  86. int qualityLevel;
  87. int fineQualityLevel;
  88. int subsampling;
  89. private:
  90. int width_;
  91. int height_;
  92. ScreenSet screenLayout_;
  93. PixelFormat pf_;
  94. std::string name_;
  95. Cursor* cursor_;
  96. Point cursorPos_;
  97. std::set<int32_t> encodings_;
  98. unsigned int ledState_;
  99. uint32_t clipFlags;
  100. uint32_t clipSizes[16];
  101. };
  102. }
  103. #endif