Minigui移植uClinux(4)
{
return 1; }
static void mouse_getxy(int *x, int* y) {
#ifdef _DEBUG
printf (\#endif
if (mousex < 0) mousex = 0; if (mousey < 0) mousey = 0; if (mousex > 239) mousex = 239; if (mousey > 319) mousey = 319;
*x = mousex; *y = mousey; }
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;
static int last_pressure=0;
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) ) { FD_CLR (ts, in); ts_event.x=0; ts_event.y=0;
read (ts, &ts_event, sizeof (TS_EVENT));
if(last_pressure==0) {
read(ts,&ts_event,sizeof(TS_EVENT)); read(ts,&ts_event,sizeof(TS_EVENT)); }
if (ts_event.pressure > 0 ) {
int new_x; int new_y;
mPOINT ts_point,display_point;
ts_point.x=ts_event.x; ts_point.y=ts_event.y;
getDisplayPoint(&display_point,&ts_point,&m_matrix);
new_x = display_point.x; new_y = display_point.y;
if(last_pressure==0 || (last_pressure>0 && abs(new_x-mousex)<7)) mousex=new_x;
if(last_pressure==0 || (last_pressure>0 && abs(new_y-mousey)<7)) mousey=new_y; /*
printf(\printf(\*/
}
#ifdef _DEBUG
if (ts_event.pressure > 0) {
printf (\down: ts_event.x = %d, ts_event.y = %d\\n\ts_event.x, ts_event.y); } #endif
ts_event.pressure = ( ts_event.pressure > 0 ? IAL_MOUSE_LEFTBUTTON : 0);
last_pressure=ts_event.pressure; /*
printf(\*/
retvalue |= IAL_MOUSEEVENT; } }
else if (e < 0) { return -1; }
return retvalue; }
BOOL Init2410Input (INPUT* input, const char* mdev, const char* mtype) {
ts = open (\ if (ts < 0) {
fprintf (stderr, \ return FALSE; }
input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL;
input->get_mouse_button = mouse_getbutton; input->set_mouse_range = NULL;
input->wait_event = wait_event; mousex = 0; mousey = 0;
ts_event.x = ts_event.y = ts_event.pressure = 0;
setCalibrationMatrix(&display_position,&ts_position,&m_matrix); return TRUE; }
void Term2410Input(void) {
if (ts >= 0)
close(ts); }
#endif /* _SMDK2410_IAL */
int setCalibrationMatrix( mPOINT * displayPtr, mPOINT * screenPtr, mMATRIX * matrixPtr) {
int retvalue = 0 ;
matrixPtr->Divider = ((screenPtr[0].x - screenPtr[2].x) * (screenPtr[1].y - screenPtr[2].y)) -
((screenPtr[1].x - screenPtr[2].x) * (screenPtr[0].y - screenPtr[2].y)) ;
if( matrixPtr->Divider == 0 ) {
retvalue = -1 ; } else {
matrixPtr->An = ((displayPtr[0].x - displayPtr[2].x) * (screenPtr[1].y - screenPtr[2].y)) -
((displayPtr[1].x - displayPtr[2].x) * (screenPtr[0].y - screenPtr[2].y)) ;
matrixPtr->Bn = ((screenPtr[0].x - screenPtr[2].x) * (displayPtr[1].x - displayPtr[2].x)) -
((displayPtr[0].x - displayPtr[2].x) * (screenPtr[1].x - screenPtr[2].x)) ;
matrixPtr->Cn = (screenPtr[2].x * displayPtr[1].x - screenPtr[1].x * displayPtr[2].x) * screenPtr[0].y +
(screenPtr[0].x * displayPtr[2].x - screenPtr[2].x * displayPtr[0].x) * screenPtr[1].y +
(screenPtr[1].x * displayPtr[0].x - screenPtr[0].x * displayPtr[1].x) * screenPtr[2].y ;
matrixPtr->Dn = ((displayPtr[0].y - displayPtr[2].y) * (screenPtr[1].y - screenPtr[2].y)) -
((displayPtr[1].y - displayPtr[2].y) * (screenPtr[0].y - screenPtr[2].y)) ;
matrixPtr->En = ((screenPtr[0].x - screenPtr[2].x) * (displayPtr[1].y - displayPtr[2].y)) -
((displayPtr[0].y - displayPtr[2].y) * (screenPtr[1].x - screenPtr[2].x)) ;
matrixPtr->Fn = (screenPtr[2].x * displayPtr[1].y - screenPtr[1].x * displayPtr[2].y) * screenPtr[0].y +
(screenPtr[0].x * displayPtr[2].y - screenPtr[2].x * displayPtr[0].y) * screenPtr[1].y +
(screenPtr[1].x * displayPtr[0].y - screenPtr[0].x * displayPtr[1].y) * screenPtr[2].y ; }
return( retvalue ) ;
} /* end of setCalibrationMatrix() */
int getDisplayPoint( mPOINT * displayPtr, mPOINT * screenPtr, mMATRIX * matrixPtr ) {
int retvalue = 0 ;
…… 此处隐藏:1862字,全部文档内容请下载后查看。喜欢就下载吧 ……相关推荐:
- [法律文档]苏教版七年级语文下册第五单元教学设计
- [法律文档]向市委巡视组进点汇报材料
- [法律文档]绵阳市2018年高三物理上学期第二次月考
- [法律文档]浅析如何解决当代中国“新三座大山”的
- [法律文档]延安北过境线大桥工程防洪评价报告 -
- [法律文档]激活生成元素让数学课堂充满生机
- [法律文档]2014年春学期九年级5月教学质量检测语
- [法律文档]放射科标准及各项计1
- [法律文档]2012年广州化学中考试题和答案(原版)
- [法律文档]地球物理勘查规范
- [法律文档]《12系列建筑标准设计图集》目录
- [法律文档]2018年宁波市专技人员继续教育公需课-
- [法律文档]工会委员会工作职责
- [法律文档]2014新版外研社九年级英语上册课文(完
- [法律文档]《阅微草堂笔记》部分篇目赏析
- [法律文档]尔雅军事理论2018课后答案(南开版)
- [法律文档]储竣-13827 黑娃山沟大开挖穿越说明书
- [法律文档]《产品设计》教学大纲及课程简介
- [法律文档]电动吊篮专项施工方案 - 图文
- [法律文档]实木地板和复合地板的比较
- 探析如何提高电力系统中PLC的可靠性
- 用Excel函数快速实现体能测试成绩统计
- 教师招聘考试重点分析:班主任工作常识
- 高三历史选修一《历史上重大改革回眸》
- 2013年中山市部分职位(工种)人力资源视
- 2015年中国水溶性蛋白市场年度调研报告
- 原地踏步走与立定教学设计
- 何家弘法律英语课件_第十二课
- 海信冰箱经销商大会——齐俊强副总经理
- 犯罪心理学讲座
- 初中英语作文病句和错句修改范例
- 虚拟化群集部署计划及操作流程
- 焊接板式塔顶冷凝器设计
- 浅析语文教学中
- 结构力学——6位移法
- 天正建筑CAD制图技巧
- 中华人民共和国财政部令第57号——注册
- 赢在企业文化展厅设计的起跑线上
- 2013版物理一轮精品复习学案:实验6
- 直隶总督署简介




