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.

CMsgHandler.h 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2009-2019 Pierre Ossman for Cendio AB
  3. * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
  4. *
  5. * This is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this software; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  18. * USA.
  19. */
  20. //
  21. // CMsgHandler - class to handle incoming messages on the client side.
  22. //
  23. #ifndef __RFB_CMSGHANDLER_H__
  24. #define __RFB_CMSGHANDLER_H__
  25. #include <stdint.h>
  26. #include <rfb/ServerParams.h>
  27. #include <rfb/Rect.h>
  28. #include <rfb/ScreenSet.h>
  29. namespace rdr { class InStream; }
  30. namespace rfb {
  31. class CMsgHandler {
  32. public:
  33. CMsgHandler();
  34. virtual ~CMsgHandler();
  35. // The following methods are called as corresponding messages are read. A
  36. // derived class should override these methods as desired. Note that for
  37. // the setDesktopSize(), setExtendedDesktopSize(), setPixelFormat(),
  38. // setName(), serverInit() and clipboardCaps methods, a derived class
  39. // should call on to CMsgHandler's methods to set the members of "server"
  40. // appropriately.
  41. virtual void setDesktopSize(int w, int h);
  42. virtual void setExtendedDesktopSize(unsigned reason, unsigned result,
  43. int w, int h,
  44. const ScreenSet& layout);
  45. virtual void setCursor(int width, int height, const Point& hotspot,
  46. const uint8_t* data) = 0;
  47. virtual void setCursorPos(const Point& pos) = 0;
  48. virtual void setPixelFormat(const PixelFormat& pf);
  49. virtual void setName(const char* name);
  50. virtual void fence(uint32_t flags, unsigned len, const uint8_t data[]);
  51. virtual void endOfContinuousUpdates();
  52. virtual void supportsQEMUKeyEvent();
  53. virtual void serverInit(int width, int height,
  54. const PixelFormat& pf,
  55. const char* name) = 0;
  56. virtual bool readAndDecodeRect(const Rect& r, int encoding,
  57. ModifiablePixelBuffer* pb) = 0;
  58. virtual void framebufferUpdateStart();
  59. virtual void framebufferUpdateEnd();
  60. virtual bool dataRect(const Rect& r, int encoding) = 0;
  61. virtual void setColourMapEntries(int firstColour, int nColours,
  62. uint16_t* rgbs) = 0;
  63. virtual void bell() = 0;
  64. virtual void serverCutText(const char* str) = 0;
  65. virtual void setLEDState(unsigned int state);
  66. virtual void handleClipboardCaps(uint32_t flags,
  67. const uint32_t* lengths);
  68. virtual void handleClipboardRequest(uint32_t flags);
  69. virtual void handleClipboardPeek();
  70. virtual void handleClipboardNotify(uint32_t flags);
  71. virtual void handleClipboardProvide(uint32_t flags,
  72. const size_t* lengths,
  73. const uint8_t* const* data);
  74. ServerParams server;
  75. };
  76. }
  77. #endif