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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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, int len);
  71. void framebufferUpdateEnd();
  72. void beginRect(const rfb::Rect& r, unsigned int encoding);
  73. void endRect(const rfb::Rect& r, unsigned int encoding);
  74. void fillRect(const rfb::Rect& r, rfb::Pixel p);
  75. void imageRect(const rfb::Rect& r, void* p);
  76. void copyRect(const rfb::Rect& r, int sx, int sy);
  77. void setCursor(int width, int height, const rfb::Point& hotspot,
  78. void* data, void* mask);
  79. private:
  80. void resizeFramebuffer();
  81. void recreateViewport();
  82. void reconfigureViewport();
  83. void initMenu();
  84. void showMenu(int x, int y);
  85. void autoSelectFormatAndEncoding();
  86. void checkEncodings();
  87. void requestNewUpdate();
  88. Display* dpy;
  89. int argc;
  90. char** argv;
  91. char* serverHost;
  92. int serverPort;
  93. network::Socket* sock;
  94. rfb::PixelFormat serverPF;
  95. TXViewport* viewport;
  96. DesktopWindow* desktop;
  97. TXEventHandler* desktopEventHandler;
  98. rfb::PixelFormat fullColourPF;
  99. std::list<rfb::Rect> debugRects;
  100. unsigned int currentEncoding, lastServerEncoding;
  101. bool fullColour;
  102. bool autoSelect;
  103. bool shared;
  104. bool formatChange;
  105. bool encodingChange;
  106. bool sameMachine;
  107. bool fullScreen;
  108. bool ctrlDown;
  109. bool altDown;
  110. KeySym menuKeysym;
  111. TXMenu menu;
  112. TXEventHandler* menuEventHandler;
  113. OptionsDialog options;
  114. AboutDialog about;
  115. InfoDialog info;
  116. bool reverseConnection;
  117. bool firstUpdate;
  118. };
  119. #endif