summaryrefslogtreecommitdiff
path: root/packages/xorg-xserver/xserver-kdrive-xomap/fixups.patch
blob: 09c9e8909c4638d494bd59e62a42b7f2973daabc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
---
 Xi/chgdctl.c                   |   55 +++++++++++++++++++------
 Xi/getdctl.c                   |   87 +++++++++++++++++++++++++++++++----------
 Xi/getdctl.h                   |   11 +++--
 Xi/stubs.c                     |    2 
 configure.ac                   |    2 
 dix/devices.c                  |   31 +++++++++-----
 hw/kdrive/linux/tslib.c        |    8 +--
 hw/kdrive/src/kinput.c         |    6 +-
 hw/xfree86/common/xf86Xinput.c |    3 -
 include/input.h                |    2 
 include/inputstr.h             |   18 +++++++-
 11 files changed, 162 insertions(+), 63 deletions(-)

Index: xorg-server-1.1.99.3/Xi/chgdctl.c
===================================================================
--- xorg-server-1.1.99.3.orig/Xi/chgdctl.c	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/Xi/chgdctl.c	2007-01-29 22:59:27.000000000 +0000
@@ -104,8 +104,10 @@ ProcXChangeDeviceControl(ClientPtr clien
     xChangeDeviceControlReply rep;
     AxisInfoPtr a;
     CARD32 *resolution;
-    xDeviceTSCtl *ts;
+    xDeviceAbsCalibCtl *calib;
+    xDeviceAbsAreaCtl *area;
     xDeviceCoreCtl *c;
+    xDeviceEnableCtl *e;
 
     REQUEST(xChangeDeviceControlReq);
     REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -170,25 +172,28 @@ ProcXChangeDeviceControl(ClientPtr clien
 	    return Success;
 	}
 	break;
-    case DEVICE_TOUCHSCREEN:
-        ts = (xDeviceTSCtl *)&stuff[1];
-
-        if (ts->button_threshold < 0 || ts->button_threshold > 255) {
+    case DEVICE_ABS_CALIB:
+        calib = (xDeviceAbsCalibCtl *)&stuff[1];
+ 
+        if (calib->button_threshold < 0 || calib->button_threshold > 255) {
             SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
                               BadValue);
             return Success;
         }
 
-        status = ChangeDeviceControl(client, dev, (xDeviceCtl *) ts);
+        status = ChangeDeviceControl(client, dev, (xDeviceCtl *) calib);
 
         if (status == Success) {
-            dev->touchscreen->min_x = ts->min_x;
-            dev->touchscreen->max_x = ts->max_x;
-            dev->touchscreen->min_y = ts->min_y;
-            dev->touchscreen->max_y = ts->max_y;
-            dev->touchscreen->button_threshold = ts->button_threshold;
-        } else if (status == DeviceBusy) {
-            rep.status = DeviceBusy;
+            dev->absolute->min_x = calib->min_x;
+            dev->absolute->max_x = calib->max_x;
+            dev->absolute->min_y = calib->min_y;
+            dev->absolute->max_y = calib->max_y;
+            dev->absolute->flip_x = calib->flip_x;
+            dev->absolute->flip_y = calib->flip_y;
+            dev->absolute->rotation = calib->rotation;
+            dev->absolute->button_threshold = calib->button_threshold;
+        } else if (status == DeviceBusy || status == BadValue) {
+            rep.status = status;
             WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
                                &rep);
             return Success;
@@ -199,6 +204,30 @@ ProcXChangeDeviceControl(ClientPtr clien
         }
 
         break;
+    case DEVICE_ABS_AREA:
+        area = (xDeviceAbsAreaCtl *)&stuff[1];
+
+        status = ChangeDeviceControl(client, dev, (xDeviceCtl *) area);
+
+        if (status == Success) {
+            dev->absolute->offset_x = area->offset_x;
+            dev->absolute->offset_y = area->offset_y;
+            dev->absolute->width = area->width;
+            dev->absolute->height = area->height;
+            dev->absolute->screen = area->screen;
+            dev->absolute->following = area->following;
+        } else if (status == DeviceBusy || status == BadValue) {
+            rep.status = status;
+            WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+                                     &rep);
+            return Success;
+        } else {
+            SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
+                              BadMatch);
+            return Success;
+        }
+
+        break;	
     case DEVICE_CORE:
         c = (xDeviceCoreCtl *)&stuff[1];
 
Index: xorg-server-1.1.99.3/Xi/getdctl.c
===================================================================
--- xorg-server-1.1.99.3.orig/Xi/getdctl.c	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/Xi/getdctl.c	2007-01-29 22:59:27.000000000 +0000
@@ -124,14 +124,23 @@ ProcXGetDeviceControl(ClientPtr client)
 	total_length = sizeof(xDeviceResolutionState) +
 	    (3 * sizeof(int) * dev->valuator->numAxes);
 	break;
