Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

XserverDesktop.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. //
  19. // XserverDesktop.h
  20. //
  21. #ifndef __XSERVERDESKTOP_H__
  22. #define __XSERVERDESKTOP_H__
  23. #include <rfb/SDesktop.h>
  24. #include <rfb/HTTPServer.h>
  25. #include <rfb/PixelBuffer.h>
  26. #include <rfb/Configuration.h>
  27. #include <rfb/VNCServerST.h>
  28. #include <rdr/SubstitutingInStream.h>
  29. extern "C" {
  30. #define class c_class;
  31. #include <scrnintstr.h>
  32. #include <os.h>
  33. #undef class
  34. }
  35. namespace rfb {
  36. class VNCServerST;
  37. }
  38. namespace network { class TcpListener; class Socket; }
  39. class XserverDesktop : public rfb::SDesktop, public rfb::FullFramePixelBuffer,
  40. public rfb::ColourMap, public rdr::Substitutor,
  41. public rfb::VNCServerST::QueryConnectionHandler {
  42. public:
  43. XserverDesktop(ScreenPtr pScreen, network::TcpListener* listener,
  44. network::TcpListener* httpListener_,
  45. const char* name, void* fbptr);
  46. virtual ~XserverDesktop();
  47. // methods called from X server code
  48. void serverReset(ScreenPtr pScreen);
  49. void setColormap(ColormapPtr cmap);
  50. void setColourMapEntries(ColormapPtr pColormap, int ndef, xColorItem* pdef);
  51. void bell();
  52. void serverCutText(const char* str, int len);
  53. void setCursor(CursorPtr cursor);
  54. void add_changed(RegionPtr reg);
  55. void add_copied(RegionPtr dst, int dx, int dy);
  56. void positionCursor();
  57. void ignoreHooks(bool b) { ignoreHooks_ = b; }
  58. void blockHandler(fd_set* fds);
  59. void wakeupHandler(fd_set* fds, int nfds);
  60. void addClient(network::Socket* sock, bool reverse);
  61. void disconnectClients();
  62. // QueryConnect methods called from X server code
  63. // getQueryTimeout()
  64. // Returns the timeout associated with a particular
  65. // connection, identified by an opaque Id passed to the
  66. // X code earlier. Also optionally gets the address and
  67. // name associated with that connection.
  68. // Returns zero if the Id is not recognised.
  69. int getQueryTimeout(void* opaqueId,
  70. const char** address=0,
  71. const char** username=0);
  72. // approveConnection()
  73. // Used by X server code to supply the result of a query.
  74. void approveConnection(void* opaqueId, bool accept,
  75. const char* rejectMsg=0);
  76. // rfb::SDesktop callbacks
  77. virtual void pointerEvent(const rfb::Point& pos, int buttonMask);
  78. virtual void keyEvent(rdr::U32 key, bool down);
  79. virtual void clientCutText(const char* str, int len);
  80. virtual rfb::Point getFbSize() { return rfb::Point(width(), height()); }
  81. // rfb::PixelBuffer callbacks
  82. virtual void grabRegion(const rfb::Region& r);
  83. // rfb::ColourMap callbacks
  84. virtual void lookup(int index, int* r, int* g, int* b);
  85. // rdr::Substitutor callback
  86. virtual char* substitute(const char* varName);
  87. // rfb::VNCServerST::QueryConnectionHandler callback
  88. virtual rfb::VNCServerST::queryResult queryConnection(network::Socket* sock,
  89. const char* userName,
  90. char** reason);
  91. private:
  92. void setColourMapEntries(int firstColour, int nColours);
  93. static CARD32 deferredUpdateTimerCallback(OsTimerPtr timer, CARD32 now,
  94. pointer arg);
  95. void deferUpdate();
  96. ScreenPtr pScreen;
  97. OsTimerPtr deferredUpdateTimer, dummyTimer;
  98. rfb::VNCServerST* server;
  99. rfb::HTTPServer* httpServer;
  100. network::TcpListener* listener;
  101. network::TcpListener* httpListener;
  102. ColormapPtr cmap;
  103. bool deferredUpdateTimerSet;
  104. bool grabbing;
  105. bool ignoreHooks_;
  106. bool directFbptr;
  107. int oldButtonMask;
  108. rfb::Point cursorPos, oldCursorPos;
  109. void* queryConnectId;
  110. rfb::CharArray queryConnectAddress;
  111. rfb::CharArray queryConnectUsername;
  112. };
  113. #endif