|
/* minigui src/ial目录下的2410.c文件 */
static int mouse_getbutton(void)
{
return ts_event.pressure;
}
#ifdef _LITE_VERSION
static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,
struct timeval *timeout)
#else
static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,
struct timeval *timeout)
#endif
{
fd_set rfds;
int retvalue = 0;
int e;
if (!in) {
in = &rfds;
FD_ZERO (in);
}
if ((which & IAL_MOUSEEVENT) && ts >= 0) {
FD_SET (ts, in);
#ifdef _LITE_VERSION
if (ts > maxfd) maxfd = ts;
#endif
}
#ifdef _LITE_VERSION
e = select (maxfd + 1, in, out, except, timeout) ;
#else
e = select (FD_SETSIZE, in, out, except, timeout) ;
#endif
if (e > 0) {
if (ts >= 0 && FD_ISSET (ts, in)) {
int rs;
FD_CLR (ts, in);
ts_event.x=0;
ts_event.y=0;
printf ("begin to read\n");
rs = read (ts, &ts_event, sizeof (TS_EVENT));
printf ("rs = %d\n", rs);
///////////////////////////////////////////////////////////////////////////////////////问题在这里
if (rs != sizeof(TS_EVENT)) // rs 在这里总是等于3 , 而 sizeof(TS_EVENT)等于8 ,所以总是返回
return -1;
if (ts_event.pressure > 0) {
mousex = ts_event.x;
mousey = ts_event.y;
}
#ifdef _DEBUG
if (ts_event.pressure > 0) {
printf ("mouse down: ts_event.x = %d, ts_event.y = %d\n", ts_event.x, ts_event.y);
}
#endif
ts_event.pressure = ( ts_event.pressure > 0 ? 4:0);
retvalue |= IAL_MOUSEEVENT;
}
}
else if (e < 0) {
return -1;
}
return retvalue;
}
////////////////////////////////////////////////////
typedef struct {
unsigned short pressure;
unsigned short x;
unsigned short y;
unsigned short pad;
} TS_EVENT;
static TS_EVENT ts_event;
///////////////////////////////////////////////////
rs 在这里总是等于3 , 而 sizeof(TS_EVENT)等于8 ,所以总是返回
实在不明白这里怎么出的问题.有兄台知道的请告知一下.谢谢 |
|