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 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2009 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. //
  20. // CConn represents a client connection to a VNC server.
  21. //
  22. #ifndef __CCONN_H__
  23. #define __CCONN_H__
  24. #include <rfb/CConnection.h>
  25. #include <rfb/Exception.h>
  26. #include <rfb/UserPasswdGetter.h>
  27. #include <rdr/FdInStream.h>
  28. #include <list>
  29. #include "TXWindow.h"
  30. #include "AboutDialog.h"
  31. #include "InfoDialog.h"
  32. #include "TXMenu.h"
  33. #include "OptionsDialog.h"
  34. class TXWindow;
  35. class TXViewport;
  36. class DesktopWindow;
  37. namespace network { class Socket; }
  38. class CConn : public rfb::CConnection, public rfb::UserPasswdGetter,
  39. public TXDeleteWindowCallback,
  40. public rdr::FdInStreamBlockCallback,
  41. public TXMenuCallback , public OptionsDialogCallback,
  42. public TXEventHandler
  43. {
  44. public:
  45. CConn(Display* dpy_, int argc_, char** argv_, network::Socket* sock_,
  46. char* vncServerName, bool reverse=false);
  47. ~CConn();
  48. // TXDeleteWindowCallback methods
  49. void deleteWindow(TXWindow* w);
  50. // FdInStreamBlockCallback methods
  51. void blockCallback();
  52. // UserPasswdGetter methods
  53. virtual void getUserPasswd(char** user, char** password);
  54. // TXMenuCallback methods
  55. void menuSelect(long id, TXMenu* m);
  56. // OptionsDialogCallback methods
  57. virtual void setOptions();
  58. virtual void getOptions();
  59. // TXEventHandler callback method
  60. virtual void handleEvent(TXWindow* w, XEvent* ev);
  61. // CConnection callback methods
  62. rfb::CSecurity* getCSecurity(int secType);
  63. void serverInit();
  64. void setDesktopSize(int w, int h);
  65. void setExtendedDesktopSize(int reason, int result, int w, int h,
  66. const rfb::ScreenSet& layout);
  67. void setName(const char* name);
  68. void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
  69. void bell();
  70. void serverCutText(const char* str, rdr::U32 len);
  71. void framebufferUpdateStart();
  72. void framebufferUpdateEnd();
  73. void beginRect(const rfb::Rect& r, unsigned int encoding);
  74. void endRect(const rfb::Rect& r, unsigned int encoding);
  75. void fillRect(const rfb::Rect& r, rfb::Pixel p);
  76. void imageRect(const rfb::Rect& r, void* p);
  77. void copyRect(const rfb::Rect& r, int sx, int sy);
  78. void setCursor(int width, int height, const rfb::Point& hotspot,
  79. void* data, void* mask);
  80. private:
  81. void resizeFramebuffer();
  82. void recreateViewport();
  83. void reconfigureViewport();
  84. void initMenu();
  85. void showMenu(int x, int y);
  86. void autoSelectFormatAndEncoding();
  87. void checkEncodings();
  88. void requestNewUpdate();
  89. Display* dpy;
  90. int argc;
  91. char** argv;
  92. char* serverHost;
  93. int serverPort;
  94. network::Socket* sock;
  95. rfb::PixelFormat serverPF;
  96. TXViewport* viewport;
  97. DesktopWindow* desktop;
  98. TXEventHandler* desktopEventHandler;
  99. rfb::PixelFormat fullColourPF;
  100. std::list<rfb::Rect> debugRects;
  101. unsigned int currentEncoding, lastServerEncoding;
  102. bool fullColour;
  103. bool autoSelect;
  104. bool shared;
  105. bool formatChange;
  106. bool encodingChange;
  107. bool sameMachine;
  108. bool fullScreen;
  109. bool ctrlDown;
  110. bool altDown;
  111. KeySym menuKeysym;
  112. TXMenu menu;
  113. TXEventHandler* menuEventHandler;
  114. OptionsDialog options;
  115. AboutDialog about;
  116. InfoDialog info;
  117. bool reverseConnection;
  118. bool firstUpdate;
  119. };
  120. #endif