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

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