Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

SDisplay.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. // -=- SDisplay.h
  19. //
  20. // The SDisplay class encapsulates a system display.
  21. #ifndef __RFB_SDISPLAY_H__
  22. #define __RFB_SDISPLAY_H__
  23. #include <rfb/SDesktop.h>
  24. #include <rfb/UpdateTracker.h>
  25. #include <rfb/Configuration.h>
  26. #include <rfb_win32/Handle.h>
  27. #include <rfb_win32/EventManager.h>
  28. #include <rfb_win32/SInput.h>
  29. #include <rfb_win32/Clipboard.h>
  30. #include <rfb_win32/CleanDesktop.h>
  31. #include <rfb_win32/WMCursor.h>
  32. #include <rfb_win32/WMNotifier.h>
  33. #include <rfb_win32/DeviceFrameBuffer.h>
  34. #include <rfb_win32/DeviceContext.h>
  35. namespace rfb {
  36. namespace win32 {
  37. //
  38. // -=- SDisplay
  39. //
  40. class SDisplayCore {
  41. public:
  42. virtual ~SDisplayCore() {};
  43. virtual void setScreenRect(const Rect& screenRect_) = 0;
  44. virtual void flushUpdates() = 0;
  45. virtual const char* methodName() const = 0;
  46. };
  47. class SDisplay : public SDesktop,
  48. WMMonitor::Notifier,
  49. Clipboard::Notifier,
  50. public EventHandler
  51. {
  52. public:
  53. SDisplay();
  54. virtual ~SDisplay();
  55. // -=- SDesktop interface
  56. virtual void start(VNCServer* vs);
  57. virtual void stop();
  58. virtual void pointerEvent(const Point& pos, int buttonmask);
  59. virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
  60. virtual void clientCutText(const char* str, int len);
  61. // -=- Clipboard
  62. virtual void notifyClipboardChanged(const char* text, int len);
  63. // -=- Display events
  64. virtual void notifyDisplayEvent(WMMonitor::Notifier::DisplayEventType evt);
  65. // -=- EventHandler interface
  66. HANDLE getUpdateEvent() {return updateEvent;}
  67. virtual void processEvent(HANDLE event);
  68. // -=- Notification of whether or not SDisplay is started
  69. void setStatusLocation(bool* status) {statusLocation = status;}
  70. static IntParameter updateMethod;
  71. static BoolParameter disableLocalInputs;
  72. static StringParameter disconnectAction;
  73. static BoolParameter removeWallpaper;
  74. static BoolParameter disableEffects;
  75. // -=- Use by VNC Config to determine whether hooks are available
  76. static bool areHooksAvailable();
  77. protected:
  78. bool isRestartRequired();
  79. void startCore();
  80. void stopCore();
  81. void restartCore();
  82. void recreatePixelBuffer(bool force=false);
  83. bool flushChangeTracker(); // true if flushed, false if empty
  84. bool checkLedState();
  85. VNCServer* server;
  86. // -=- Display pixel buffer
  87. DeviceFrameBuffer* pb;
  88. DeviceContext* device;
  89. // -=- The coordinates of Window's entire virtual Screen
  90. Rect screenRect;
  91. // -=- All changes are collected in UN-CLIPPED Display coords and merged
  92. // When they are to be flushed to the VNCServer, they are changed
  93. // to server coords and clipped appropriately.
  94. SimpleUpdateTracker updates;
  95. ClippingUpdateTracker clipper;
  96. // -=- Internal SDisplay implementation
  97. SDisplayCore* core;
  98. int updateMethod_;
  99. // Inputs
  100. SPointer* ptr;
  101. SKeyboard* kbd;
  102. Clipboard* clipboard;
  103. WMBlockInput* inputs;
  104. // Desktop state
  105. WMMonitor* monitor;
  106. // Desktop optimisation
  107. CleanDesktop* cleanDesktop;
  108. bool isWallpaperRemoved;
  109. bool areEffectsDisabled;
  110. // Cursor
  111. WMCursor* cursor;
  112. WMCursor::Info old_cursor;
  113. Region old_cursor_region;
  114. Point cursor_renderpos;
  115. // -=- Event signalled to trigger an update to be flushed
  116. Handle updateEvent;
  117. // -=- Where to write the active/inactive indicator to
  118. bool* statusLocation;
  119. unsigned ledState;
  120. };
  121. }
  122. }
  123. #endif // __RFB_SDISPLAY_H__