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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2014-2018 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 <rdr/types.h>
  26. #include <rfb/Cursor.h>
  27. #include <rfb/PixelFormat.h>
  28. #include <rfb/ScreenSet.h>
  29. namespace rfb {
  30. const int subsampleUndefined = -1;
  31. const int subsampleNone = 0;
  32. const int subsampleGray = 1;
  33. const int subsample2X = 2;
  34. const int subsample4X = 3;
  35. const int subsample8X = 4;
  36. const int subsample16X = 5;
  37. class ClientParams {
  38. public:
  39. ClientParams();
  40. ~ClientParams();
  41. int majorVersion;
  42. int minorVersion;
  43. void setVersion(int major, int minor) {
  44. majorVersion = major; minorVersion = minor;
  45. }
  46. bool isVersion(int major, int minor) const {
  47. return majorVersion == major && minorVersion == minor;
  48. }
  49. bool beforeVersion(int major, int minor) const {
  50. return (majorVersion < major ||
  51. (majorVersion == major && minorVersion < minor));
  52. }
  53. bool afterVersion(int major, int minor) const {
  54. return !beforeVersion(major,minor+1);
  55. }
  56. const int width() const { return width_; }
  57. const int height() const { return height_; }
  58. const ScreenSet& screenLayout() const { return screenLayout_; }
  59. void setDimensions(int width, int height);
  60. void setDimensions(int width, int height, const ScreenSet& layout);
  61. const PixelFormat& pf() const { return pf_; }
  62. void setPF(const PixelFormat& pf);
  63. const char* name() const { return name_; }
  64. void setName(const char* name);
  65. const Cursor& cursor() const { return *cursor_; }
  66. void setCursor(const Cursor& cursor);
  67. bool supportsEncoding(rdr::S32 encoding) const;
  68. void setEncodings(int nEncodings, const rdr::S32* encodings);
  69. unsigned int ledState() { return ledState_; }
  70. void setLEDState(unsigned int state);
  71. // Wrappers to check for functionality rather than specific
  72. // encodings
  73. bool supportsLocalCursor() const;
  74. bool supportsDesktopSize() const;
  75. bool supportsLEDState() const;
  76. bool supportsFence() const;
  77. bool supportsContinuousUpdates() const;
  78. int compressLevel;
  79. int qualityLevel;
  80. int fineQualityLevel;
  81. int subsampling;
  82. private:
  83. int width_;
  84. int height_;
  85. ScreenSet screenLayout_;
  86. PixelFormat pf_;
  87. char* name_;
  88. Cursor* cursor_;
  89. std::set<rdr::S32> encodings_;
  90. unsigned int ledState_;
  91. };
  92. }
  93. #endif