1 diff -Naur linuxwacom-0.7.0/src/wcmCommon.c linuxwacom-0.7.0-rotate/src/wcmCommon.c
2 --- linuxwacom-0.7.0/src/wcmCommon.c 2005-09-19 19:43:14.000000000 -0400
3 +++ linuxwacom-0.7.0-rotate/src/wcmCommon.c 2005-11-22 16:44:41.000000000 -0500
6 x = common->wcmMaxX - tmp_coord;
8 + else if (common->wcmRotate == ROTATE_HALF)
10 + x = common->wcmMaxX - x;
11 + y = common->wcmMaxY - y;
14 is_absolute = (priv->flags & ABSOLUTE_FLAG);
15 is_core_pointer = xf86IsCorePointer(local->dev);
16 diff -Naur linuxwacom-0.7.0/src/xf86Wacom.c linuxwacom-0.7.0-rotate/src/xf86Wacom.c
17 --- linuxwacom-0.7.0/src/xf86Wacom.c 2005-09-19 19:43:14.000000000 -0400
18 +++ linuxwacom-0.7.0-rotate/src/xf86Wacom.c 2005-12-07 22:57:46.000000000 -0500
20 LocalDevicePtr local = (LocalDevicePtr)pWcm->public.devicePrivate;
21 WacomDevicePtr priv = (WacomDevicePtr)PRIVATE(pWcm);
22 WacomCommonPtr common = priv->common;
23 - int totalWidth = 0, maxHeight = 0, tabletSize = 0;
24 + int totalWidth = 0, maxHeight = 0;
25 double screenRatio, tabletRatio;
29 } /* end bounding rect */
32 - if (priv->twinview == TV_LEFT_RIGHT)
33 - tabletSize = 2*(priv->bottomX - priv->topX - 2*priv->tvoffsetX);
35 - tabletSize = priv->bottomX - priv->topX;
37 - InitValuatorAxisStruct(pWcm, 0, 0, tabletSize, /* max val */
38 - common->wcmResolX, /* tablet resolution */
39 - 0, common->wcmResolX); /* max_res */
41 - if (priv->twinview == TV_ABOVE_BELOW)
42 - tabletSize = 2*(priv->bottomY - priv->topY - 2*priv->tvoffsetY);
44 - tabletSize = priv->bottomY - priv->topY;
46 - InitValuatorAxisStruct(pWcm, 1, 0, tabletSize, /* max val */
47 - common->wcmResolY, /* tablet resolution */
48 - 0, common->wcmResolY); /* max_res */
49 + InitValuatorAxisStruct(pWcm, 0, priv->topX, priv->bottomX, /* max val */
50 + common->wcmResolX, /* tablet resolution */
51 + 0, common->wcmResolX); /* max_res */
53 + InitValuatorAxisStruct(pWcm, 1, priv->topY, priv->bottomY, /* max val */
54 + common->wcmResolY, /* tablet resolution */
55 + 0, common->wcmResolY); /* max_res */
58 InitValuatorAxisStruct(pWcm, 2, 0,
60 static int xf86WcmSetParam(LocalDevicePtr local, int param, int value)
62 WacomDevicePtr priv = (WacomDevicePtr)local->private;
63 + WacomDevicePtr tmppriv;
65 + int oldRotation, dev;
66 + int tmpTopX, tmpTopY, tmpBottomX, tmpBottomY, oldMaxX, oldMaxY;
70 case XWACOM_PARAM_TOPX:
71 xf86ReplaceIntOption(local->options, "TopX", value);
72 priv->topX = xf86SetIntOption(local->options, "TopX", 0);
73 + InitValuatorAxisStruct(local->dev, 0, priv->topX, priv->bottomX,
74 + priv->common->wcmResolX, /* tablet resolution */
75 + 0, priv->common->wcmResolX); /* max_res */
77 case XWACOM_PARAM_TOPY:
78 xf86ReplaceIntOption(local->options, "TopY", value);
79 priv->topY = xf86SetIntOption(local->options, "TopY", 0);
80 + InitValuatorAxisStruct(local->dev, 1, priv->topY, priv->bottomY, /* max val */
81 + priv->common->wcmResolY, /* tablet resolution */
82 + 0, priv->common->wcmResolY); /* max_res */
84 case XWACOM_PARAM_BOTTOMX:
85 xf86ReplaceIntOption(local->options, "BottomX", value);
86 priv->bottomX = xf86SetIntOption(local->options, "BottomX", 0);
87 + InitValuatorAxisStruct(local->dev, 0, priv->topX, priv->bottomX,
88 + priv->common->wcmResolX, /* tablet resolution */
89 + 0, priv->common->wcmResolX); /* max_res */
91 case XWACOM_PARAM_BOTTOMY:
92 xf86ReplaceIntOption(local->options, "BottomY", value);
93 priv->bottomY = xf86SetIntOption(local->options, "BottomY", 0);
94 + InitValuatorAxisStruct(local->dev, 1, priv->topY, priv->bottomY, /* max val */
95 + priv->common->wcmResolY, /* tablet resolution */
96 + 0, priv->common->wcmResolY); /* max_res */
98 case XWACOM_PARAM_BUTTON1:
99 if ((value < 0) || (value > 19)) return BadValue;
101 "BottomY", priv->common->wcmMaxY);
102 priv->bottomY = xf86SetIntOption(local->options,
103 "BottomY", priv->common->wcmMaxY);
104 + InitValuatorAxisStruct(local->dev, 0, priv->topX, priv->bottomX,
105 + priv->common->wcmResolX, /* tablet resolution */
106 + 0, priv->common->wcmResolX); /* max_res */
107 + InitValuatorAxisStruct(local->dev, 1, priv->topY, priv->bottomY, /* max val */
108 + priv->common->wcmResolY, /* tablet resolution */
109 + 0, priv->common->wcmResolY); /* max_res */
111 case XWACOM_PARAM_GIMP:
112 if ((value != 0) && (value != 1)) return BadValue;
113 @@ -819,6 +830,103 @@
114 xf86ReplaceStrOption(local->options, "TPCButton", "off");
117 + case XWACOM_PARAM_ROTATE:
118 + if ((value < 0) || (value > 3)) return BadValue;
121 + xf86ReplaceStrOption(local->options, "Rotate", "NONE");
124 + xf86ReplaceStrOption(local->options, "Rotate", "CW");
127 + xf86ReplaceStrOption(local->options, "Rotate", "CCW");
130 + xf86ReplaceStrOption(local->options, "Rotate", "HALF");
135 + oldRotation = priv->common->wcmRotate;
136 + oldMaxX = priv->common->wcmMaxX;
137 + oldMaxY = priv->common->wcmMaxY;
138 + priv->common->wcmRotate = value;
139 + if (((oldRotation == ROTATE_NONE || oldRotation == ROTATE_HALF) && (value == ROTATE_CW || value == ROTATE_CCW)) ||
140 + ((oldRotation == ROTATE_CW || oldRotation == ROTATE_CCW) && (value == ROTATE_NONE || value == ROTATE_HALF)))
142 + priv->common->wcmMaxX = oldMaxY;
143 + priv->common->wcmMaxY = oldMaxX;
146 + /* rotate all devices at once! else they get misaligned */
147 + for (dev=0; dev < priv->common->wcmNumDevices; dev++)
149 + tmppriv = (WacomDevicePtr)priv->common->wcmDevices[dev]->private;
150 + /* recover the unrotated xy-rectangles */
151 + switch (oldRotation) {
153 + tmpTopX = oldMaxY - tmppriv->bottomY;
154 + tmpBottomX = oldMaxY - tmppriv->topY;
155 + tmpTopY = tmppriv->topX;
156 + tmpBottomY = tmppriv->bottomX;
159 + tmpTopX = tmppriv->topY;
160 + tmpBottomX = tmppriv->bottomY;
161 + tmpTopY = oldMaxX - tmppriv->bottomX;
162 + tmpBottomY = oldMaxX - tmppriv->topX;
165 + tmpTopX = oldMaxX - tmppriv->bottomX;
166 + tmpBottomX = oldMaxX - tmppriv->topX;
167 + tmpTopY = oldMaxY - tmppriv->bottomY;
168 + tmpBottomY = oldMaxY - tmppriv->topY;
170 + default: /* ROTATE_NONE */
171 + tmpTopX = tmppriv->topX;
172 + tmpBottomX = tmppriv->bottomX;
173 + tmpTopY = tmppriv->topY;
174 + tmpBottomY = tmppriv->bottomY;
177 + /* and rotate them back */
180 + tmppriv->topX = tmpTopY;
181 + tmppriv->bottomX = tmpBottomY;
182 + tmppriv->topY = priv->common->wcmMaxY - tmpBottomX;
183 + tmppriv->bottomY = priv->common->wcmMaxY - tmpTopX;
186 + tmppriv->topX = priv->common->wcmMaxX - tmpBottomY;
187 + tmppriv->bottomX = priv->common->wcmMaxX - tmpTopY;
188 + tmppriv->topY = tmpTopX;
189 + tmppriv->bottomY = tmpBottomX;
192 + tmppriv->topX = priv->common->wcmMaxX - tmpBottomX;
193 + tmppriv->bottomX = priv->common->wcmMaxX - tmpTopX;
194 + tmppriv->topY= priv->common->wcmMaxY - tmpBottomY;
195 + tmppriv->bottomY = priv->common->wcmMaxY - tmpTopY;
197 + default: /* ROTATE_NONE */
198 + tmppriv->topX = tmpTopX;
199 + tmppriv->bottomX = tmpBottomX;
200 + tmppriv->topY = tmpTopY;
201 + tmppriv->bottomY = tmpBottomY;
205 + InitValuatorAxisStruct(priv->common->wcmDevices[dev]->dev,
206 + 0, tmppriv->topX, tmppriv->bottomX, priv->common->wcmResolX, /* tablet resolution */
207 + 0, priv->common->wcmResolX); /* max_res */
209 + InitValuatorAxisStruct(priv->common->wcmDevices[dev]->dev,
210 + 1, tmppriv->topY, tmppriv->bottomY, priv->common->wcmResolY, /* tablet resolution */
211 + 0, priv->common->wcmResolY); /* max_res */
215 DBG(10, ErrorF("xf86WcmSetParam invalid param %d\n",param));
217 diff -Naur linuxwacom-0.7.0/src/xf86Wacom.h linuxwacom-0.7.0-rotate/src/xf86Wacom.h
218 --- linuxwacom-0.7.0/src/xf86Wacom.h 2005-09-19 19:43:14.000000000 -0400
219 +++ linuxwacom-0.7.0-rotate/src/xf86Wacom.h 2005-11-22 17:06:57.000000000 -0500
221 #define ERASER_PROX 4
225 +#define ROTATE_NONE XWACOM_VALUE_ROTATE_NONE
226 +#define ROTATE_CW XWACOM_VALUE_ROTATE_CW
227 +#define ROTATE_CCW XWACOM_VALUE_ROTATE_CCW
228 +#define ROTATE_HALF XWACOM_VALUE_ROTATE_HALF
230 /******************************************************************************
231 * Forward Declarations
232 *****************************************************************************/
235 #define DEVICE_ISDV4 0x000C
237 -#define ROTATE_NONE 0
239 -#define ROTATE_CCW 2
241 #define MAX_CHANNELS 2
242 #define MAX_USB_EVENTS 32
244 diff -Naur linuxwacom-0.7.0/src/xsetwacom.c linuxwacom-0.7.0-rotate/src/xsetwacom.c
245 --- linuxwacom-0.7.0/src/xsetwacom.c 2005-09-19 19:43:14.000000000 -0400
246 +++ linuxwacom-0.7.0-rotate/src/xsetwacom.c 2005-11-22 17:17:24.000000000 -0500
248 "on for Tablet PC. ",
249 XWACOM_PARAM_TPCBUTTON, VALUE_OPTIONAL,
250 RANGE, 0, 1, BOOLEAN_VALUE, 1 },
253 + "Sets the rotation of the tablet. "
254 + "Values = NONE, CW, CCW, HALF (default is NONE).",
255 + XWACOM_PARAM_ROTATE, VALUE_OPTIONAL,
256 + RANGE, XWACOM_VALUE_ROTATE_NONE, XWACOM_VALUE_ROTATE_HALF, SINGLE_VALUE,
257 + XWACOM_VALUE_ROTATE_NONE },
260 "Writes tablet models to /etc/wacom.dat",
263 "Writes configuration options to /etc/X11/wcm.dev_name",
264 XWACOM_PARAM_FILEOPTION, VALUE_OPTIONAL },
271 !strcasecmp(pszValues[i],"false") ||
272 !strcasecmp(pszValues[i],"relative")))
274 + else if (p->nParamID == XWACOM_PARAM_ROTATE)
276 + if (!strcasecmp(pszValues[i],"none"))
277 + nValues[i] = XWACOM_VALUE_ROTATE_NONE;
278 + else if (!strcasecmp(pszValues[i],"cw"))
279 + nValues[i] = XWACOM_VALUE_ROTATE_CW;
280 + else if (!strcasecmp(pszValues[i],"ccw"))
281 + nValues[i] = XWACOM_VALUE_ROTATE_CCW;
282 + else if (!strcasecmp(pszValues[i],"half"))
283 + nValues[i] = XWACOM_VALUE_ROTATE_HALF;
286 + fprintf(stderr,"Set: Value '%s' is "
287 + "invalid.\n",pszValues[i]);
293 fprintf(stderr,"Set: Value '%s' is "
294 diff -Naur linuxwacom-0.7.0/src/Xwacom.h linuxwacom-0.7.0-rotate/src/Xwacom.h
295 --- linuxwacom-0.7.0/src/Xwacom.h 2005-09-19 19:43:14.000000000 -0400
296 +++ linuxwacom-0.7.0-rotate/src/Xwacom.h 2005-11-22 17:06:00.000000000 -0500
298 #define XWACOM_PARAM_GIMP 102
299 #define XWACOM_PARAM_MMT 103
300 #define XWACOM_PARAM_TPCBUTTON 104
301 +#define XWACOM_PARAM_ROTATE 105
303 +#define XWACOM_VALUE_ROTATE_NONE 0
304 +#define XWACOM_VALUE_ROTATE_CW 1
305 +#define XWACOM_VALUE_ROTATE_CCW 2
306 +#define XWACOM_VALUE_ROTATE_HALF 3
308 #endif /* __XF86_XWACOM_H */