1、修改minigui库中IAL的输入引擎,增加对触摸屏的操作
定义: static struct tsdev *ts;
打开:
ts = ts_open ("/dev/input/event0", 0);
ts_config(ts);
关闭:
ts_close(ts);
读取:
int fd = ts_fd(ts);
if ((which & IAL_MOUSEEVENT) && fd >= 0)
{
printf("which is %d ",which);
FD_SET (fd, in);
}
e = select (FD_SETSIZE, in, out, except, timeout) ;
if (e > 0)
{
if (fd > 0 && FD_ISSET (fd, in))
{
FD_CLR (fd, in);
ts_event.x=0;
ts_event.y=0;
ret = ts_read(ts, &sample, 1);
if (ret < 0)
{
perror("ts_read()");
exit(-1);
}
ts_event.x = sample.x;
ts_event.y = sample.y;
ts_event.pressure = (sample.pressure > 0 ? 4:0);
ret |= IAL_MOUSEEVENT;
return (ret);
}
2、编译minigui库时,增加tslib库的头文件和路径
./configure CC=arm-linux-gcc --build=i686-pc-linux --target=arm-linux --host=arm-linux --disable-galqvfb --disable-galecoslcd --
disable-vbfsupport --prefix=/usr/local/arm/3.4.1/arm-linux CFLAGS="-I/usr/local/arm/3.4.1/arm-linux/include -L/usr/local/arm/3.4.1/arm-linux/lib -lts"
3、应用程序中,增加 MSG_LBUTTONDOWN MSG_LBUTTONUP消息响应,进行测试