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.

SDisplay.h 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* Copyright (C) 2002-2004 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. // *** THIS INTERFACE NEEDS TIDYING TO SEPARATE COORDINATE SYSTEMS BETTER ***
  22. #ifndef __RFB_SDISPLAY_H__
  23. #define __RFB_SDISPLAY_H__
  24. #define WIN32_LEAN_AND_MEAN
  25. #include <windows.h>
  26. #include <rfb/SDesktop.h>
  27. #include <rfb/UpdateTracker.h>
  28. #include <rfb/Configuration.h>
  29. #include <rfb/util.h>
  30. #include <winsock2.h>
  31. #include <rfb_win32/Win32Util.h>
  32. #include <rfb_win32/SocketManager.h>
  33. #include <rfb_win32/DeviceFrameBuffer.h>
  34. #include <rfb_win32/SInput.h>
  35. #include <rfb_win32/Clipboard.h>
  36. #include <rfb_win32/MsgWindow.h>
  37. #include <rfb_win32/WMCursor.h>
  38. #include <rfb_win32/WMHooks.h>
  39. #include <rfb_win32/WMNotifier.h>
  40. #include <rfb_win32/WMWindowCopyRect.h>
  41. #include <rfb_win32/WMPoller.h>
  42. namespace rfb {
  43. namespace win32 {
  44. //
  45. // -=- SDisplay
  46. //
  47. class SDisplayCore;
  48. class SDisplay : public SDesktop,
  49. WMMonitor::Notifier,
  50. Clipboard::Notifier,
  51. UpdateTracker,
  52. public SocketManager::EventHandler
  53. {
  54. public:
  55. SDisplay(const TCHAR* device=0);
  56. virtual ~SDisplay();
  57. // -=- SDesktop interface
  58. virtual void start(VNCServer* vs);
  59. virtual void stop();
  60. virtual void pointerEvent(const Point& pos, rdr::U8 buttonmask);
  61. virtual void keyEvent(rdr::U32 key, bool down);
  62. virtual void clientCutText(const char* str, int len);
  63. virtual void framebufferUpdateRequest();
  64. virtual Point getFbSize();
  65. // -=- UpdateTracker
  66. virtual void add_changed(const Region& rgn);
  67. virtual void add_copied(const Region& dest, const Point& delta);
  68. // -=- Clipboard
  69. virtual void notifyClipboardChanged(const char* text, int len);
  70. // -=- Display events
  71. virtual void notifyDisplayEvent(WMMonitor::Notifier::DisplayEventType evt);
  72. // -=- EventHandler interface
  73. HANDLE getUpdateEvent() {return updateEvent;}
  74. virtual bool processEvent(HANDLE event);
  75. // -=- Notification of whether or not SDisplay is started
  76. void setStatusLocation(bool* status) {statusLocation = status;}
  77. friend class SDisplayCore;
  78. static BoolParameter use_hooks;
  79. static BoolParameter disableLocalInputs;
  80. static StringParameter disconnectAction;
  81. static BoolParameter removeWallpaper;
  82. static BoolParameter removePattern;
  83. static BoolParameter disableEffects;
  84. protected:
  85. void restart();
  86. void recreatePixelBuffer();
  87. bool flushChangeTracker(); // true if flushed, false if empty
  88. void triggerUpdate();
  89. VNCServer* server;
  90. // -=- Display pixel buffer
  91. DeviceFrameBuffer* pb;
  92. TCharArray deviceName;
  93. HDC device;
  94. bool releaseDevice;
  95. // -=- The coordinates of Window's entire virtual Screen
  96. Rect screenRect;
  97. // -=- All changes are collected in Display coords and merged
  98. SimpleUpdateTracker change_tracker;
  99. // -=- Internal SDisplay implementation
  100. SDisplayCore* core;
  101. // -=- Cursor
  102. WMCursor::Info old_cursor;
  103. Region old_cursor_region;
  104. Point cursor_renderpos;
  105. // -=- Event signalled to trigger an update to be flushed
  106. Handle updateEvent;
  107. // -=- Where to write the active/inactive indicator to
  108. bool* statusLocation;
  109. };
  110. }
  111. }
  112. #endif // __RFB_SDISPLAY_H__