| 405 | void _set_mouse_position(rt_uint32_t X, rt_uint32_t Y) |
| 406 | {} |
| 407 | static void touch_thread_entry(void *parameter) |
| 408 | { |
| 409 | rt_bool_t touch_down = RT_FALSE; |
| 410 | rt_uint32_t event_value; |
| 411 | struct rtgui_event_mouse emouse; |
| 412 | static struct _touch_previous |
| 413 | { |
| 414 | rt_uint32_t x; |
| 415 | rt_uint32_t y; |
| 416 | } touch_previous; |
| 417 | |
| 418 | RTGUI_EVENT_MOUSE_BUTTON_INIT(&emouse); |
| 419 | emouse.wid = RT_NULL; |
| 420 | |
| 421 | while(1) |
| 422 | { |
| 423 | /* 接收到触摸中断事件 */ |
| 424 | if(rt_event_recv(&touch->event, |
| 425 | 1, |
| 426 | RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, |
| 427 | 100, |
| 428 | &event_value) |
| 429 | == RT_EOK) |
| 430 | { |
| 431 | while(1) |
| 432 | { |
| 433 | if (IS_TOUCH_UP()) |
| 434 | { |
| 435 | /* 触摸笔抬起 */ |
| 436 | /* touch up */ |
| 437 | emouse.button = (RTGUI_MOUSE_BUTTON_LEFT |RTGUI_MOUSE_BUTTON_UP); |
| 438 | |
| 439 | /* use old value */ |
| 440 | emouse.x = touch->x; |
| 441 | emouse.y = touch->y; |
| 442 | |
| 443 | if(touch_down != RT_TRUE) |
| 444 | { |
| 445 | touch_int_cmd(RT_TRUE); |
| 446 | break; |
| 447 | } |
| 448 | |
| 449 | if ((touch->calibrating == RT_TRUE) && (touch->calibration_func != RT_NULL)) |
| 450 | { |
| 451 | /* 触摸校准处理 */ |
| 452 | /* callback function */ |
| 453 | touch->calibration_func(emouse.x, emouse.y); |
| 454 | |
| 455 | } |
| 456 | else |
| 457 | { |
| 458 | /* 向ui发送触摸坐标 */ |
| 459 | rtgui_server_post_event(&emouse.parent, sizeof(struct rtgui_event_mouse)); |
| 460 | } |
| 461 | rt_kprintf("touch up: (%d, %d)\n", emouse.x, emouse.y); |
| 462 | |
| 463 | /* clean */ |
| 464 | touch_previous.x = touch_previous.y = 0; |
nothing calls this directly
no test coverage detected