void rtgui_server_handle_touch(struct rtgui_event_touch *event) { if (rtgui_touch_do_calibration(event) == RT_TRUE) { struct rtgui_event_mouse emouse; /* convert it as a mouse event to rtgui */ if (event->up_down == RTGUI_TOUCH_MOTION) { RTGUI_EVENT_MOUSE_MOTION_INIT(&emouse); emouse.x = event->x; emouse.y = event->y; emouse.button = 0; rtgui_server_handle_mouse_motion(&emouse); } else { RTGUI_EVENT_MOUSE_BUTTON_INIT(&emouse); emouse.x = event->x; emouse.y = event->y; emouse.button = RTGUI_MOUSE_BUTTON_LEFT; if (event->up_down == RTGUI_TOUCH_UP) emouse.button |= RTGUI_MOUSE_BUTTON_UP; else emouse.button |= RTGUI_MOUSE_BUTTON_DOWN; rtgui_server_handle_mouse_btn(&emouse); } } }
void rtgui_server_handle_mouse_motion(struct rtgui_event_mouse *event) { /* the topwin contains current mouse */ struct rtgui_topwin *win = RT_NULL; /* re-init mouse event */ RTGUI_EVENT_MOUSE_MOTION_INIT(event); win = rtgui_topwin_get_wnd_no_modaled(event->x, event->y); if (win != RT_NULL && win->monitor_list.next != RT_NULL) { // FIXME: /* check whether the monitor exist */ if (rtgui_mouse_monitor_contains_point(&(win->monitor_list), event->x, event->y) != RT_TRUE) { win = RT_NULL; } } if (last_monitor_topwin != RT_NULL) { event->wid = last_monitor_topwin->wid; /* send mouse motion event */ rtgui_send(last_monitor_topwin->app, &(event->parent), sizeof(struct rtgui_event_mouse)); } if (last_monitor_topwin != win) { last_monitor_topwin = win; if (last_monitor_topwin != RT_NULL) { event->wid = last_monitor_topwin->wid; /* send mouse motion event */ rtgui_send(last_monitor_topwin->app, &(event->parent), sizeof(struct rtgui_event_mouse)); } } /* move mouse to (x, y) */ rtgui_mouse_moveto(event->x, event->y); }