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.

CConn.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. public rdr::FdInStreamBlockCallback
  28. {
  29. public:
  30. CConn(const char* vncServerName, network::Socket* sock);
  31. ~CConn();
  32. const char *connectionInfo();
  33. unsigned getUpdateCount();
  34. unsigned getPixelCount();
  35. unsigned getPosition();
  36. // FdInStreamBlockCallback methods
  37. void blockCallback();
  38. // Callback when socket is ready (or broken)
  39. static void socketEvent(FL_SOCKET fd, void *data);
  40. // CConnection callback methods
  41. void initDone();
  42. void setDesktopSize(int w, int h);
  43. void setExtendedDesktopSize(unsigned reason, unsigned result,
  44. int w, int h, const rfb::ScreenSet& layout);
  45. void setName(const char* name);
  46. void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
  47. void bell();
  48. void framebufferUpdateStart();
  49. void framebufferUpdateEnd();
  50. void dataRect(const rfb::Rect& r, int encoding);
  51. void setCursor(int width, int height, const rfb::Point& hotspot,
  52. const rdr::U8* data);
  53. void fence(rdr::U32 flags, unsigned len, const char data[]);
  54. void setLEDState(unsigned int state);
  55. virtual void handleClipboardRequest();
  56. virtual void handleClipboardAnnounce(bool available);
  57. virtual void handleClipboardData(const char* data);
  58. private:
  59. void resizeFramebuffer();
  60. void autoSelectFormatAndEncoding();
  61. void updatePixelFormat();
  62. static void handleOptions(void *data);
  63. static void handleUpdateTimeout(void *data);
  64. private:
  65. char* serverHost;
  66. int serverPort;
  67. network::Socket* sock;
  68. DesktopWindow *desktop;
  69. unsigned updateCount;
  70. unsigned pixelCount;
  71. rfb::PixelFormat serverPF;
  72. rfb::PixelFormat fullColourPF;
  73. int lastServerEncoding;
  74. };
  75. #endif