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

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