summaryrefslogtreecommitdiff
path: root/recipes/xorg-driver/xf86-input-tslib/01_fix-wrong-value-range-for-the-axises.diff
blob: b5407102b9c7327e192e7329603da079b7df2c2f (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
--- xf86-input-tslib-0.0.5.orig/src/tslib.c
+++ xf86-input-tslib-0.0.5/src/tslib.c
@@ -183,7 +185,7 @@
 {
 	InputInfoPtr pInfo;
 	unsigned char map[MAXBUTTONS + 1];
-	int i;
+	int i, axiswidth, axisheight;
 	struct ts_priv *priv;
 
 	ErrorF("%s\n", __FUNCTION__);
@@ -212,17 +226,29 @@
 			return !Success;
 		}
 
+		switch(priv->rotate) {
+		case TSLIB_ROTATE_CW:
+		case TSLIB_ROTATE_CCW:
+			axiswidth = priv->height;
+			axisheight = priv->width;
+			break;
+		default:
+			axiswidth = priv->width;
+			axisheight = priv->height;
+			break;
+		}
+
 		InitValuatorAxisStruct(device, 0, 0,    	/* min val */
-					       priv->width - 1,	/* max val */
-					       priv->width,	/* resolution */
+					       axiswidth - 1,	/* max val */
+					       axiswidth,	/* resolution */
 					       0,		/* min_res */
-					       priv->width);	/* max_res */
+					       axiswidth);	/* max_res */
 
 		InitValuatorAxisStruct(device, 1, 0,    	/* min val */
-					       priv->height - 1,/* max val */
-					       priv->height,	/* resolution */
+					       axisheight - 1,	/* max val */
+					       axisheight,	/* resolution */
 					       0,		/* min_res */
-					       priv->height);	/* max_res */
+					       axisheight);	/* max_res */
 
 		if (InitProximityClassDeviceStruct (device) == FALSE) {
 			ErrorF ("Unable to allocate EVTouch touchscreen ProximityClassDeviceStruct\n");