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