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.

SMsgHandler.cxx 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2009-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. #ifdef HAVE_CONFIG_H
  20. #include <config.h>
  21. #endif
  22. #include <rfb/Exception.h>
  23. #include <rfb/LogWriter.h>
  24. #include <rfb/SMsgHandler.h>
  25. #include <rfb/ScreenSet.h>
  26. #include <rfb/clipboardTypes.h>
  27. #include <rfb/encodings.h>
  28. #include <rfb/util.h>
  29. using namespace rfb;
  30. static LogWriter vlog("SMsgHandler");
  31. SMsgHandler::SMsgHandler()
  32. {
  33. }
  34. SMsgHandler::~SMsgHandler()
  35. {
  36. }
  37. void SMsgHandler::clientInit(bool /*shared*/)
  38. {
  39. }
  40. void SMsgHandler::setPixelFormat(const PixelFormat& pf)
  41. {
  42. client.setPF(pf);
  43. }
  44. void SMsgHandler::setEncodings(int nEncodings, const int32_t* encodings)
  45. {
  46. bool firstFence, firstContinuousUpdates, firstLEDState,
  47. firstQEMUKeyEvent;
  48. firstFence = !client.supportsFence();
  49. firstContinuousUpdates = !client.supportsContinuousUpdates();
  50. firstLEDState = !client.supportsLEDState();
  51. firstQEMUKeyEvent = !client.supportsEncoding(pseudoEncodingQEMUKeyEvent);
  52. client.setEncodings(nEncodings, encodings);
  53. supportsLocalCursor();
  54. if (client.supportsFence() && firstFence)
  55. supportsFence();
  56. if (client.supportsContinuousUpdates() && firstContinuousUpdates)
  57. supportsContinuousUpdates();
  58. if (client.supportsLEDState() && firstLEDState)
  59. supportsLEDState();
  60. if (client.supportsEncoding(pseudoEncodingQEMUKeyEvent) && firstQEMUKeyEvent)
  61. supportsQEMUKeyEvent();
  62. }
  63. void SMsgHandler::handleClipboardCaps(uint32_t flags, const uint32_t* lengths)
  64. {
  65. int i;
  66. vlog.debug("Got client clipboard capabilities:");
  67. for (i = 0;i < 16;i++) {
  68. if (flags & (1 << i)) {
  69. const char *type;
  70. switch (1 << i) {
  71. case clipboardUTF8:
  72. type = "Plain text";
  73. break;
  74. case clipboardRTF:
  75. type = "Rich text";
  76. break;
  77. case clipboardHTML:
  78. type = "HTML";
  79. break;
  80. case clipboardDIB:
  81. type = "Images";
  82. break;
  83. case clipboardFiles:
  84. type = "Files";
  85. break;
  86. default:
  87. vlog.debug(" Unknown format 0x%x", 1 << i);
  88. continue;
  89. }
  90. if (lengths[i] == 0)
  91. vlog.debug(" %s (only notify)", type);
  92. else {
  93. vlog.debug(" %s (automatically send up to %s)",
  94. type, iecPrefix(lengths[i], "B").c_str());
  95. }
  96. }
  97. }
  98. client.setClipboardCaps(flags, lengths);
  99. }
  100. void SMsgHandler::handleClipboardRequest(uint32_t /*flags*/)
  101. {
  102. }
  103. void SMsgHandler::handleClipboardPeek()
  104. {
  105. }
  106. void SMsgHandler::handleClipboardNotify(uint32_t /*flags*/)
  107. {
  108. }
  109. void SMsgHandler::handleClipboardProvide(uint32_t /*flags*/,
  110. const size_t* /*lengths*/,
  111. const uint8_t* const* /*data*/)
  112. {
  113. }
  114. void SMsgHandler::supportsLocalCursor()
  115. {
  116. }
  117. void SMsgHandler::supportsFence()
  118. {
  119. }
  120. void SMsgHandler::supportsContinuousUpdates()
  121. {
  122. }
  123. void SMsgHandler::supportsLEDState()
  124. {
  125. }
  126. void SMsgHandler::supportsQEMUKeyEvent()
  127. {
  128. }