Contents of /trunk/tigervnc/patches/tigervnc-1.0.1-r4025.patch
Parent Directory | Revision Log
Revision 1201 -
(show annotations)
(download)
Mon Nov 22 23:25:59 2010 UTC (13 years, 10 months ago) by niro
File size: 3627 byte(s)
Mon Nov 22 23:25:59 2010 UTC (13 years, 10 months ago) by niro
File size: 3627 byte(s)
-patches for 1.0.1 against xorg-server-1.7
1 | From d400267b6f170b82ba826d598df78e0f5519481c Mon Sep 17 00:00:00 2001 |
2 | From: Adam Tkac <atkac@redhat.com> |
3 | Date: Wed, 14 Apr 2010 11:15:07 +0200 |
4 | Subject: [PATCH 2/2] Use AllocDevicePair instead of AddDevice/RegisterDevice functions and initialize |
5 | TigerVNC input devices after core devices initialization. |
6 | |
7 | --- |
8 | unix/xserver/hw/vnc/Input.cc | 37 ++++++++++++++++++++++++++++++++++++- |
9 | unix/xserver/hw/vnc/Input.h | 10 ++++++++++ |
10 | 2 files changed, 46 insertions(+), 1 deletions(-) |
11 | |
12 | diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc |
13 | index 3b60a5f..d108763 100644 |
14 | --- a/unix/xserver/hw/vnc/Input.cc |
15 | +++ b/unix/xserver/hw/vnc/Input.cc |
16 | @@ -119,6 +119,7 @@ static void enqueueEvents(DeviceIntPtr dev, int n) |
17 | InputDevice::InputDevice(rfb::VNCServerST *_server) |
18 | : server(_server), oldButtonMask(0) |
19 | { |
20 | +#if XORG < 17 |
21 | pointerDev = AddInputDevice( |
22 | #if XORG >= 16 |
23 | serverClient, |
24 | @@ -132,7 +133,7 @@ InputDevice::InputDevice(rfb::VNCServerST *_server) |
25 | #endif |
26 | keyboardProc, TRUE); |
27 | RegisterKeyboardDevice(keyboardDev); |
28 | - |
29 | +#endif |
30 | initEventq(); |
31 | } |
32 | |
33 | @@ -140,6 +141,8 @@ void InputDevice::PointerButtonAction(int buttonMask) |
34 | { |
35 | int i, n; |
36 | |
37 | + initInputDevice(); |
38 | + |
39 | for (i = 0; i < BUTTONS; i++) { |
40 | if ((buttonMask ^ oldButtonMask) & (1 << i)) { |
41 | int action = (buttonMask & (1<<i)) ? |
42 | @@ -161,6 +164,8 @@ void InputDevice::PointerMove(const rfb::Point &pos) |
43 | if (pos.equals(cursorPos)) |
44 | return; |
45 | |
46 | + initInputDevice(); |
47 | + |
48 | valuators[0] = pos.x; |
49 | valuators[1] = pos.y; |
50 | n = GetPointerEvents(eventq, pointerDev, MotionNotify, 0, POINTER_ABSOLUTE, 0, |
51 | @@ -238,6 +243,34 @@ static int pointerProc(DeviceIntPtr pDevice, int onoff) |
52 | return Success; |
53 | } |
54 | |
55 | +void InputDevice::initInputDevice(void) |
56 | +{ |
57 | +#if XORG >= 17 |
58 | + int ret; |
59 | + static int initialized = 0; |
60 | + |
61 | + if (initialized != 0) |
62 | + return; |
63 | + |
64 | + initialized = 1; |
65 | + |
66 | + ret = AllocDevicePair(serverClient, "TigerVNC", &pointerDev, |
67 | + &keyboardDev, pointerProc, keyboardProc, |
68 | + FALSE); |
69 | + |
70 | + if (ret != Success) |
71 | + FatalError("Failed to initialize TigerVNC input devices\n"); |
72 | + |
73 | + if (ActivateDevice(pointerDev, TRUE) != Success || |
74 | + ActivateDevice(keyboardDev, TRUE) != Success) |
75 | + FatalError("Failed to activate TigerVNC devices\n"); |
76 | + |
77 | + if (!EnableDevice(pointerDev, TRUE) || |
78 | + !EnableDevice(keyboardDev, TRUE)) |
79 | + FatalError("Failed to activate TigerVNC devices\n"); |
80 | +#endif |
81 | +} |
82 | + |
83 | #define IS_PRESSED(keyc, keycode) \ |
84 | ((keyc)->down[(keycode) >> 3] & (1 << ((keycode) & 7))) |
85 | |
86 | @@ -463,6 +496,8 @@ void InputDevice::keyEvent(rdr::U32 keysym, bool down) |
87 | unsigned int i, n; |
88 | int j, k, action, state, maxKeysPerMod; |
89 | |
90 | + initInputDevice(); |
91 | + |
92 | /* |
93 | * Since we are checking the current state to determine if we need |
94 | * to fake modifiers, we must make sure that everything put on the |
95 | diff --git a/unix/xserver/hw/vnc/Input.h b/unix/xserver/hw/vnc/Input.h |
96 | index 8987085..dbc78f8 100644 |
97 | --- a/unix/xserver/hw/vnc/Input.h |
98 | +++ b/unix/xserver/hw/vnc/Input.h |
99 | @@ -56,6 +56,16 @@ public: |
100 | void KeyboardPress(rdr::U32 keysym) { keyEvent(keysym, true); } |
101 | void KeyboardRelease(rdr::U32 keysym) { keyEvent(keysym, false); } |
102 | private: |
103 | + /* |
104 | + * Init input device. This cannot be done in the constructor |
105 | + * because constructor is called during X server extensions |
106 | + * initialization. Devices must be initialized after core |
107 | + * pointer/keyboard initialization which is actually after extesions |
108 | + * initialization. Check InitExtensions(), InitCoreDevices() and |
109 | + * InitInput() calls in dix/main.c |
110 | + */ |
111 | + void initInputDevice(void); |
112 | + |
113 | void keyEvent(rdr::U32 keysym, bool down); |
114 | |
115 | rfb::VNCServerST *server; |
116 | -- |
117 | 1.7.0.1 |
118 |