diff options
Diffstat (limited to 'meta/packages/xorg-xserver/xserver-kdrive-1.4.99.901/xcalibrate-new-input-world-order.patch')
-rw-r--r-- | meta/packages/xorg-xserver/xserver-kdrive-1.4.99.901/xcalibrate-new-input-world-order.patch | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/meta/packages/xorg-xserver/xserver-kdrive-1.4.99.901/xcalibrate-new-input-world-order.patch b/meta/packages/xorg-xserver/xserver-kdrive-1.4.99.901/xcalibrate-new-input-world-order.patch new file mode 100644 index 0000000000..2cc9e60d8d --- /dev/null +++ b/meta/packages/xorg-xserver/xserver-kdrive-1.4.99.901/xcalibrate-new-input-world-order.patch | |||
@@ -0,0 +1,159 @@ | |||
1 | CRUDE HACK ALERT: this patch adds a new device control (DEVICE_RAWEVENT) | ||
2 | which cannot be exported in the protocol because the xDeviceRaweventCtl | ||
3 | carries a C pointer to the tslib event hook. For lack of a better idea, | ||
4 | I added this to get the event hook pointer from Xext/xcalibrate.c into | ||
5 | tslib.c, where the now-private _raw_event_hook and _raw_event_closure | ||
6 | pointers are manipulated instead of, like before, in the Xcalibrate | ||
7 | extension itself. | ||
8 | |||
9 | Index: xorg-server-1.4/Xext/xcalibrate.c | ||
10 | =================================================================== | ||
11 | --- xorg-server-1.4.orig/Xext/xcalibrate.c 2007-09-08 13:22:55.000000000 +0200 | ||
12 | +++ xorg-server-1.4/Xext/xcalibrate.c 2007-09-08 16:03:17.000000000 +0200 | ||
13 | @@ -33,14 +33,14 @@ | ||
14 | #include "os.h" | ||
15 | #include "dixstruct.h" | ||
16 | #include "extnsionst.h" | ||
17 | +#include "inputstr.h" /* for inputInfo */ | ||
18 | #include "swaprep.h" | ||
19 | |||
20 | +#include <X11/extensions/XI.h> /* for XI_TOUCHSCREEN */ | ||
21 | +#include <X11/extensions/XIproto.h> /* for xDeviceCtl */ | ||
22 | #include <X11/extensions/xcalibrateproto.h> | ||
23 | #include <X11/extensions/xcalibratewire.h> | ||
24 | |||
25 | -extern void (*tslib_raw_event_hook)(int x, int y, int pressure, void *closure); | ||
26 | -extern void *tslib_raw_event_closure; | ||
27 | - | ||
28 | static CARD8 XCalibrateReqCode; | ||
29 | int XCalibrateEventBase; | ||
30 | int XCalibrateReqBase; | ||
31 | @@ -64,6 +64,31 @@ | ||
32 | WriteEventsToClient (pClient, 1, (xEvent *) &ev); | ||
33 | } | ||
34 | |||
35 | +#define DEVICE_RAWEVENT 6 | ||
36 | +typedef struct { | ||
37 | + CARD16 control B16; | ||
38 | + CARD16 length B16; | ||
39 | + void *hook; | ||
40 | +} xDeviceRaweventCtl; | ||
41 | + | ||
42 | +static void | ||
43 | +xcalibrate_set_event_hook (void *hook, ClientPtr client) | ||
44 | +{ | ||
45 | + DeviceIntPtr devtmp; | ||
46 | + Atom xiclass; | ||
47 | + xDeviceRaweventCtl rawevent; | ||
48 | + | ||
49 | + rawevent.control = DEVICE_RAWEVENT; | ||
50 | + rawevent.length = sizeof(rawevent); | ||
51 | + rawevent.hook = hook; | ||
52 | + | ||
53 | + xiclass = MakeAtom(XI_TOUCHSCREEN, strlen(XI_TOUCHSCREEN), 1); | ||
54 | + | ||
55 | + for (devtmp = inputInfo.devices; devtmp; devtmp = devtmp->next) | ||
56 | + if (devtmp->type == xiclass) | ||
57 | + ChangeDeviceControl(client, devtmp, (xDeviceCtl *) &rawevent); | ||
58 | +} | ||
59 | + | ||
60 | static int | ||
61 | ProcXCalibrateQueryVersion (ClientPtr client) | ||
62 | { | ||
63 | @@ -124,8 +149,7 @@ | ||
64 | { | ||
65 | /* Start calibrating. */ | ||
66 | xcalibrate_client = client; | ||
67 | - tslib_raw_event_hook = xcalibrate_event_hook; | ||
68 | - tslib_raw_event_closure = client; | ||
69 | + xcalibrate_set_event_hook(xcalibrate_event_hook, client); | ||
70 | rep.status = GrabSuccess; | ||
71 | } | ||
72 | else | ||
73 | @@ -139,8 +163,7 @@ | ||
74 | { | ||
75 | /* Stop calibrating. */ | ||
76 | xcalibrate_client = NULL; | ||
77 | - tslib_raw_event_hook = NULL; | ||
78 | - tslib_raw_event_closure = NULL; | ||
79 | + xcalibrate_set_event_hook(NULL, NULL); | ||
80 | rep.status = GrabSuccess; | ||
81 | |||
82 | /* Cycle input off and on to reload configuration. */ | ||
83 | @@ -277,8 +300,7 @@ | ||
84 | { | ||
85 | /* Stop calibrating. */ | ||
86 | xcalibrate_client = NULL; | ||
87 | - tslib_raw_event_hook = NULL; | ||
88 | - tslib_raw_event_closure = NULL; | ||
89 | + xcalibrate_set_event_hook(NULL, NULL); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | Index: xorg-server-1.4/hw/kdrive/linux/tslib.c | ||
94 | =================================================================== | ||
95 | --- xorg-server-1.4.orig/hw/kdrive/linux/tslib.c 2007-09-08 14:46:41.000000000 +0200 | ||
96 | +++ xorg-server-1.4/hw/kdrive/linux/tslib.c 2007-09-08 16:10:57.000000000 +0200 | ||
97 | @@ -56,6 +56,13 @@ | ||
98 | int phys_screen; | ||
99 | }; | ||
100 | |||
101 | +void | ||
102 | +tslib_set_raw_event_hook(KdPointerInfo *pi, void *hook, void *closure) | ||
103 | +{ | ||
104 | + struct TslibPrivate *private = pi->driverPrivate; | ||
105 | + private->raw_event_hook = hook; | ||
106 | + private->raw_event_closure = closure; | ||
107 | +} | ||
108 | |||
109 | static void | ||
110 | TsRead (int fd, void *closure) | ||
111 | Index: xorg-server-1.4/hw/kdrive/src/kinput.c | ||
112 | =================================================================== | ||
113 | --- xorg-server-1.4.orig/hw/kdrive/src/kinput.c 2007-09-08 14:45:01.000000000 +0200 | ||
114 | +++ xorg-server-1.4/hw/kdrive/src/kinput.c 2007-09-08 16:09:32.000000000 +0200 | ||
115 | @@ -2389,10 +2389,19 @@ | ||
116 | return BadMatch; | ||
117 | } | ||
118 | |||
119 | +#define DEVICE_RAWEVENT 6 | ||
120 | +typedef struct { | ||
121 | + CARD16 control B16; | ||
122 | + CARD16 length B16; | ||
123 | + void *hook; | ||
124 | +} xDeviceRaweventCtl; | ||
125 | + | ||
126 | int | ||
127 | ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev, | ||
128 | xDeviceCtl *control) | ||
129 | { | ||
130 | + KdPointerInfo *pi; | ||
131 | + | ||
132 | switch (control->control) { | ||
133 | case DEVICE_RESOLUTION: | ||
134 | /* FIXME do something more intelligent here */ | ||
135 | @@ -2406,6 +2415,24 @@ | ||
136 | case DEVICE_ENABLE: | ||
137 | return Success; | ||
138 | |||
139 | + case DEVICE_RAWEVENT: | ||
140 | + if (!pDev) | ||
141 | + return BadImplementation; | ||
142 | + | ||
143 | + for (pi = kdPointers; pi; pi = pi->next) { | ||
144 | + if (pi->dixdev && pi->dixdev->id == pDev->id) | ||
145 | + break; | ||
146 | + } | ||
147 | + | ||
148 | + if (!pi || !pi->dixdev || pi->dixdev->id != pDev->id) { | ||
149 | + ErrorF("[ChangeDeviceControl] Failed to find pointer for device %d!\n", | ||
150 | + pDev->id); | ||
151 | + return BadImplementation; | ||
152 | + } | ||
153 | + | ||
154 | + tslib_set_raw_event_hook(pi, ((xDeviceRaweventCtl *)control)->hook, client); | ||
155 | + return Success; | ||
156 | + | ||
157 | default: | ||
158 | return BadMatch; | ||
159 | } | ||