Merge lp:~gerard-/wizardpen/unstuck into lp:wizardpen
- unstuck
- Merge into trunk
Proposed by
Gerard Krol
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~gerard-/wizardpen/unstuck |
Merge into: | lp:wizardpen |
Diff against target: |
1218 lines (+457/-463) 2 files modified
src/wizardpen.c (+402/-408) src/wizardpen.h (+55/-55) |
To merge this branch: | bzr merge lp:~gerard-/wizardpen/unstuck |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Owens | Approve | ||
Review via email: mp+21781@code.launchpad.net |
Commit message
Description of the change
Includes compatibility for the new API (xorg-x11-
Works fine for me with a Trust TB6300 (UC-LOGIC Tablet WP8060U), debian testing, AMD64
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/wizardpen.c' |
2 | --- src/wizardpen.c 2009-07-17 19:56:32 +0000 |
3 | +++ src/wizardpen.c 2010-03-20 19:15:26 +0000 |
4 | @@ -29,7 +29,7 @@ |
5 | |
6 | #define _WIZARDPEN_C_ |
7 | /***************************************************************************** |
8 | - * Standard Headers |
9 | + * Standard Headers |
10 | ****************************************************************************/ |
11 | |
12 | #ifdef LINUX_INPUT |
13 | @@ -71,16 +71,16 @@ |
14 | #endif |
15 | |
16 | /***************************************************************************** |
17 | - * Local Headers |
18 | + * Local Headers |
19 | ****************************************************************************/ |
20 | #include "wizardpen.h" |
21 | |
22 | /***************************************************************************** |
23 | - * Variables without includable headers |
24 | + * Variables without includable headers |
25 | ****************************************************************************/ |
26 | |
27 | /***************************************************************************** |
28 | - * Local Variables |
29 | + * Local Variables |
30 | ****************************************************************************/ |
31 | |
32 | float rz; |
33 | @@ -103,79 +103,79 @@ |
34 | |
35 | _X_EXPORT InputDriverRec WIZARDPEN = |
36 | { |
37 | - 6, |
38 | - "wizardpen", |
39 | - NULL, |
40 | - WizardPenPreInit, |
41 | - NULL, |
42 | - NULL, |
43 | - 0 |
44 | + 6, |
45 | + "wizardpen", |
46 | + NULL, |
47 | + WizardPenPreInit, |
48 | + NULL, |
49 | + NULL, |
50 | + 0 |
51 | }; |
52 | |
53 | #ifdef XFree86LOADER |
54 | static XF86ModuleVersionInfo VersionRec = |
55 | { |
56 | - "wizardpen", |
57 | - MODULEVENDORSTRING, |
58 | - MODINFOSTRING1, |
59 | - MODINFOSTRING2, |
60 | - XORG_VERSION_CURRENT, |
61 | - PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL, |
62 | - ABI_CLASS_XINPUT, |
63 | - ABI_XINPUT_VERSION, |
64 | - MOD_CLASS_XINPUT, |
65 | - {0, 0, 0, 0} |
66 | + "wizardpen", |
67 | + MODULEVENDORSTRING, |
68 | + MODINFOSTRING1, |
69 | + MODINFOSTRING2, |
70 | + XORG_VERSION_CURRENT, |
71 | + PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL, |
72 | + ABI_CLASS_XINPUT, |
73 | + ABI_XINPUT_VERSION, |
74 | + MOD_CLASS_XINPUT, |
75 | + {0, 0, 0, 0} |
76 | }; |
77 | |
78 | |
79 | _X_EXPORT XF86ModuleData wizardpenModuleData = { |
80 | - &VersionRec, |
81 | - SetupProc, |
82 | - TearDownProc |
83 | + &VersionRec, |
84 | + SetupProc, |
85 | + TearDownProc |
86 | }; |
87 | |
88 | /***************************************************************************** |
89 | - * Function Definitions |
90 | + * Function Definitions |
91 | ****************************************************************************/ |
92 | |
93 | static pointer |
94 | -SetupProc( pointer module, |
95 | - pointer options, |
96 | - int *errmaj, |
97 | - int *errmin ) |
98 | +SetupProc( pointer module, |
99 | + pointer options, |
100 | + int *errmaj, |
101 | + int *errmin ) |
102 | { |
103 | - xf86AddInputDriver(&WIZARDPEN, module, 0); |
104 | - return module; |
105 | + xf86AddInputDriver(&WIZARDPEN, module, 0); |
106 | + return module; |
107 | } |
108 | |
109 | static void |
110 | TearDownProc( pointer p ) |
111 | { |
112 | #if 0 |
113 | - LocalDevicePtr local = (LocalDevicePtr) p; |
114 | - AceCadPrivatePtr priv = (AceCadPrivatePtr) local->private; |
115 | - |
116 | - DeviceOff (local->dev); |
117 | - |
118 | - xf86CloseSerial (local->fd); |
119 | - XisbFree (priv->buffer); |
120 | - xfree (priv); |
121 | - xfree (local->name); |
122 | - xfree (local); |
123 | + LocalDevicePtr local = (LocalDevicePtr) p; |
124 | + AceCadPrivatePtr priv = (AceCadPrivatePtr) local->private; |
125 | + |
126 | + DeviceOff (local->dev); |
127 | + |
128 | + xf86CloseSerial (local->fd); |
129 | + XisbFree (priv->buffer); |
130 | + xfree (priv); |
131 | + xfree (local->name); |
132 | + xfree (local); |
133 | #endif |
134 | } |
135 | #endif |
136 | |
137 | static const char *default_options[] = |
138 | { |
139 | - "BaudRate", "9600", |
140 | - "StopBits", "1", |
141 | - "DataBits", "8", |
142 | - "Parity", "Odd", |
143 | - "Vmin", "1", |
144 | - "Vtime", "10", |
145 | - "FlowControl", "Xoff", |
146 | - NULL |
147 | + "BaudRate", "9600", |
148 | + "StopBits", "1", |
149 | + "DataBits", "8", |
150 | + "Parity", "Odd", |
151 | + "Vmin", "1", |
152 | + "Vtime", "10", |
153 | + "FlowControl", "Xoff", |
154 | + NULL |
155 | }; |
156 | |
157 | #ifdef LINUX_INPUT |
158 | @@ -212,7 +212,7 @@ |
159 | cmp_at = 256; |
160 | ioctl(fd, EVIOCGNAME(sizeof(name)), name); |
161 | name[cmp_at] = '\0'; |
162 | - if (xf86NameCmp(name, wizardpen_name) == 0) |
163 | + if (xf86NameCmp(name, wizardpen_name) == 0) |
164 | return TRUE; |
165 | return FALSE; |
166 | } |
167 | @@ -253,7 +253,7 @@ |
168 | xf86MsgVerb(X_INFO, verb, "%s: probing event devices for WizardPen tablets\n", local->name); |
169 | for (i = 0; ; i++) { |
170 | int fd = -1; |
171 | - Bool is_wizardpen; |
172 | + Bool is_wizardpen; |
173 | |
174 | np = SET_EVENT_NUM(fname, i); |
175 | if (np < 0 || np >= EV_DEV_NAME_MAXLEN) { |
176 | @@ -334,98 +334,98 @@ |
177 | /* deprecated box settings, Z axis */ |
178 | s = xf86FindOptionValue(local->options, "ClickPressureLevel"); |
179 | if (s && strlen(s) > 0) { |
180 | - xf86Msg(X_WARNING, "%s: Option \"ClickPressureLevel\" " |
181 | - "is DEPRECATED, please use \"TopZ\"\n", local->name); |
182 | - priv->topZ = atoi(s); |
183 | - xf86Msg(X_CONFIG, "%s: TopZ = %d\n", local->name, priv->topZ); |
184 | + xf86Msg(X_WARNING, "%s: Option \"ClickPressureLevel\" " |
185 | + "is DEPRECATED, please use \"TopZ\"\n", local->name); |
186 | + priv->topZ = atoi(s); |
187 | + xf86Msg(X_CONFIG, "%s: TopZ = %d\n", local->name, priv->topZ); |
188 | } |
189 | /* end of deprecated box settings, Z axis */ |
190 | |
191 | /* box settings */ |
192 | s = xf86FindOptionValue(local->options, "TopX"); |
193 | if (s && strlen(s) > 0) { |
194 | - priv->topX = atoi(s); |
195 | - xf86Msg(X_CONFIG, "%s: TopX = %d\n", local->name, priv->topX); |
196 | + priv->topX = atoi(s); |
197 | + xf86Msg(X_CONFIG, "%s: TopX = %d\n", local->name, priv->topX); |
198 | } |
199 | |
200 | s = xf86FindOptionValue(local->options, "TopY"); |
201 | if (s && strlen(s) > 0) { |
202 | - priv->topY = atoi(s); |
203 | - xf86Msg(X_CONFIG, "%s: TopY = %d\n", local->name, priv->topY); |
204 | + priv->topY = atoi(s); |
205 | + xf86Msg(X_CONFIG, "%s: TopY = %d\n", local->name, priv->topY); |
206 | } |
207 | |
208 | s = xf86FindOptionValue(local->options, "TopZ"); |
209 | if (s && strlen(s) > 0) { |
210 | - priv->topZ = atoi(s); |
211 | - xf86Msg(X_CONFIG, "%s: TopZ = %d\n", local->name, priv->topZ); |
212 | + priv->topZ = atoi(s); |
213 | + xf86Msg(X_CONFIG, "%s: TopZ = %d\n", local->name, priv->topZ); |
214 | } |
215 | |
216 | s = xf86FindOptionValue(local->options, "BottomX"); |
217 | if (s && strlen(s) > 0) { |
218 | - priv->bottomX = atoi(s); |
219 | - xf86Msg(X_CONFIG, "%s: BottomX = %d\n", local->name, priv->bottomX); |
220 | + priv->bottomX = atoi(s); |
221 | + xf86Msg(X_CONFIG, "%s: BottomX = %d\n", local->name, priv->bottomX); |
222 | } |
223 | |
224 | s = xf86FindOptionValue(local->options, "BottomY"); |
225 | if (s && strlen(s) > 0) { |
226 | - priv->bottomY = atoi(s); |
227 | - xf86Msg(X_CONFIG, "%s: BottomY = %d\n", local->name, priv->bottomY); |
228 | + priv->bottomY = atoi(s); |
229 | + xf86Msg(X_CONFIG, "%s: BottomY = %d\n", local->name, priv->bottomY); |
230 | } |
231 | |
232 | s = xf86FindOptionValue(local->options, "BottomZ"); |
233 | if (s && strlen(s) > 0) { |
234 | - priv->bottomZ = atoi(s); |
235 | - xf86Msg(X_CONFIG, "%s: BottomZ = %d\n", local->name, priv->bottomZ); |
236 | + priv->bottomZ = atoi(s); |
237 | + xf86Msg(X_CONFIG, "%s: BottomZ = %d\n", local->name, priv->bottomZ); |
238 | } |
239 | |
240 | s = xf86FindOptionValue(local->options, "ScreenX"); |
241 | if (s && strlen(s) > 0) { |
242 | - screenmaxx = atoi(s); |
243 | - xf86Msg(X_CONFIG, "%s: ScreenX = %d\n", local->name, screenmaxx); |
244 | + screenmaxx = atoi(s); |
245 | + xf86Msg(X_CONFIG, "%s: ScreenX = %d\n", local->name, screenmaxx); |
246 | }else |
247 | - screenmaxx = screenInfo.screens[0]->width; |
248 | - |
249 | + screenmaxx = screenInfo.screens[0]->width; |
250 | + |
251 | s = xf86FindOptionValue(local->options, "ScreenY"); |
252 | if (s && strlen(s) > 0) { |
253 | - screenmaxy = atoi(s); |
254 | - xf86Msg(X_CONFIG, "%s: ScreenY = %d\n", local->name, screenmaxy); |
255 | + screenmaxy = atoi(s); |
256 | + xf86Msg(X_CONFIG, "%s: ScreenY = %d\n", local->name, screenmaxy); |
257 | }else |
258 | - screenmaxy = screenInfo.screens[0]->height; |
259 | + screenmaxy = screenInfo.screens[0]->height; |
260 | |
261 | s = xf86FindOptionValue(local->options, "debugyn"); |
262 | if (s && strlen(s) > 0) { |
263 | - debugyn = atoi(s); |
264 | - xf86Msg(X_CONFIG, "%s: debugyn = %d\n", local->name, debugyn); |
265 | + debugyn = atoi(s); |
266 | + xf86Msg(X_CONFIG, "%s: debugyn = %d\n", local->name, debugyn); |
267 | } |
268 | |
269 | s = xf86FindOptionValue(local->options, "MouseSpeed"); |
270 | if (s && strlen(s) > 0) { |
271 | - mousespeed = atoi(s); |
272 | - xf86Msg(X_CONFIG, "%s: MouseSpeed = %d\n", local->name, mousespeed); |
273 | + mousespeed = atoi(s); |
274 | + xf86Msg(X_CONFIG, "%s: MouseSpeed = %d\n", local->name, mousespeed); |
275 | } |
276 | - |
277 | + |
278 | s = xf86FindOptionValue(local->options, "MouseAccel"); |
279 | if (s && strlen(s) > 0) { |
280 | - mouseaccel = atoi(s); |
281 | - xf86Msg(X_CONFIG, "%s: MouseAccel = %d\n", local->name, mouseaccel); |
282 | + mouseaccel = atoi(s); |
283 | + xf86Msg(X_CONFIG, "%s: MouseAccel = %d\n", local->name, mouseaccel); |
284 | } |
285 | |
286 | s = xf86FindOptionValue(local->options, "Rotate90"); |
287 | if (s && strlen(s) > 0) { |
288 | - int rotate; |
289 | - rotate90 = atoi(s); |
290 | - xf86Msg(X_CONFIG, "%s: Rotate90 = %d\n", local->name, rotate90); |
291 | - if(rotate90){ |
292 | - int temp; |
293 | - temp = priv->bottomY; |
294 | - priv->bottomY = priv->bottomX; |
295 | - priv->bottomX = temp; |
296 | - temp = priv->topY; |
297 | - priv->topY = priv->topX; |
298 | - priv->topX = temp; |
299 | - } |
300 | + int rotate; |
301 | + rotate90 = atoi(s); |
302 | + xf86Msg(X_CONFIG, "%s: Rotate90 = %d\n", local->name, rotate90); |
303 | + if(rotate90){ |
304 | + int temp; |
305 | + temp = priv->bottomY; |
306 | + priv->bottomY = priv->bottomX; |
307 | + priv->bottomX = temp; |
308 | + temp = priv->topY; |
309 | + priv->topY = priv->topX; |
310 | + priv->topX = temp; |
311 | + } |
312 | } |
313 | - |
314 | + |
315 | /* end of box settings */ |
316 | |
317 | // increment setting |
318 | @@ -631,14 +631,25 @@ |
319 | LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate; |
320 | WizardPenPrivatePtr priv = (WizardPenPrivatePtr) (local->private); |
321 | priv->wizardpenOldX = 0; |
322 | - priv->wizardpenOldY = 0; |
323 | - priv->wizardpenOldZ = 0; |
324 | - unsigned char map[] = |
325 | + priv->wizardpenOldY = 0; |
326 | + priv->wizardpenOldZ = 0; |
327 | + unsigned char map[] = |
328 | {0, 1, 2, 3, 4, 5}; |
329 | xf86MsgVerb(X_INFO, 4, "%s Init\n", local->name); |
330 | |
331 | +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 |
332 | + Atom label=0; |
333 | + Atom atoms[MAX_VALUATORS] = { 0 }; |
334 | +#endif |
335 | + |
336 | /* 3 buttons changed to SIX */ |
337 | - if (InitButtonClassDeviceStruct (dev, 6, map) == FALSE) |
338 | + if (InitButtonClassDeviceStruct( |
339 | + dev, |
340 | + 6, |
341 | +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 |
342 | + atoms, |
343 | +#endif |
344 | + map) == FALSE) |
345 | { |
346 | xf86Msg(X_ERROR, "%s: unable to allocate ButtonClassDeviceStruct\n", local->name); |
347 | return !Success; |
348 | @@ -657,52 +668,58 @@ |
349 | |
350 | |
351 | /* 3 axes */ |
352 | - if (InitValuatorClassDeviceStruct (dev, 3, |
353 | + if (InitValuatorClassDeviceStruct(dev, 3, |
354 | +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 |
355 | + atoms, |
356 | +#endif |
357 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 |
358 | - xf86GetMotionEvents, |
359 | + xf86GetMotionEvents, |
360 | #endif |
361 | - local->history_size, |
362 | - ((priv->flags & ABSOLUTE_FLAG)? Absolute: Relative)|OutOfProximity) |
363 | - == FALSE) |
364 | + local->history_size, |
365 | + ((priv->flags & ABSOLUTE_FLAG)? Absolute: Relative)|OutOfProximity) == FALSE) |
366 | { |
367 | xf86Msg(X_ERROR, "%s: unable to allocate ValuatorClassDeviceStruct\n", local->name); |
368 | return !Success; |
369 | } |
370 | else |
371 | { |
372 | - |
373 | InitValuatorAxisStruct(dev, |
374 | 0, |
375 | - 0, /* min val */ |
376 | - /*screenInfo.screens[0]->width,*/ /* max val */ |
377 | - screenmaxx, /* max val */ |
378 | - 1000, /* resolution */ |
379 | - 0, /* min_res */ |
380 | - 1000); /* max_res */ |
381 | +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 |
382 | + label, |
383 | +#endif |
384 | + 0, /* min val */ |
385 | + screenmaxx, /* max val */ |
386 | + 1000, /* resolution */ |
387 | + 0, /* min_res */ |
388 | + 1000); /* max_res */ |
389 | InitValuatorAxisStruct(dev, |
390 | 1, |
391 | - 0, /* min val */ |
392 | - /*screenInfo.screens[0]->height,*/ /* max val */ |
393 | - screenmaxy, /* max val */ |
394 | - 1000, /* resolution */ |
395 | - 0, /* min_res */ |
396 | - 1000); /* max_res */ |
397 | +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 |
398 | + label, |
399 | +#endif |
400 | + 0, /* min val */ |
401 | + screenmaxy, /* max val */ |
402 | + 1000, /* resolution */ |
403 | + 0, /* min_res */ |
404 | + 1000); /* max_res */ |
405 | InitValuatorAxisStruct(dev, |
406 | 2, |
407 | - 0, /* min val */ |
408 | - /*priv->bottomZ,*/ /* max val */ |
409 | - 1023, |
410 | - 1000, /* resolution */ |
411 | - 0, /* min_res */ |
412 | - 1000); /* max_res */ |
413 | - |
414 | - if(rotate90){ |
415 | - int tempval; |
416 | - tempval = screenmaxx; |
417 | - screenmaxx = screenmaxy; |
418 | - screenmaxy = tempval; |
419 | - } |
420 | +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 |
421 | + label, |
422 | +#endif |
423 | + 0, /* min val */ |
424 | + 1023, /* max val */ |
425 | + 1000, /* resolution */ |
426 | + 0, /* min_res */ |
427 | + 1000); /* max_res */ |
428 | |
429 | + if (rotate90) { |
430 | + int tempval; |
431 | + tempval = screenmaxx; |
432 | + screenmaxx = screenmaxy; |
433 | + screenmaxy = tempval; |
434 | + } |
435 | } |
436 | |
437 | if (InitProximityClassDeviceStruct (dev) == FALSE) |
438 | @@ -738,7 +755,7 @@ |
439 | } |
440 | |
441 | #ifdef LINUX_INPUT |
442 | -#define set_bit(byte,nb,bit) (bit ? byte | (1<<nb) : byte & (~(1<<nb))) |
443 | +#define set_bit(byte,nb,bit) (bit ? byte | (1<<nb) : byte & (~(1<<nb))) |
444 | static void |
445 | USBReadInput (LocalDevicePtr local) |
446 | { |
447 | @@ -778,312 +795,289 @@ |
448 | return; |
449 | } else { |
450 | if (!avail) { |
451 | - // If the device wasn't available last time we checked |
452 | + // If the device wasn't available last time we checked |
453 | xf86Msg(X_INFO, "%s: device %s is available again\n", local->name, xf86FindOptionValue(local->options, "Device")); |
454 | priv->flags |= AVAIL_FLAG; |
455 | } |
456 | } |
457 | |
458 | for (event = (struct input_event *)eventbuf; |
459 | - event < (struct input_event *)(eventbuf+len); event++) |
460 | - { |
461 | - switch (event->type) { |
462 | - case EV_SYN:// 2.6.x |
463 | + event < (struct input_event *)(eventbuf+len); |
464 | + event++) |
465 | + { |
466 | + switch (event->type) { |
467 | + case EV_SYN:// 2.6.x |
468 | if (event->code != SYN_REPORT && event->code != 0) |
469 | xf86Msg(X_ERROR, "%s: unknown EV_SYN code %d\n", local->name, event->code); |
470 | break; |
471 | - case EV_REL: |
472 | - if(debugyn) |
473 | - xf86Msg(X_ERROR, "EV_REL! %s: event type/code/value %d/%d/%d\n", local->name, event->type, event->code, event->value); |
474 | - int xaccel, yaccel; |
475 | - |
476 | - switch(event->code){ |
477 | - case REL_X: |
478 | - xaccel = 1; |
479 | - if(mouseaccel){ |
480 | - if(abs(event->value) > 2){ |
481 | - xaccel = 2; |
482 | - }else if(abs(event->value) > 4){ |
483 | - xaccel = 3; |
484 | - }else if(abs(event->value) > 6){ |
485 | - xaccel = 4; |
486 | - } |
487 | - } |
488 | - x = x + (xaccel * mousespeed * event->value); |
489 | - if(x < priv->topX){ |
490 | - x = 1 + priv->topX; |
491 | - } |
492 | - if( x > priv->bottomX){ |
493 | - x = priv->bottomX; |
494 | - } |
495 | - break; |
496 | - case REL_Y: |
497 | - yaccel = 1; |
498 | - if(mouseaccel){ |
499 | - if(abs(event->value) > 2){ |
500 | - yaccel = 2; |
501 | - }else if(abs(event->value) > 4){ |
502 | - yaccel = 3; |
503 | - }else if(abs(event->value) > 6){ |
504 | - yaccel = 4; |
505 | - } |
506 | - } |
507 | - y = y + (yaccel * mousespeed * event->value); |
508 | - if(y < priv->topY){ |
509 | - y = 1 + priv->topY; |
510 | - } |
511 | - if( y > priv->bottomY){ |
512 | - y = priv->bottomY; |
513 | - } |
514 | - break; |
515 | - case REL_WHEEL: |
516 | - if (event->value < 0){ |
517 | - buttons = set_bit(buttons,4,1); |
518 | - delta = buttons ^ priv->wizardpenOldButtons; |
519 | - while (delta) { |
520 | - id = ffs(delta); |
521 | - delta &= ~(1 << (id-1)); |
522 | - if(rotate90) |
523 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_y, screenmaxx - report_x,report_z); |
524 | - else |
525 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); |
526 | - } |
527 | - priv->wizardpenOldButtons = buttons; |
528 | - buttons = set_bit(buttons,4,0); |
529 | - delta = buttons ^ priv->wizardpenOldButtons; |
530 | - while (delta) |
531 | - { |
532 | - id = ffs(delta); |
533 | - delta &= ~(1 << (id-1)); |
534 | - if(rotate90) |
535 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_y, screenmaxx - report_x,report_z); |
536 | - else |
537 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); |
538 | - } |
539 | - } |
540 | - if (event->value > 0){ |
541 | - buttons = set_bit(buttons,3,1); |
542 | - delta = buttons ^ priv->wizardpenOldButtons; |
543 | - while (delta) { |
544 | - id = ffs(delta); |
545 | - delta &= ~(1 << (id-1)); |
546 | - if(rotate90) |
547 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_y, screenmaxx - report_x,report_z); |
548 | - else |
549 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); |
550 | - } |
551 | - priv->wizardpenOldButtons = buttons; |
552 | - buttons = set_bit(buttons,3,0); |
553 | - delta = buttons ^ priv->wizardpenOldButtons; |
554 | - while (delta) |
555 | - { |
556 | - id = ffs(delta); |
557 | - delta &= ~(1 << (id-1)); |
558 | - if(rotate90) |
559 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_y, screenmaxx - report_x,report_z); |
560 | - else |
561 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); |
562 | - } |
563 | - } |
564 | - break; |
565 | - } |
566 | - break; |
567 | + case EV_REL: |
568 | + if(debugyn) |
569 | + xf86Msg(X_ERROR, "EV_REL! %s: event type/code/value %d/%d/%d\n", local->name, event->type, event->code, event->value); |
570 | + int xaccel, yaccel; |
571 | + switch (event->code) { |
572 | + case REL_X: |
573 | + xaccel = 1; |
574 | + if(mouseaccel) { |
575 | + if(abs(event->value) > 2) { |
576 | + xaccel = 2; |
577 | + } else if(abs(event->value) > 4) { |
578 | + xaccel = 3; |
579 | + } else if(abs(event->value) > 6) { |
580 | + xaccel = 4; |
581 | + } |
582 | + } |
583 | + x = x + (xaccel * mousespeed * event->value); |
584 | + if (x < priv->topX) { |
585 | + x = 1 + priv->topX; |
586 | + } |
587 | + if (x > priv->bottomX) { |
588 | + x = priv->bottomX; |
589 | + } |
590 | + break; |
591 | + case REL_Y: |
592 | + yaccel = 1; |
593 | + if(mouseaccel){ |
594 | + if (abs(event->value) > 2) { |
595 | + yaccel = 2; |
596 | + } else if(abs(event->value) > 4) { |
597 | + yaccel = 3; |
598 | + } else if(abs(event->value) > 6) { |
599 | + yaccel = 4; |
600 | + } |
601 | + } |
602 | + y = y + (yaccel * mousespeed * event->value); |
603 | + if (y < priv->topY) { |
604 | + y = 1 + priv->topY; |
605 | + } |
606 | + if (y > priv->bottomY) { |
607 | + y = priv->bottomY; |
608 | + } |
609 | + break; |
610 | + case REL_WHEEL: |
611 | + if (event->value < 0) { |
612 | + buttons = set_bit(buttons,4,1); |
613 | + delta = buttons ^ priv->wizardpenOldButtons; |
614 | + while (delta) { |
615 | + id = ffs(delta); |
616 | + delta &= ~(1 << (id-1)); |
617 | + if(rotate90) |
618 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_y, screenmaxx - report_x,report_z); |
619 | + else |
620 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); |
621 | + } |
622 | + priv->wizardpenOldButtons = buttons; |
623 | + buttons = set_bit(buttons,4,0); |
624 | + delta = buttons ^ priv->wizardpenOldButtons; |
625 | + while (delta) |
626 | + { |
627 | + id = ffs(delta); |
628 | + delta &= ~(1 << (id-1)); |
629 | + if(rotate90) |
630 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_y, screenmaxx - report_x,report_z); |
631 | + else |
632 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); |
633 | + } |
634 | + } |
635 | + if (event->value > 0) { |
636 | + buttons = set_bit(buttons,3,1); |
637 | + delta = buttons ^ priv->wizardpenOldButtons; |
638 | + while (delta) { |
639 | + id = ffs(delta); |
640 | + delta &= ~(1 << (id-1)); |
641 | + if(rotate90) |
642 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_y, screenmaxx - report_x,report_z); |
643 | + else |
644 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); |
645 | + } |
646 | + priv->wizardpenOldButtons = buttons; |
647 | + buttons = set_bit(buttons,3,0); |
648 | + delta = buttons ^ priv->wizardpenOldButtons; |
649 | + while (delta) |
650 | + { |
651 | + id = ffs(delta); |
652 | + delta &= ~(1 << (id-1)); |
653 | + if(rotate90) |
654 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_y, screenmaxx - report_x,report_z); |
655 | + else |
656 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); |
657 | + } |
658 | + } |
659 | + break; |
660 | + } |
661 | + break; |
662 | case EV_ABS: |
663 | switch (event->code) { |
664 | case ABS_X: |
665 | - x = event->value; |
666 | - if(debugyn) |
667 | - xf86Msg(X_CONFIG, "ABS_X x is %d\n", x); |
668 | - break; |
669 | - case ABS_Z: |
670 | - x = event->value; |
671 | - if(debugyn) |
672 | - xf86Msg(X_CONFIG, "ABS_Z x is %d\n", x); |
673 | - break; |
674 | - case ABS_RX: |
675 | + x = event->value; |
676 | + if(debugyn) |
677 | + xf86Msg(X_CONFIG, "ABS_X x is %d\n", x); |
678 | + break; |
679 | + case ABS_Z: |
680 | + x = event->value; |
681 | + if(debugyn) |
682 | + xf86Msg(X_CONFIG, "ABS_Z x is %d\n", x); |
683 | + break; |
684 | + case ABS_RX: |
685 | y = event->value; |
686 | - if(debugyn) |
687 | - xf86Msg(X_CONFIG, "ABS_RX y is %d\n", y); |
688 | - break; |
689 | + if(debugyn) |
690 | + xf86Msg(X_CONFIG, "ABS_RX y is %d\n", y); |
691 | + break; |
692 | case ABS_Y: |
693 | y = event->value; |
694 | - if(debugyn) |
695 | - xf86Msg(X_CONFIG, "ABS_Y y is %d\n", y); |
696 | - break; |
697 | + if(debugyn) |
698 | + xf86Msg(X_CONFIG, "ABS_Y y is %d\n", y); |
699 | + break; |
700 | |
701 | case ABS_PRESSURE: |
702 | - /* mpa send button events if pressure |
703 | - crosses topZ threshold */ |
704 | - oldz = z; |
705 | - z = event->value; |
706 | - if ( z <= priv->topZ && oldz > priv->topZ){ |
707 | - buttons = set_bit(buttons,0,0); |
708 | - if(debugyn) |
709 | - xf86Msg(X_CONFIG, "setting PEN UP event\n"); |
710 | - } |
711 | - if ( oldz <= priv->topZ && z > priv->topZ ){ |
712 | - buttons = set_bit(buttons,0,1); |
713 | - if(debugyn) |
714 | - xf86Msg(X_CONFIG, "setting PEN DOWN event\n"); |
715 | - } |
716 | - if(debugyn) |
717 | - xf86Msg(X_CONFIG, "ABS_PRESSURE z is %d\n", z); |
718 | - break; |
719 | + /* mpa send button events if pressure |
720 | + crosses topZ threshold */ |
721 | + oldz = z; |
722 | + z = event->value; |
723 | + if (z <= priv->topZ && oldz > priv->topZ) { |
724 | + buttons = set_bit(buttons,0,0); |
725 | + if(debugyn) |
726 | + xf86Msg(X_CONFIG, "setting PEN UP event\n"); |
727 | + } |
728 | + if ( oldz <= priv->topZ && z > priv->topZ ) { |
729 | + buttons = set_bit(buttons,0,1); |
730 | + if(debugyn) |
731 | + xf86Msg(X_CONFIG, "setting PEN DOWN event\n"); |
732 | + } |
733 | + if(debugyn) |
734 | + xf86Msg(X_CONFIG, "ABS_PRESSURE z is %d\n", z); |
735 | + break; |
736 | |
737 | case ABS_MISC: |
738 | break; |
739 | |
740 | } |
741 | - break; // EV_ABS |
742 | + break; // EV_ABS |
743 | |
744 | case EV_KEY: |
745 | switch (event->code) { |
746 | case BTN_TOOL_PEN: |
747 | prox = event->value; |
748 | - if(debugyn) |
749 | - xf86Msg(X_CONFIG, "BTN_TOOL_PEN prox is %d\n", prox); |
750 | + if(debugyn) |
751 | + xf86Msg(X_CONFIG, "BTN_TOOL_PEN prox is %d\n", prox); |
752 | break; |
753 | |
754 | case BTN_LEFT: |
755 | - buttons = set_bit(buttons,0,event->value); |
756 | - if(debugyn) |
757 | - xf86Msg(X_CONFIG, "NEW BTN_LEFT event is %d\n", event->value); |
758 | - case BTN_SIDE: |
759 | + buttons = set_bit(buttons,0,event->value); |
760 | + if(debugyn) |
761 | + xf86Msg(X_CONFIG, "NEW BTN_LEFT event is %d\n", event->value); |
762 | + // NO BREAK |
763 | + case BTN_SIDE: |
764 | /* mpa stop sending original pen up/down button |
765 | - events in favor of button code above */ |
766 | - /* buttons = set_bit(buttons,0,event->value);*/ |
767 | - if(debugyn) |
768 | - xf86Msg(X_CONFIG, "ignored BTN_SIDE event is %d\n", event->value); |
769 | + events in favor of button code above */ |
770 | + /* buttons = set_bit(buttons,0,event->value);*/ |
771 | + if(debugyn) |
772 | + xf86Msg(X_CONFIG, "ignored BTN_SIDE event is %d\n", event->value); |
773 | break; |
774 | |
775 | - case BTN_EXTRA: |
776 | - if(debugyn) |
777 | - xf86Msg(X_CONFIG, "NEW BTN_EXTRA event is %d\n", event->value); |
778 | - case BTN_MIDDLE: |
779 | + case BTN_EXTRA: |
780 | + if(debugyn) |
781 | + xf86Msg(X_CONFIG, "NEW BTN_EXTRA event is %d\n", event->value); |
782 | + // NO BREAK |
783 | + case BTN_MIDDLE: |
784 | buttons = set_bit(buttons,1,event->value); |
785 | - if(debugyn) |
786 | - xf86Msg(X_CONFIG, "BTN_MIDDLE event is %d\n", event->value); |
787 | + if(debugyn) |
788 | + xf86Msg(X_CONFIG, "BTN_MIDDLE event is %d\n", event->value); |
789 | break; |
790 | |
791 | - case BTN_FORWARD: |
792 | - if(debugyn) |
793 | - xf86Msg(X_CONFIG, "BTN_FORWARD event is %d\n", event->value); |
794 | + case BTN_FORWARD: |
795 | + if(debugyn) |
796 | + xf86Msg(X_CONFIG, "BTN_FORWARD event is %d\n", event->value); |
797 | + // NO BREAK |
798 | case BTN_RIGHT: |
799 | buttons = set_bit(buttons,2,event->value); |
800 | - if(debugyn) |
801 | - xf86Msg(X_CONFIG, "BTN_RIGHT event is %d\n", event->value); |
802 | + if(debugyn) |
803 | + xf86Msg(X_CONFIG, "BTN_RIGHT event is %d\n", event->value); |
804 | break; |
805 | } |
806 | - break; // EV_KEY |
807 | - case EV_MSC: |
808 | - break; |
809 | + break; // EV_KEY |
810 | + case EV_MSC: |
811 | + break; |
812 | default: |
813 | xf86Msg(X_ERROR, "%s: unknown event type/code/value %d/%d/%d\n", local->name, event->type, event->code, event->value); |
814 | } /* switch event->type */ |
815 | |
816 | /* mpa If pressure is below threshold, set pressure and reported |
817 | - pressure to 0 */ |
818 | - if (z <= priv->topZ){ |
819 | - report_z = 0; |
820 | - /*z = 0;*/ |
821 | - }else if(z >= priv->bottomZ){ |
822 | - /*z = priv->bottomZ;*/ |
823 | - /*report_z = priv->bottomZ - priv->topZ;*/ |
824 | - report_z = 1023; |
825 | - }else{ /* mpa Otherwise scale down by min pressure val */ |
826 | - report_z = z - priv->topZ; |
827 | - rz = report_z; |
828 | - report_z = 1023.0 * (rz / (priv->bottomZ - priv->topZ)); |
829 | - } |
830 | - /* mpa now scale back up so we again report a range of 0 to 1023 */ |
831 | - /*merged with above if/then/else |
832 | - if(report_z >= (priv->bottomZ - priv->topZ)){ |
833 | - report_z = 1023; |
834 | - }else if (report_z){ |
835 | - rz = report_z; |
836 | - report_z = 1023.0 * (rz / (priv->bottomZ - priv->topZ)); |
837 | - } |
838 | - */ |
839 | - |
840 | + pressure to 0 */ |
841 | + if (z <= priv->topZ) { |
842 | + report_z = 0; |
843 | + } else if(z >= priv->bottomZ) { |
844 | + report_z = 1023; |
845 | + } else { /* mpa Otherwise scale down by min pressure val */ |
846 | + report_z = z - priv->topZ; |
847 | + rz = report_z; |
848 | + report_z = 1023.0 * (rz / (priv->bottomZ - priv->topZ)); |
849 | + } |
850 | + |
851 | + if (x>priv->topX && x<priv->bottomX) |
852 | + report_x = (x-priv->topX) * screenmaxx / (priv->bottomX-priv->topX); |
853 | + else{ |
854 | + if(x<priv->topX) |
855 | + report_x = 0; |
856 | + else |
857 | + report_x = screenmaxx; |
858 | + } |
859 | + if (y>priv->topY && y<priv->bottomY) |
860 | + report_y = (y-priv->topY) * screenmaxy / (priv->bottomY-priv->topY); |
861 | + else { |
862 | + if(y<priv->topY) |
863 | + report_y = 0; |
864 | + else |
865 | + report_y = screenmaxy; |
866 | + } |
867 | + |
868 | + if (rotate90) { |
869 | + int tempval; |
870 | + if (report_y < 0) |
871 | + report_y = 0; |
872 | + if (report_x < 0) |
873 | + report_x = 0; |
874 | + tempval = report_x; |
875 | + report_x = (screenmaxy - report_y); |
876 | + if (report_x > 1278) |
877 | + report_x = 1278; |
878 | + report_y = tempval; |
879 | + } |
880 | + |
881 | + // We ALWAYS send button events right after we notice them |
882 | + // The pen might get stuck in pressed down state otherwise |
883 | + if (priv->wizardpenOldButtons != buttons) |
884 | + { |
885 | + int delta = buttons ^ priv->wizardpenOldButtons; |
886 | + while (delta) |
887 | + { |
888 | + int id = ffs(delta); |
889 | + delta &= ~(1 << (id-1)); |
890 | + xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y, report_z); |
891 | + } |
892 | + } |
893 | + priv->wizardpenOldButtons = buttons; |
894 | + |
895 | /* Linux Kernel 2.6.x sends EV_SYN/SYN_REPORT as an event terminator, |
896 | * whereas 2.4.x sends EV_ABS/ABS_MISC. We have to support both. |
897 | */ |
898 | - if (!( (event->type == EV_SYN && event->code == SYN_REPORT) || |
899 | - (event->type == EV_ABS && event->code == ABS_MISC) |
900 | - )) { |
901 | - continue; |
902 | - } |
903 | - if(x>priv->topX && x<priv->bottomX) |
904 | - /*report_x = (x-priv->topX) * screenInfo.screens[0]->width / (priv->bottomX-priv->topX);*/ |
905 | - report_x = (x-priv->topX) * screenmaxx / (priv->bottomX-priv->topX); |
906 | - else{ |
907 | - if(x<priv->topX) |
908 | - report_x = 0; |
909 | - else |
910 | - report_x = screenmaxx; /*screenInfo.screens[0]->width;*/ |
911 | - } |
912 | - if(y>priv->topY && y<priv->bottomY) |
913 | - /*report_y = (y-priv->topY) * screenInfo.screens[0]->height / (priv->bottomY-priv->topY);*/ |
914 | - report_y = (y-priv->topY) * screenmaxy / (priv->bottomY-priv->topY); |
915 | - else{ |
916 | - if(y<priv->topY) |
917 | - report_y = 0; |
918 | - else |
919 | - report_y = screenmaxy; /*screenInfo.screens[0]->height;*/ |
920 | - } |
921 | - if(rotate90){ |
922 | - int tempval; |
923 | - if (report_y < 0) |
924 | - report_y = 0; |
925 | - if (report_x < 0) |
926 | - report_x = 0; |
927 | - tempval = report_x; |
928 | - report_x = (screenmaxy - report_y); |
929 | - if (report_x > 1278) |
930 | - report_x = 1278; |
931 | - report_y = tempval; |
932 | - } |
933 | - if (1) |
934 | + if ((event->type == EV_SYN && event->code == SYN_REPORT) || |
935 | + (event->type == EV_ABS && event->code == ABS_MISC)) |
936 | { |
937 | if (!(priv->wizardpenOldProximity)) |
938 | if (!is_core_pointer) |
939 | { |
940 | - /* mpa send value of report_z rather than z */ |
941 | - xf86PostProximityEvent(local->dev, 1, 0, 3 , |
942 | - report_x, report_y, report_z); |
943 | + xf86PostProximityEvent(local->dev, 1, 0, 3 , |
944 | + report_x, report_y, report_z); |
945 | } |
946 | |
947 | - |
948 | - /* mpa send value of report_z rather than z */ |
949 | xf86PostMotionEvent(local->dev, 1, 0, 3, report_x, report_y, report_z); |
950 | - if (priv->wizardpenOldButtons != buttons) |
951 | - { |
952 | - int delta = buttons ^ priv->wizardpenOldButtons; |
953 | - while (delta) |
954 | - { |
955 | - int id = ffs(delta); |
956 | - delta &= ~(1 << (id-1)); |
957 | - xf86PostButtonEvent(local->dev, 1, id, (buttons&(1<<(id-1))), 0, 3, report_x, report_y,report_z); /*mpa send report_z instead of z*/ |
958 | - } |
959 | - } |
960 | - } |
961 | - else |
962 | - { |
963 | - if (!is_core_pointer) |
964 | - if (priv->wizardpenOldProximity) |
965 | - { |
966 | - xf86PostProximityEvent(local->dev, 0, 0, 3, report_x,report_y,report_z); |
967 | - } |
968 | - priv->wizardpenOldProximity = 0; |
969 | - } |
970 | |
971 | - priv->wizardpenOldButtons = buttons; |
972 | - priv->wizardpenOldX = x; |
973 | - priv->wizardpenOldY = y; |
974 | - priv->wizardpenOldZ = z; |
975 | - priv->wizardpenOldProximity = prox; |
976 | + priv->wizardpenOldX = x; |
977 | + priv->wizardpenOldY = y; |
978 | + priv->wizardpenOldZ = z; |
979 | + priv->wizardpenOldProximity = prox; |
980 | + } |
981 | } |
982 | - /*xf86Msg(X_INFO, "ACECAD Tablet Sortie Read Input\n");*/ |
983 | } |
984 | #endif |
985 | |
986 | @@ -1102,24 +1096,24 @@ |
987 | int v0, int v1, int v2, int v3, int v4, int v5, int *x, int *y) |
988 | { |
989 | WizardPenPrivatePtr priv = (WizardPenPrivatePtr)(local->private); |
990 | - if(v0>priv->topX && v0<priv->bottomX) |
991 | - /**x = (v0-priv->topX) * screenInfo.screens[0]->width / (priv->bottomX-priv->topX);*/ |
992 | - *x = (v0-priv->topX) * screenmaxx / (priv->bottomX-priv->topX); |
993 | - else{ |
994 | - if(v0<priv->topX) |
995 | - *x = priv->topX; |
996 | - else |
997 | - *x = priv->bottomX; |
998 | - } |
999 | - if(v1>priv->topY && v1<priv->bottomY) |
1000 | - /**y = (v1-priv->topY) * screenInfo.screens[0]->width / (priv->bottomY-priv->topY);*/ |
1001 | - *y = (v1-priv->topY) * screenmaxy / (priv->bottomY-priv->topY); |
1002 | - else{ |
1003 | - if(v1<priv->topY) |
1004 | - *y = priv->topY; |
1005 | - else |
1006 | - *y = priv->bottomY; |
1007 | - } |
1008 | + if(v0>priv->topX && v0<priv->bottomX) |
1009 | + /**x = (v0-priv->topX) * screenInfo.screens[0]->width / (priv->bottomX-priv->topX);*/ |
1010 | + *x = (v0-priv->topX) * screenmaxx / (priv->bottomX-priv->topX); |
1011 | + else{ |
1012 | + if(v0<priv->topX) |
1013 | + *x = priv->topX; |
1014 | + else |
1015 | + *x = priv->bottomX; |
1016 | + } |
1017 | + if(v1>priv->topY && v1<priv->bottomY) |
1018 | + /**y = (v1-priv->topY) * screenInfo.screens[0]->width / (priv->bottomY-priv->topY);*/ |
1019 | + *y = (v1-priv->topY) * screenmaxy / (priv->bottomY-priv->topY); |
1020 | + else{ |
1021 | + if(v1<priv->topY) |
1022 | + *y = priv->topY; |
1023 | + else |
1024 | + *y = priv->bottomY; |
1025 | + } |
1026 | return TRUE; |
1027 | } |
1028 | |
1029 | @@ -1185,7 +1179,7 @@ |
1030 | |
1031 | #define BITS_PER_LONG (sizeof(long) * 8) |
1032 | #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) |
1033 | -#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) |
1034 | +#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) |
1035 | #define OFF(x) ((x)%BITS_PER_LONG) |
1036 | #define LONG(x) ((x)/BITS_PER_LONG) |
1037 | |
1038 | @@ -1193,11 +1187,11 @@ |
1039 | static Bool |
1040 | USBQueryHardware (LocalDevicePtr local) |
1041 | { |
1042 | - WizardPenPrivatePtr priv = (WizardPenPrivatePtr) local->private; |
1043 | - unsigned long bit[EV_MAX][NBITS(KEY_MAX)]; |
1044 | - int i, j; |
1045 | - int abs[5]; |
1046 | - char name[256] = "Unknown"; |
1047 | + WizardPenPrivatePtr priv = (WizardPenPrivatePtr) local->private; |
1048 | + unsigned long bit[EV_MAX][NBITS(KEY_MAX)]; |
1049 | + int i, j; |
1050 | + int abs[5]; |
1051 | + char name[256] = "Unknown"; |
1052 | |
1053 | ioctl(local->fd, EVIOCGNAME(sizeof(name)), name); |
1054 | xf86MsgVerb(X_PROBED, 4, "Kernel Input device name: \"%s\"\n", name); |
1055 | @@ -1215,17 +1209,17 @@ |
1056 | switch (j) { |
1057 | case ABS_X: |
1058 | if(!priv->bottomX) |
1059 | - priv->bottomX = abs[2]; |
1060 | + priv->bottomX = abs[2]; |
1061 | break; |
1062 | |
1063 | case ABS_Y: |
1064 | - if(!priv->bottomY) |
1065 | - priv->bottomY = abs[2]; |
1066 | + if(!priv->bottomY) |
1067 | + priv->bottomY = abs[2]; |
1068 | break; |
1069 | |
1070 | case ABS_PRESSURE: |
1071 | - if(!priv->bottomZ) |
1072 | - priv->bottomZ = abs[2]; |
1073 | + if(!priv->bottomZ) |
1074 | + priv->bottomZ = abs[2]; |
1075 | break; |
1076 | } |
1077 | } |
1078 | |
1079 | === modified file 'src/wizardpen.h' |
1080 | --- src/wizardpen.h 2009-06-24 19:51:16 +0000 |
1081 | +++ src/wizardpen.h 2010-03-20 19:15:26 +0000 |
1082 | @@ -1,8 +1,8 @@ |
1083 | -/* |
1084 | +/* |
1085 | * Copyright (c) 2001 Edouard TISSERANT <tissered@esstin.u-nancy.fr> |
1086 | * Parts inspired from Shane Watts <shane@bofh.asn.au> Xfree 3 Acecad Driver |
1087 | * Thanks to Emily, from AceCad, For giving me documents. |
1088 | - * |
1089 | + * |
1090 | * Permission is hereby granted, free of charge, to any person obtaining a |
1091 | * copy of this software and associated documentation files (the "Software"), |
1092 | * to deal in the Software without restriction, including without limitation |
1093 | @@ -29,37 +29,37 @@ |
1094 | #define _WIZARDPEN_H_ |
1095 | |
1096 | /****************************************************************************** |
1097 | - * Definitions |
1098 | - * structs, typedefs, #defines, enums |
1099 | + * Definitions |
1100 | + * structs, typedefs, #defines, enums |
1101 | *****************************************************************************/ |
1102 | -#define WIZARDPEN_PACKET_SIZE 7 |
1103 | - |
1104 | -#define WIZARDPEN_CONFIG "a" /* Send configuration (max coords) */ |
1105 | - |
1106 | -#define WIZARDPEN_ABSOLUTE 'F' /* Absolute mode */ |
1107 | -#define WIZARDPEN_RELATIVE 'E' /* Relative mode */ |
1108 | - |
1109 | -#define WIZARDPEN_UPPER_ORIGIN "b" /* Origin upper left */ |
1110 | - |
1111 | -#define WIZARDPEN_PROMPT_MODE "B" /* Prompt mode */ |
1112 | -#define WIZARDPEN_STREAM_MODE "@" /* Stream mode */ |
1113 | -#define WIZARDPEN_INCREMENT 'I' /* Set increment */ |
1114 | -#define WIZARDPEN_BINARY_FMT "zb" /* Binary reporting */ |
1115 | - |
1116 | -#define WIZARDPEN_PROMPT "P" /* Prompt for current position */ |
1117 | - |
1118 | -#define PHASING_BIT 0x80 |
1119 | -#define PROXIMITY_BIT 0x40 |
1120 | -#define TABID_BIT 0x20 |
1121 | -#define XSIGN_BIT 0x10 |
1122 | -#define YSIGN_BIT 0x08 |
1123 | -#define BUTTON_BITS 0x07 |
1124 | -#define COORD_BITS 0x7f |
1125 | - |
1126 | -#define ABSOLUTE_FLAG 1 |
1127 | -#define USB_FLAG 2 |
1128 | -#define AUTODEV_FLAG 4 |
1129 | -#define AVAIL_FLAG 8 |
1130 | +#define WIZARDPEN_PACKET_SIZE 7 |
1131 | + |
1132 | +#define WIZARDPEN_CONFIG "a" /* Send configuration (max coords) */ |
1133 | + |
1134 | +#define WIZARDPEN_ABSOLUTE 'F' /* Absolute mode */ |
1135 | +#define WIZARDPEN_RELATIVE 'E' /* Relative mode */ |
1136 | + |
1137 | +#define WIZARDPEN_UPPER_ORIGIN "b" /* Origin upper left */ |
1138 | + |
1139 | +#define WIZARDPEN_PROMPT_MODE "B" /* Prompt mode */ |
1140 | +#define WIZARDPEN_STREAM_MODE "@" /* Stream mode */ |
1141 | +#define WIZARDPEN_INCREMENT 'I' /* Set increment */ |
1142 | +#define WIZARDPEN_BINARY_FMT "zb" /* Binary reporting */ |
1143 | + |
1144 | +#define WIZARDPEN_PROMPT "P" /* Prompt for current position */ |
1145 | + |
1146 | +#define PHASING_BIT 0x80 |
1147 | +#define PROXIMITY_BIT 0x40 |
1148 | +#define TABID_BIT 0x20 |
1149 | +#define XSIGN_BIT 0x10 |
1150 | +#define YSIGN_BIT 0x08 |
1151 | +#define BUTTON_BITS 0x07 |
1152 | +#define COORD_BITS 0x7f |
1153 | + |
1154 | +#define ABSOLUTE_FLAG 1 |
1155 | +#define USB_FLAG 2 |
1156 | +#define AUTODEV_FLAG 4 |
1157 | +#define AVAIL_FLAG 8 |
1158 | |
1159 | #define NOTAVAIL ((errno == ENODEV) || (errno == ENXIO) || (errno == ENOENT)) |
1160 | |
1161 | @@ -69,34 +69,34 @@ |
1162 | |
1163 | static const char * wizardpen_initstr = WIZARDPEN_BINARY_FMT WIZARDPEN_STREAM_MODE; |
1164 | |
1165 | -typedef struct |
1166 | +typedef struct |
1167 | { |
1168 | - XISBuffer *buffer; |
1169 | - int wizardpenInc; /* increment between transmits */ |
1170 | - int wizardpenOldX; /* previous X position */ |
1171 | - int wizardpenOldY; /* previous Y position */ |
1172 | - int wizardpenOldZ; /* previous Z position */ |
1173 | - int wizardpenOldProximity; /* previous proximity */ |
1174 | - int wizardpenOldButtons; /* previous buttons state */ |
1175 | - int wizardpenMaxX; /* max X value */ |
1176 | - int wizardpenMaxY; /* max Y value */ |
1177 | - int wizardpenMaxZ; /* max Y value */ |
1178 | - char wizardpenReportSpeed; /* report speed */ |
1179 | - int flags; /* various flags */ |
1180 | - int packeti; /* number of bytes read */ |
1181 | - int PacketSize; /* number of bytes read */ |
1182 | - unsigned char packet[WIZARDPEN_PACKET_SIZE]; /* data read on the device */ |
1183 | - int topZ; |
1184 | - int bottomZ; |
1185 | - int topX; |
1186 | - int topY; |
1187 | - int bottomX; |
1188 | - int bottomY; |
1189 | + XISBuffer *buffer; |
1190 | + int wizardpenInc; /* increment between transmits */ |
1191 | + int wizardpenOldX; /* previous X position */ |
1192 | + int wizardpenOldY; /* previous Y position */ |
1193 | + int wizardpenOldZ; /* previous Z position */ |
1194 | + int wizardpenOldProximity; /* previous proximity */ |
1195 | + int wizardpenOldButtons; /* previous buttons state */ |
1196 | + int wizardpenMaxX; /* max X value */ |
1197 | + int wizardpenMaxY; /* max Y value */ |
1198 | + int wizardpenMaxZ; /* max Y value */ |
1199 | + char wizardpenReportSpeed; /* report speed */ |
1200 | + int flags; /* various flags */ |
1201 | + int packeti; /* number of bytes read */ |
1202 | + int PacketSize; /* number of bytes read */ |
1203 | + unsigned char packet[WIZARDPEN_PACKET_SIZE]; /* data read on the device */ |
1204 | + int topZ; |
1205 | + int bottomZ; |
1206 | + int topX; |
1207 | + int topY; |
1208 | + int bottomX; |
1209 | + int bottomY; |
1210 | } WizardPenPrivateRec, *WizardPenPrivatePtr; |
1211 | |
1212 | |
1213 | /****************************************************************************** |
1214 | - * Declarations |
1215 | + * Declarations |
1216 | *****************************************************************************/ |
1217 | #ifdef XFree86LOADER |
1218 | static MODULESETUPPROTO( SetupProc ); |
Merged