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

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