您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2009-2014 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. #ifndef __CCONN_H__
  20. #define __CCONN_H__
  21. #include <FL/Fl.H>
  22. #include <rfb/CConnection.h>
  23. #include <rdr/FdInStream.h>
  24. namespace network { class Socket; }
  25. class DesktopWindow;
  26. class CConn : public rfb::CConnection
  27. {
  28. public:
  29. CConn(const char* vncServerName, network::Socket* sock);
  30. ~CConn();
  31. const char *connectionInfo();
  32. unsigned getUpdateCount();
  33. unsigned getPixelCount();
  34. unsigned getPosition();
  35. // Callback when socket is ready (or broken)
  36. static void socketEvent(FL_SOCKET fd, void *data);
  37. // CConnection callback methods
  38. void initDone();
  39. void setDesktopSize(int w, int h);
  40. void setExtendedDesktopSize(unsigned reason, unsigned result,
  41. int w, int h, const rfb::ScreenSet& layout);
  42. void setName(const char* name);
  43. void setColourMapEntries(int firstColour, int nColours, uint16_t* rgbs);
  44. void bell();
  45. void framebufferUpdateStart();
  46. void framebufferUpdateEnd();
  47. bool dataRect(const rfb::Rect& r, int encoding);
  48. void setCursor(int width, int height, const rfb::Point& hotspot,
  49. const uint8_t* data);
  50. void setCursorPos(const rfb::Point& pos);
  51. void fence(uint32_t flags, unsigned len, const uint8_t data[]);
  52. void setLEDState(unsigned int state);
  53. virtual void handleClipboardRequest();
  54. virtual void handleClipboardAnnounce(bool available);
  55. virtual void handleClipboardData(const char* data);
  56. private:
  57. void resizeFramebuffer();
  58. void autoSelectFormatAndEncoding();
  59. void updatePixelFormat();
  60. static void handleOptions(void *data);
  61. static void handleUpdateTimeout(void *data);
  62. private:
  63. std::string serverHost;
  64. int serverPort;
  65. network::Socket* sock;
  66. DesktopWindow *desktop;
  67. unsigned updateCount;
  68. unsigned pixelCount;
  69. rfb::PixelFormat serverPF;
  70. rfb::PixelFormat fullColourPF;
  71. int lastServerEncoding;
  72. struct timeval updateStartTime;
  73. size_t updateStartPos;
  74. unsigned long long bpsEstimate;
  75. };
  76. #endif