-    case DEVICE_TOUCHSCREEN:
-        if (!dev->touchscreen) {
+    case DEVICE_ABS_CALIB:
+        if (!dev->absolute) {
             SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
                               BadMatch);
             return Success;
         }
 
-        total_length = sizeof(xDeviceTSCtl);
+        total_length = sizeof(xDeviceAbsCalibCtl);
+        break;
+    case DEVICE_ABS_AREA:
+        if (!dev->absolute) {
+            SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+                              BadMatch);
+            return Success;
+        }
+
+        total_length = sizeof(xDeviceAbsAreaCtl);
         break;
     case DEVICE_CORE:
         total_length = sizeof(xDeviceCoreCtl);
@@ -152,8 +161,11 @@ ProcXGetDeviceControl(ClientPtr client)
     case DEVICE_RESOLUTION:
 	CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
 	break;
-    case DEVICE_TOUCHSCREEN:
-        CopySwapDeviceTouchscreen(client, dev->touchscreen, buf);
+    case DEVICE_ABS_CALIB:
+        CopySwapDeviceAbsCalib(client, dev->absolute, buf);
+        break;
+    case DEVICE_ABS_AREA:
+        CopySwapDeviceAbsArea(client, dev->absolute, buf);
         break;
     case DEVICE_CORE:
         CopySwapDeviceCore(client, dev, buf);
@@ -206,28 +218,61 @@ CopySwapDeviceResolution(ClientPtr clien
     }
 }
 
-void CopySwapDeviceTouchscreen (ClientPtr client, TouchscreenClassPtr dts,
+void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
                                 char *buf)
 {
     register char n;
-    xDeviceTSState *ts = (xDeviceTSState *) buf;
+    xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
 
-    ts->control = DEVICE_TOUCHSCREEN;
-    ts->length = sizeof(ts);
-    ts->min_x = dts->min_x;
-    ts->max_x = dts->max_x;
-    ts->min_y = dts->min_y;
-    ts->max_y = dts->max_y;
-    ts->button_threshold = dts->button_threshold;
+    calib->control = DEVICE_ABS_CALIB;
+    calib->length = sizeof(calib);
+    calib->min_x = dts->min_x;
+    calib->max_x = dts->max_x;
+    calib->min_y = dts->min_y;
+    calib->max_y = dts->max_y;
+    calib->flip_x = dts->flip_x;
+    calib->flip_y = dts->flip_y;
+    calib->rotation = dts->rotation;
+    calib->button_threshold = dts->button_threshold;
 
     if (client->swapped) {
-        swaps(&ts->control, n);
-        swaps(&ts->length, n);
-        swapl(&ts->min_x, n);
-        swapl(&ts->max_x, n);
-        swapl(&ts->min_y, n);
-        swapl(&ts->max_y, n);
-        swapl(&ts->button_threshold, n);
+        swaps(&calib->control, n);
+        swaps(&calib->length, n);
+        swapl(&calib->min_x, n);
+        swapl(&calib->max_x, n);
+        swapl(&calib->min_y, n);
+        swapl(&calib->max_y, n);
+        swapl(&calib->flip_x, n);
+        swapl(&calib->flip_y, n);
+        swapl(&calib->rotation, n);
+        swapl(&calib->button_threshold, n);
+    }
+}
+
+void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
+                                 char *buf)
+{
+    register char n;
+    xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf;
+
+    area->control = DEVICE_ABS_AREA;
+    area->length = sizeof(area);
+    area->offset_x = dts->offset_x;
+    area->offset_y = dts->offset_y;
+    area->width = dts->width;
+    area->height = dts->height;
+    area->screen = dts->screen;
+    area->following = dts->following;
+
+    if (client->swapped) {
+        swaps(&area->control, n);
+        swaps(&area->length, n);
+        swapl(&area->offset_x, n);
+        swapl(&area->offset_y, n);
+        swapl(&area->width, n);
+        swapl(&area->height, n);
+        swapl(&area->screen, n);
+        swapl(&area->following, n);
     }
 }
 
Index: xorg-server-1.1.99.3/Xi/getdctl.h
===================================================================
--- xorg-server-1.1.99.3.orig/Xi/getdctl.h	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/Xi/getdctl.h	2007-01-29 22:59:27.000000000 +0000
@@ -42,10 +42,13 @@ void CopySwapDeviceResolution(ClientPtr 
 			      int	/* length */
     );
 
