Annotation of /trunk/tigervnc/patches/tigervnc-1.0.1-r4024.patch
Parent Directory | Revision Log
Revision 1201 -
(hide annotations)
(download)
Mon Nov 22 23:25:59 2010 UTC (13 years, 10 months ago) by niro
File size: 10193 byte(s)
Mon Nov 22 23:25:59 2010 UTC (13 years, 10 months ago) by niro
File size: 10193 byte(s)
-patches for 1.0.1 against xorg-server-1.7
1 | niro | 1201 | From f058349ae6b31424751ea6b3d773bb5d6dae07d5 Mon Sep 17 00:00:00 2001 |
2 | From: Adam Tkac <atkac@redhat.com> | ||
3 | Date: Wed, 10 Mar 2010 17:38:52 +0100 | ||
4 | Subject: [PATCH 1/2] Merge KeyboardDevice and PointerDevice classes. | ||
5 | |||
6 | --- | ||
7 | unix/xserver/hw/vnc/Input.cc | 79 +++++++++++++++------------------ | ||
8 | unix/xserver/hw/vnc/Input.h | 40 +++++++---------- | ||
9 | unix/xserver/hw/vnc/XserverDesktop.cc | 16 +++---- | ||
10 | unix/xserver/hw/vnc/XserverDesktop.h | 3 +- | ||
11 | 4 files changed, 61 insertions(+), 77 deletions(-) | ||
12 | |||
13 | diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc | ||
14 | index 0596c64..3b60a5f 100644 | ||
15 | --- a/unix/xserver/hw/vnc/Input.cc | ||
16 | +++ b/unix/xserver/hw/vnc/Input.cc | ||
17 | @@ -116,21 +116,27 @@ static void enqueueEvents(DeviceIntPtr dev, int n) | ||
18 | } | ||
19 | } | ||
20 | |||
21 | -/* Pointer device methods */ | ||
22 | - | ||
23 | -PointerDevice::PointerDevice(rfb::VNCServerST *_server) | ||
24 | +InputDevice::InputDevice(rfb::VNCServerST *_server) | ||
25 | : server(_server), oldButtonMask(0) | ||
26 | { | ||
27 | - dev = AddInputDevice( | ||
28 | + pointerDev = AddInputDevice( | ||
29 | +#if XORG >= 16 | ||
30 | + serverClient, | ||
31 | +#endif | ||
32 | + pointerProc, TRUE); | ||
33 | + RegisterPointerDevice(pointerDev); | ||
34 | + | ||
35 | + keyboardDev = AddInputDevice( | ||
36 | #if XORG >= 16 | ||
37 | - serverClient, | ||
38 | + serverClient, | ||
39 | #endif | ||
40 | - pointerProc, TRUE); | ||
41 | - RegisterPointerDevice(dev); | ||
42 | + keyboardProc, TRUE); | ||
43 | + RegisterKeyboardDevice(keyboardDev); | ||
44 | + | ||
45 | initEventq(); | ||
46 | } | ||
47 | |||
48 | -void PointerDevice::ButtonAction(int buttonMask) | ||
49 | +void InputDevice::PointerButtonAction(int buttonMask) | ||
50 | { | ||
51 | int i, n; | ||
52 | |||
53 | @@ -138,9 +144,9 @@ void PointerDevice::ButtonAction(int buttonMask) | ||
54 | if ((buttonMask ^ oldButtonMask) & (1 << i)) { | ||
55 | int action = (buttonMask & (1<<i)) ? | ||
56 | ButtonPress : ButtonRelease; | ||
57 | - n = GetPointerEvents(eventq, dev, action, i + 1, | ||
58 | + n = GetPointerEvents(eventq, pointerDev, action, i + 1, | ||
59 | POINTER_RELATIVE, 0, 0, NULL); | ||
60 | - enqueueEvents(dev, n); | ||
61 | + enqueueEvents(pointerDev, n); | ||
62 | |||
63 | } | ||
64 | } | ||
65 | @@ -148,7 +154,7 @@ void PointerDevice::ButtonAction(int buttonMask) | ||
66 | oldButtonMask = buttonMask; | ||
67 | } | ||
68 | |||
69 | -void PointerDevice::Move(const rfb::Point &pos) | ||
70 | +void InputDevice::PointerMove(const rfb::Point &pos) | ||
71 | { | ||
72 | int n, valuators[2]; | ||
73 | |||
74 | @@ -157,14 +163,14 @@ void PointerDevice::Move(const rfb::Point &pos) | ||
75 | |||
76 | valuators[0] = pos.x; | ||
77 | valuators[1] = pos.y; | ||
78 | - n = GetPointerEvents(eventq, dev, MotionNotify, 0, POINTER_ABSOLUTE, 0, | ||
79 | + n = GetPointerEvents(eventq, pointerDev, MotionNotify, 0, POINTER_ABSOLUTE, 0, | ||
80 | 2, valuators); | ||
81 | - enqueueEvents(dev, n); | ||
82 | + enqueueEvents(pointerDev, n); | ||
83 | |||
84 | cursorPos = pos; | ||
85 | } | ||
86 | |||
87 | -void PointerDevice::Sync(void) | ||
88 | +void InputDevice::PointerSync(void) | ||
89 | { | ||
90 | if (cursorPos.equals(oldCursorPos)) | ||
91 | return; | ||
92 | @@ -232,19 +238,6 @@ static int pointerProc(DeviceIntPtr pDevice, int onoff) | ||
93 | return Success; | ||
94 | } | ||
95 | |||
96 | -/* KeyboardDevice methods */ | ||
97 | - | ||
98 | -KeyboardDevice::KeyboardDevice(void) | ||
99 | -{ | ||
100 | - dev = AddInputDevice( | ||
101 | -#if XORG >= 16 | ||
102 | - serverClient, | ||
103 | -#endif | ||
104 | - keyboardProc, TRUE); | ||
105 | - RegisterKeyboardDevice(dev); | ||
106 | - initEventq(); | ||
107 | -} | ||
108 | - | ||
109 | #define IS_PRESSED(keyc, keycode) \ | ||
110 | ((keyc)->down[(keycode) >> 3] & (1 << ((keycode) & 7))) | ||
111 | |||
112 | @@ -458,7 +451,7 @@ static struct altKeysym_t { | ||
113 | #define FREE_MAPS | ||
114 | #endif | ||
115 | |||
116 | -void KeyboardDevice::keyEvent(rdr::U32 keysym, bool down) | ||
117 | +void InputDevice::keyEvent(rdr::U32 keysym, bool down) | ||
118 | { | ||
119 | DeviceIntPtr master; | ||
120 | KeyClassPtr keyc; | ||
121 | @@ -484,16 +477,16 @@ void KeyboardDevice::keyEvent(rdr::U32 keysym, bool down) | ||
122 | } | ||
123 | |||
124 | #if XORG >= 17 | ||
125 | - keyc = dev->u.master->key; | ||
126 | + keyc = keyboardDev->u.master->key; | ||
127 | |||
128 | - keymap = XkbGetCoreMap(dev); | ||
129 | + keymap = XkbGetCoreMap(keyboardDev); | ||
130 | if (!keymap) { | ||
131 | vlog.error("VNC keyboard device has no map"); | ||
132 | return; | ||
133 | } | ||
134 | |||
135 | - if (generate_modkeymap(serverClient, dev, &modmap, &maxKeysPerMod) | ||
136 | - != Success) { | ||
137 | + if (generate_modkeymap(serverClient, keyboardDev, &modmap, | ||
138 | + &maxKeysPerMod) != Success) { | ||
139 | vlog.error("generate_modkeymap failed"); | ||
140 | xfree(keymap->map); | ||
141 | xfree(keymap); | ||
142 | @@ -502,7 +495,7 @@ void KeyboardDevice::keyEvent(rdr::U32 keysym, bool down) | ||
143 | |||
144 | state = XkbStateFieldFromRec(&keyc->xkbInfo->state); | ||
145 | #else | ||
146 | - keyc = dev->key; | ||
147 | + keyc = keyboardDev->key; | ||
148 | state = keyc->state; | ||
149 | maxKeysPerMod = keyc->maxKeysPerModifier; | ||
150 | keymap = &keyc->curKeySyms; | ||
151 | @@ -587,24 +580,24 @@ ModeSwitchFound: | ||
152 | #if XORG == 15 | ||
153 | master = inputInfo.keyboard; | ||
154 | #else | ||
155 | - master = dev->u.master; | ||
156 | + master = keyboardDev->u.master; | ||
157 | #endif | ||
158 | void *slave = dixLookupPrivate(&master->devPrivates, | ||
159 | CoreDevicePrivateKey); | ||
160 | - if (dev == slave) { | ||
161 | + if (keyboardDev == slave) { | ||
162 | dixSetPrivate(&master->devPrivates, | ||
163 | CoreDevicePrivateKey, NULL); | ||
164 | #if XORG == 15 | ||
165 | - SwitchCoreKeyboard(dev); | ||
166 | + SwitchCoreKeyboard(keyboardDev); | ||
167 | #else | ||
168 | - CopyKeyClass(dev, master); | ||
169 | + CopyKeyClass(keyboardDev, master); | ||
170 | #endif | ||
171 | } | ||
172 | #else /* XORG < 17 */ | ||
173 | - XkbApplyMappingChange(dev, keymap, minKeyCode, | ||
174 | + XkbApplyMappingChange(keyboardDev, keymap, minKeyCode, | ||
175 | maxKeyCode - minKeyCode + 1, | ||
176 | NULL, serverClient); | ||
177 | - XkbCopyDeviceKeymap(dev->u.master, dev); | ||
178 | + XkbCopyDeviceKeymap(keyboardDev->u.master, keyboardDev); | ||
179 | #endif /* XORG < 17 */ | ||
180 | break; | ||
181 | } | ||
182 | @@ -632,8 +625,8 @@ ModeSwitchFound: | ||
183 | } | ||
184 | } | ||
185 | |||
186 | - ModifierState shift(dev, ShiftMapIndex); | ||
187 | - ModifierState modeSwitch(dev, modeSwitchMapIndex); | ||
188 | + ModifierState shift(keyboardDev, ShiftMapIndex); | ||
189 | + ModifierState modeSwitch(keyboardDev, modeSwitchMapIndex); | ||
190 | if (down) { | ||
191 | if (col & 1) | ||
192 | shift.press(); | ||
193 | @@ -649,8 +642,8 @@ ModeSwitchFound: | ||
194 | |||
195 | vlog.debug("keycode %d %s", kc, down ? "down" : "up"); | ||
196 | action = down ? KeyPress : KeyRelease; | ||
197 | - n = GetKeyboardEvents(eventq, dev, action, kc); | ||
198 | - enqueueEvents(dev, n); | ||
199 | + n = GetKeyboardEvents(eventq, keyboardDev, action, kc); | ||
200 | + enqueueEvents(keyboardDev, n); | ||
201 | |||
202 | /* | ||
203 | * When faking a modifier we are putting a keycode (which can | ||
204 | diff --git a/unix/xserver/hw/vnc/Input.h b/unix/xserver/hw/vnc/Input.h | ||
205 | index 1bfec92..8987085 100644 | ||
206 | --- a/unix/xserver/hw/vnc/Input.h | ||
207 | +++ b/unix/xserver/hw/vnc/Input.h | ||
208 | @@ -1,5 +1,6 @@ | ||
209 | /* Copyright (C) 2009 TightVNC Team | ||
210 | - * Copyright (C) 2009 Red Hat, Inc. | ||
211 | + * Copyright (C) 2009, 2010 Red Hat, Inc. | ||
212 | + * Copyright (C) 2009, 2010 TigerVNC Team | ||
213 | * | ||
214 | * This is free software; you can redistribute it and/or modify | ||
215 | * it under the terms of the GNU General Public License as published by | ||
216 | @@ -31,44 +32,37 @@ extern "C" { | ||
217 | #include "input.h" | ||
218 | }; | ||
219 | |||
220 | -/* Represents pointer device. */ | ||
221 | -class PointerDevice { | ||
222 | +/* Represents input device (keyboard + pointer) */ | ||
223 | +class InputDevice { | ||
224 | public: | ||
225 | - /* Create new PointerDevice instance. */ | ||
226 | - PointerDevice(rfb::VNCServerST *_server); | ||
227 | + /* Create new InputDevice instance */ | ||
228 | + InputDevice(rfb::VNCServerST *_server); | ||
229 | |||
230 | /* | ||
231 | * Press or release buttons. Relationship between buttonMask and | ||
232 | * buttons is specified in RFB protocol. | ||
233 | */ | ||
234 | - void ButtonAction(int buttonMask); | ||
235 | + void PointerButtonAction(int buttonMask); | ||
236 | |||
237 | /* Move pointer to target location (point coords are absolute). */ | ||
238 | - void Move(const rfb::Point &point); | ||
239 | + void PointerMove(const rfb::Point &point); | ||
240 | |||
241 | /* | ||
242 | * Send pointer position to clients. If not called then Move() calls | ||
243 | - * won't be visible to clients. | ||
244 | + * won't be visible to VNC clients. | ||
245 | */ | ||
246 | - void Sync(void); | ||
247 | + void PointerSync(void); | ||
248 | + | ||
249 | + void KeyboardPress(rdr::U32 keysym) { keyEvent(keysym, true); } | ||
250 | + void KeyboardRelease(rdr::U32 keysym) { keyEvent(keysym, false); } | ||
251 | private: | ||
252 | + void keyEvent(rdr::U32 keysym, bool down); | ||
253 | + | ||
254 | rfb::VNCServerST *server; | ||
255 | - DeviceIntPtr dev; | ||
256 | + DeviceIntPtr keyboardDev; | ||
257 | + DeviceIntPtr pointerDev; | ||
258 | int oldButtonMask; | ||
259 | rfb::Point cursorPos, oldCursorPos; | ||
260 | }; | ||
261 | |||
262 | -/* Represents keyboard device. */ | ||
263 | -class KeyboardDevice { | ||
264 | -public: | ||
265 | - /* Create new Keyboard device instance. */ | ||
266 | - KeyboardDevice(void); | ||
267 | - | ||
268 | - void Press(rdr::U32 keysym) { keyEvent(keysym, true); } | ||
269 | - void Release(rdr::U32 keysym) { keyEvent(keysym, false); } | ||
270 | -private: | ||
271 | - void keyEvent(rdr::U32 keysym, bool down); | ||
272 | - DeviceIntPtr dev; | ||
273 | -}; | ||
274 | - | ||
275 | #endif | ||
276 | diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc | ||
277 | index ce8f66b..5971077 100644 | ||
278 | --- a/unix/xserver/hw/vnc/XserverDesktop.cc | ||
279 | +++ b/unix/xserver/hw/vnc/XserverDesktop.cc | ||
280 | @@ -164,8 +164,7 @@ XserverDesktop::XserverDesktop(ScreenPtr pScreen_, | ||
281 | if (httpListener) | ||
282 | httpServer = new FileHTTPServer(this); | ||
283 | |||
284 | - pointerDevice = new PointerDevice(server); | ||
285 | - keyboardDevice = new KeyboardDevice(); | ||
286 | + inputDevice = new InputDevice(server); | ||
287 | } | ||
288 | |||
289 | XserverDesktop::~XserverDesktop() | ||
290 | @@ -174,8 +173,7 @@ XserverDesktop::~XserverDesktop() | ||
291 | delete [] data; | ||
292 | TimerFree(deferredUpdateTimer); | ||
293 | TimerFree(dummyTimer); | ||
294 | - delete pointerDevice; | ||
295 | - delete keyboardDevice; | ||
296 | + delete inputDevice; | ||
297 | delete httpServer; | ||
298 | delete server; | ||
299 | } | ||
300 | @@ -586,7 +584,7 @@ void XserverDesktop::wakeupHandler(fd_set* fds, int nfds) | ||
301 | } | ||
302 | } | ||
303 | |||
304 | - pointerDevice->Sync(); | ||
305 | + inputDevice->PointerSync(); | ||
306 | } | ||
307 | |||
308 | int timeout = server->checkTimeouts(); | ||
309 | @@ -645,8 +643,8 @@ void XserverDesktop::approveConnection(void* opaqueId, bool accept, | ||
310 | |||
311 | void XserverDesktop::pointerEvent(const Point& pos, int buttonMask) | ||
312 | { | ||
313 | - pointerDevice->Move(pos); | ||
314 | - pointerDevice->ButtonAction(buttonMask); | ||
315 | + inputDevice->PointerMove(pos); | ||
316 | + inputDevice->PointerButtonAction(buttonMask); | ||
317 | } | ||
318 | |||
319 | void XserverDesktop::clientCutText(const char* str, int len) | ||
320 | @@ -807,7 +805,7 @@ void XserverDesktop::lookup(int index, int* r, int* g, int* b) | ||
321 | void XserverDesktop::keyEvent(rdr::U32 keysym, bool down) | ||
322 | { | ||
323 | if (down) | ||
324 | - keyboardDevice->Press(keysym); | ||
325 | + inputDevice->KeyboardPress(keysym); | ||
326 | else | ||
327 | - keyboardDevice->Release(keysym); | ||
328 | + inputDevice->KeyboardRelease(keysym); | ||
329 | } | ||
330 | diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h | ||
331 | index 6e4f609..1c03705 100644 | ||
332 | --- a/unix/xserver/hw/vnc/XserverDesktop.h | ||
333 | +++ b/unix/xserver/hw/vnc/XserverDesktop.h | ||
334 | @@ -122,8 +122,7 @@ private: | ||
335 | pointer arg); | ||
336 | void deferUpdate(); | ||
337 | ScreenPtr pScreen; | ||
338 | - PointerDevice *pointerDevice; | ||
339 | - KeyboardDevice *keyboardDevice; | ||
340 | + InputDevice *inputDevice; | ||
341 | OsTimerPtr deferredUpdateTimer, dummyTimer; | ||
342 | rfb::VNCServerST* server; | ||
343 | rfb::HTTPServer* httpServer; | ||
344 | -- | ||
345 | 1.7.0.1 | ||
346 |