--- xserver.orig/hw/kdrive/linux/tslib.c 2004-12-01 13:43:29.000000000 -0600 +++ xserver/hw/kdrive/linux/tslib.c 2007-06-03 20:23:53.000000000 -0500 @@ -74,7 +74,7 @@ struct ts_sample event; int n; long x, y; - unsigned long flags; + unsigned long flags = 0; if (tslib_raw_event_hook) { @@ -87,45 +87,70 @@ while (ts_read(tsDev, &event, 1) == 1) { - if (event.pressure) - { - /* - * HACK ATTACK. (static global variables used !) - * Here we test for the touch screen driver actually being on the - * touch screen, if it is we send absolute coordinates. If not, - * then we send delta's so that we can track the entire vga screen. - */ - if (KdCurScreen == KdTsPhyScreen) { - flags = KD_BUTTON_1; - x = event.x; - y = event.y; - } else { - flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA; - if ((lastx == 0) || (lasty == 0)) { - x = 0; - y = 0; - } else { - x = event.x - lastx; - y = event.y - lasty; - } - lastx = event.x; - lasty = event.y; - } - } else { - flags = KD_MOUSE_DELTA; - x = 0; - y = 0; - lastx = 0; - lasty = 0; - } - - KdEnqueueMouseEvent (mi, flags, x, y); + flags = 0; + if (event.pressure || event.flags & TSFLAG_ANYBUTTON ) + { + /* + * HACK ATTACK. (static global variables used !) + * Here we test for the touch screen driver actually being on the + * touch screen, if it is we send absolute coordinates. If not, + * then we send delta's so that we can track the entire vga screen. + */ + if (KdCurScreen == KdTsPhyScreen) { + + if (event.pressure > 0) { + if (event.flags & TSFLAG_ERASER) { + flags |= KD_BUTTON_2; + } else { + flags |= KD_BUTTON_1; + } + } + /* Support for additional buttons on the stylus added by Jay Kuri + * tip and eraser = button 1 and 2, respectively... other buttons + * go from there. button 1 = mouse button 3, etc. + */ + if (event.flags & TSFLAG_BUTTON1) { + flags |= KD_BUTTON_3; + } + if (event.flags & TSFLAG_BUTTON2) { + flags |= KD_BUTTON_4; + } + // for now treat TSFLAG_BUTTON4 as an additional KD_BUTTON5 + if (event.flags & TSFLAG_BUTTON3 || event.flags & TSFLAG_BUTTON4) { + flags |= KD_BUTTON_5; + } + + + x = event.x; + y = event.y; + } else { + flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA; + if ((lastx == 0) || (lasty == 0)) { + x = 0; + y = 0; + } else { + x = event.x - lastx; + y = event.y - lasty; + } + lastx = event.x; + lasty = event.y; + } + } else { + flags |= KD_MOUSE_DELTA; + x = 0; + y = 0; + lastx = 0; + lasty = 0; + } + //fprintf(stderr, "Mouse event: %dx%d %d\n", x, y, flags); + + KdEnqueueMouseEvent (mi, flags, x, y); } } static char *TsNames[] = { NULL, - "/dev/ts", + "/dev/ttyS0", "/dev/touchscreen/0", };