-void CopySwapDeviceTouchscreen(ClientPtr /* client */ ,
-                               TouchscreenClassPtr /* ts */ ,
-                               char * /* buf */
-    );
+void CopySwapDeviceAbsCalib (ClientPtr client,
+                             AbsoluteClassPtr dts,
+                             char *buf);
+
+void CopySwapDeviceAbsArea (ClientPtr client,
+                            AbsoluteClassPtr dts,
+                            char *buf);
 
 void CopySwapDeviceCore(ClientPtr /* client */ ,
                         DeviceIntPtr /* dev */ ,
Index: xorg-server-1.1.99.3/Xi/stubs.c
===================================================================
--- xorg-server-1.1.99.3.orig/Xi/stubs.c	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/Xi/stubs.c	2007-01-29 22:59:27.000000000 +0000
@@ -287,7 +287,7 @@ ChangeDeviceControl(register ClientPtr c
     switch (control->control) {
     case DEVICE_RESOLUTION:
 	return (BadMatch);
-    case DEVICE_TOUCHSCREEN:
+    case DEVICE_ABS_CALIB:
         return (BadMatch);
     case DEVICE_CORE:
         return (BadMatch);
Index: xorg-server-1.1.99.3/dix/devices.c
===================================================================
--- xorg-server-1.1.99.3.orig/dix/devices.c	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/dix/devices.c	2007-01-29 22:59:27.000000000 +0000
@@ -117,7 +117,7 @@ AddInputDevice(DeviceProc deviceProc, Bo
     dev->button = (ButtonClassPtr)NULL;
     dev->focus = (FocusClassPtr)NULL;
     dev->proximity = (ProximityClassPtr)NULL;
-    dev->touchscreen = (TouchscreenClassPtr)NULL;
+    dev->absolute = (AbsoluteClassPtr)NULL;
     dev->kbdfeed = (KbdFeedbackPtr)NULL;
     dev->ptrfeed = (PtrFeedbackPtr)NULL;
     dev->intfeed = (IntegerFeedbackPtr)NULL;
@@ -821,22 +821,31 @@ InitValuatorClassDeviceStruct(DeviceIntP
 }
 
 _X_EXPORT Bool
-InitTouchscreenClassDeviceStruct(DeviceIntPtr dev)
+InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
 {
-    register TouchscreenClassPtr tsc;
+    register AbsoluteClassPtr abs;
 
-    tsc = (TouchscreenClassPtr)xalloc(sizeof(TouchscreenClassRec));
-    if (!tsc)
+    abs = (AbsoluteClassPtr)xalloc(sizeof(AbsoluteClassRec));
+    if (!abs)
         return FALSE;
 
     /* we don't do anything sensible with these, but should */
-    tsc->min_x = -1;
-    tsc->min_y = -1;
-    tsc->max_x = -1;
-    tsc->max_y = -1;
+    abs->min_x = -1;
+    abs->min_y = -1;
+    abs->max_x = -1;
+    abs->max_y = -1;
+    abs->flip_x = 0;
+    abs->flip_y = 0;
+    abs->rotation = 0;
+    abs->button_threshold = 0;
 
-    tsc->button_threshold = 0;
-    dev->touchscreen = tsc;
+    abs->offset_x = 0;
+    abs->offset_y = 0;
+    abs->width = -1;
+    abs->height = -1;
+    abs->following = 0;
+
+    dev->absolute = abs;
 
     return TRUE;
 }
Index: xorg-server-1.1.99.3/hw/xfree86/common/xf86Xinput.c
===================================================================
--- xorg-server-1.1.99.3.orig/hw/xfree86/common/xf86Xinput.c	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/hw/xfree86/common/xf86Xinput.c	2007-01-29 22:59:27.000000000 +0000
@@ -538,7 +538,8 @@ ChangeDeviceControl (ClientPtr client, D
       switch (control->control) {
       case DEVICE_CORE:
       case DEVICE_RESOLUTION:
-      case DEVICE_TOUCHSCREEN:
+      case DEVICE_ABS_CALIB:
+      case DEVICE_ABS_AREA:
         return Success;
       default:
         return BadMatch;
Index: xorg-server-1.1.99.3/include/input.h
===================================================================
--- xorg-server-1.1.99.3.orig/include/input.h	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/include/input.h	2007-01-29 22:59:27.000000000 +0000
@@ -238,7 +238,7 @@ extern Bool InitValuatorClassDeviceStruc
     int /*numMotionEvents*/,
     int /*mode*/);
 
-extern Bool InitTouchscreenClassDeviceStruct(
+extern Bool InitAbsoluteClassDeviceStruct(
     DeviceIntPtr /*device*/);
 
 extern Bool InitFocusClassDeviceStruct(
Index: xorg-server-1.1.99.3/include/inputstr.h
===================================================================
--- xorg-server-1.1.99.3.orig/include/inputstr.h	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/include/inputstr.h	2007-01-29 22:59:27.000000000 +0000
@@ -185,13 +185,25 @@ typedef struct _ProximityClassRec {
     char	pad;
 } ProximityClassRec, *ProximityClassPtr;
 
-typedef struct _TouchscreenClassRec {
+typedef struct _AbsoluteClassRec {
+    /* Calibration. */
     int         min_x;
     int         max_x;
     int         min_y;
     int         max_y;
+    int         flip_x;
+    int         flip_y;
+    int		rotation;
     int         button_threshold;
-} TouchscreenClassRec, *TouchscreenClassPtr;
+
+    /* Area. */
+    int         offset_x;
+    int         offset_y;
+    int         width;
+    int         height;
+    int         screen;
+    XID		following;
+} AbsoluteClassRec, *AbsoluteClassPtr;
 
 typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
 typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
@@ -293,7 +305,7 @@ typedef struct _DeviceIntRec {
     ButtonClassPtr	button;
     FocusClassPtr	focus;
     ProximityClassPtr	proximity;
-    TouchscreenClassPtr touchscreen;
+    AbsoluteClassPtr    absolute;
     KbdFeedbackPtr	kbdfeed;
     PtrFeedbackPtr	ptrfeed;
     IntegerFeedbackPtr	intfeed;
Index: xorg-server-1.1.99.3/configure.ac
===================================================================
--- xorg-server-1.1.99.3.orig/configure.ac	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/configure.ac	2007-01-29 22:59:27.000000000 +0000
@@ -1586,7 +1586,7 @@ if test "$KDRIVE" = yes; then
     #KDRIVE_PURE_LIBS="$DIX_LIB $OS_LIB $FB_LIB $XEXT_LIB $MIEXT_DAMAGE_LIB \
     #    $MIEXT_SHADOW_LIB $XPSTUBS_LIB"
     KDRIVE_XKB_DDX_LIB='$(top_builddir)/hw/kdrive/src/libkdrivexkb.a'
-    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $KDRIVE_XKB_DDX_LIB $XKB_LIB $KDRIVE_XKB_DDX_LIB$COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB $CONFIG_LIB"
+    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $KDRIVE_XKB_DDX_LIB $XKB_LIB $KDRIVE_XKB_DDX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB $CONFIG_LIB"
     KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
     KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a'
     KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.a'
Index: xorg-server-1.1.99.3/hw/kdrive/linux/tslib.c
===================================================================
--- xorg-server-1.1.99.3.orig/hw/kdrive/linux/tslib.c	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/hw/kdrive/linux/tslib.c	2007-01-29 22:59:27.000000000 +0000
@@ -94,7 +94,7 @@ TsRead (int fd, void *closure)
                event.pressure);
         discard = 0;
         if (event.pressure) {
-            if (event.pressure > pi->dixdev->touchscreen->button_threshold) 
+            if (event.pressure > pi->dixdev->absolute->button_threshold) 
                 flags = KD_BUTTON_8;
             else
                 flags = KD_BUTTON_1;
@@ -356,9 +356,9 @@ TslibEnable (KdPointerInfo *pi)
             close(private->fd);
         return BadAlloc;
     }
-    if (pi->dixdev && pi->dixdev->touchscreen &&
-        pi->dixdev->touchscreen->button_threshold == 0)
-        pi->dixdev->touchscreen->button_threshold = 115;
+    if (pi->dixdev && pi->dixdev->absolute &&
+        pi->dixdev->absolute->button_threshold == 0)
+        pi->dixdev->absolute->button_threshold = 115;
 
     DebugF("[tslib/TslibEnable] successfully enabled %s\n", pi->path);
     KdRegisterFd(private->fd, TsRead, pi);
Index: xorg-server-1.1.99.3/hw/kdrive/src/kinput.c
===================================================================
--- xorg-server-1.1.99.3.orig/hw/kdrive/src/kinput.c	2007-01-29 22:58:18.000000000 +0000
+++ xorg-server-1.1.99.3/hw/kdrive/src/kinput.c	2007-01-29 22:59:27.000000000 +0000
@@ -444,7 +444,7 @@ KdPointerProc(DeviceIntPtr pDevice, int 
 
 #ifdef XINPUT
         if (pi->inputClass == KD_TOUCHSCREEN) {
-            InitTouchscreenClassDeviceStruct(pDevice);
+            InitAbsoluteClassDeviceStruct(pDevice);
             xiclass = AtomFromName(XI_TOUCHSCREEN);
         }
         else {
@@ -2323,8 +2323,8 @@ ChangeDeviceControl(register ClientPtr c
         /* FIXME do something more intelligent here */
         return BadMatch;
 
-    case DEVICE_TOUCHSCREEN:
-        if (!pDev->touchscreen)
+    case DEVICE_ABS_CALIB:
+        if (!pDev->absolute)
             return BadDevice;
         else
             return Success;