Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

CMsgHandler.cxx 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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 <stdio.h>
  23. #include <rfb/Exception.h>
  24. #include <rfb/LogWriter.h>
  25. #include <rfb/CMsgHandler.h>
  26. #include <rfb/clipboardTypes.h>
  27. #include <rfb/screenTypes.h>
  28. static rfb::LogWriter vlog("CMsgHandler");
  29. using namespace rfb;
  30. CMsgHandler::CMsgHandler()
  31. {
  32. }
  33. CMsgHandler::~CMsgHandler()
  34. {
  35. }
  36. void CMsgHandler::setDesktopSize(int width, int height)
  37. {
  38. server.setDimensions(width, height);
  39. }
  40. void CMsgHandler::setExtendedDesktopSize(unsigned reason, unsigned result,
  41. int width, int height,
  42. const ScreenSet& layout)
  43. {
  44. server.supportsSetDesktopSize = true;
  45. if ((reason == reasonClient) && (result != resultSuccess))
  46. return;
  47. server.setDimensions(width, height, layout);
  48. }
  49. void CMsgHandler::setPixelFormat(const PixelFormat& pf)
  50. {
  51. server.setPF(pf);
  52. }
  53. void CMsgHandler::setName(const char* name)
  54. {
  55. server.setName(name);
  56. }
  57. void CMsgHandler::fence(rdr::U32 flags, unsigned len, const char data[])
  58. {
  59. server.supportsFence = true;
  60. }
  61. void CMsgHandler::endOfContinuousUpdates()
  62. {
  63. server.supportsContinuousUpdates = true;
  64. }
  65. void CMsgHandler::supportsQEMUKeyEvent()
  66. {
  67. server.supportsQEMUKeyEvent = true;
  68. }
  69. void CMsgHandler::serverInit(int width, int height,
  70. const PixelFormat& pf,
  71. const char* name)
  72. {
  73. server.setDimensions(width, height);
  74. server.setPF(pf);
  75. server.setName(name);
  76. }
  77. void CMsgHandler::framebufferUpdateStart()
  78. {
  79. }
  80. void CMsgHandler::framebufferUpdateEnd()
  81. {
  82. }
  83. void CMsgHandler::setLEDState(unsigned int state)
  84. {
  85. server.setLEDState(state);
  86. }
  87. void CMsgHandler::handleClipboardCaps(rdr::U32 flags, const rdr::U32* lengths)
  88. {
  89. int i;
  90. vlog.debug("Got server clipboard capabilities:");
  91. for (i = 0;i < 16;i++) {
  92. if (flags & (1 << i)) {
  93. const char *type;
  94. switch (1 << i) {
  95. case clipboardUTF8:
  96. type = "Plain text";
  97. break;
  98. case clipboardRTF:
  99. type = "Rich text";
  100. break;
  101. case clipboardHTML:
  102. type = "HTML";
  103. break;
  104. case clipboardDIB:
  105. type = "Images";
  106. break;
  107. case clipboardFiles:
  108. type = "Files";
  109. break;
  110. default:
  111. vlog.debug(" Unknown format 0x%x", 1 << i);
  112. continue;
  113. }
  114. if (lengths[i] == 0)
  115. vlog.debug(" %s (only notify)", type);
  116. else {
  117. char bytes[1024];
  118. iecPrefix(lengths[i], "B", bytes, sizeof(bytes));
  119. vlog.debug(" %s (automatically send up to %s)",
  120. type, bytes);
  121. }
  122. }
  123. }
  124. server.setClipboardCaps(flags, lengths);
  125. }
  126. void CMsgHandler::handleClipboardRequest(rdr::U32 flags)
  127. {
  128. }
  129. void CMsgHandler::handleClipboardPeek(rdr::U32 flags)
  130. {
  131. }
  132. void CMsgHandler::handleClipboardNotify(rdr::U32 flags)
  133. {
  134. }
  135. void CMsgHandler::handleClipboardProvide(rdr::U32 flags,
  136. const size_t* lengths,
  137. const rdr::U8* const* data)
  138. {
  139. }