gui 引擎优化;
This commit is contained in:
parent
973a5fb885
commit
ceefcb9732
|
@ -343,7 +343,7 @@ struct rtgui_event_gesture
|
|||
|
||||
enum rtgui_gesture_type type;
|
||||
|
||||
rt_uint32_t win_acti_cnt; /* win id */
|
||||
rt_uint32_t win_acti_cnt; /* window activate count */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -362,7 +362,7 @@ struct rtgui_event_mouse
|
|||
* different id. id should never be 0. */
|
||||
rt_uint32_t id;
|
||||
|
||||
rt_uint32_t win_acti_cnt; /* win id */
|
||||
rt_uint32_t win_acti_cnt; /* window activate count */
|
||||
};
|
||||
#define RTGUI_MOUSE_BUTTON_LEFT 0x01
|
||||
#define RTGUI_MOUSE_BUTTON_RIGHT 0x02
|
||||
|
@ -383,7 +383,7 @@ struct rtgui_event_kbd
|
|||
{
|
||||
_RTGUI_EVENT_WIN_ELEMENTS
|
||||
|
||||
rt_uint32_t win_acti_cnt; /* win id */
|
||||
rt_uint32_t win_acti_cnt; /* window activate count */
|
||||
|
||||
rt_uint16_t type; /* key down or up */
|
||||
rt_uint16_t key; /* current key */
|
||||
|
|
|
@ -173,7 +173,7 @@ enum RTGUI_MODAL_CODE
|
|||
{
|
||||
RTGUI_MODAL_OK,
|
||||
RTGUI_MODAL_CANCEL,
|
||||
RTGUI_MODAL_MAX = 0xFFFFFFFF,
|
||||
RTGUI_MODAL_MAX = 0xFFFF,
|
||||
};
|
||||
typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t;
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ extern unsigned short ff_convert(unsigned short wch, int direction);
|
|||
#define gb2312tounicode(code) ff_convert(code, 1)
|
||||
#endif
|
||||
|
||||
#ifndef UTF8_TO_UNICODE
|
||||
|
||||
static void gbk_to_unicode(rt_uint16_t *unicode, const char *text, int len)
|
||||
{
|
||||
int i;
|
||||
|
@ -91,6 +93,8 @@ static void gbk_to_unicode(rt_uint16_t *unicode, const char *text, int len)
|
|||
*unicode = '\0';
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static rt_uint16_t _get_unicode(const char* str, int n)
|
||||
{
|
||||
int i;
|
||||
|
@ -244,6 +248,7 @@ static int utf8_to_unicode(rt_uint16_t* unicode, const char* utf8, int len)
|
|||
return index;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void _rtgui_rect_move_to_align(const rtgui_rect_t *rect, rtgui_rect_t *to, rt_uint16_t height, int align)
|
||||
{
|
||||
|
@ -574,7 +579,6 @@ static void ftc_draw_text(struct rtgui_font *font,
|
|||
struct rtgui_ttf_font *ttf_font;
|
||||
rt_int16_t begin_x, btm_y;
|
||||
rt_int16_t topy;
|
||||
rt_uint8_t a, r, g, b;
|
||||
rtgui_color_t fgc;
|
||||
struct rtgui_rect text_rect;
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ INIT_APP_EXPORT(rtgui_system_server_init);
|
|||
/************************************************************************/
|
||||
static void rtgui_time_out(void *parameter)
|
||||
{
|
||||
rt_err_t result;
|
||||
rtgui_timer_t *timer;
|
||||
rtgui_event_timer_t event;
|
||||
timer = (rtgui_timer_t *)parameter;
|
||||
|
@ -103,7 +104,11 @@ static void rtgui_time_out(void *parameter)
|
|||
event.timer = timer;
|
||||
timer->pending_cnt++;
|
||||
|
||||
rtgui_send(timer->app, &(event.parent), sizeof(rtgui_event_timer_t));
|
||||
result = rtgui_send(timer->app, &(event.parent), sizeof(rtgui_event_timer_t));
|
||||
if (result == RT_EOK)
|
||||
{
|
||||
timer->pending_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
rtgui_timer_t *rtgui_timer_create(rt_int32_t time, rt_int32_t flag, rtgui_timeout_func timeout, void *parameter)
|
||||
|
|
|
@ -115,6 +115,7 @@ void rtgui_server_handle_mouse_btn(struct rtgui_event_mouse *event)
|
|||
return;
|
||||
|
||||
event->wid = wnd->wid;
|
||||
event->win_acti_cnt = rtgui_app_get_win_acti_cnt();
|
||||
|
||||
/* only raise window if the button is pressed down */
|
||||
if (event->button & RTGUI_MOUSE_BUTTON_DOWN &&
|
||||
|
@ -124,9 +125,10 @@ void rtgui_server_handle_mouse_btn(struct rtgui_event_mouse *event)
|
|||
}
|
||||
|
||||
/* send mouse event to thread */
|
||||
rtgui_send(wnd->app,
|
||||
(struct rtgui_event *)event,
|
||||
sizeof(struct rtgui_event_mouse));
|
||||
while (rtgui_send(wnd->app, (struct rtgui_event *)event, sizeof(struct rtgui_event_mouse)) != RT_EOK)
|
||||
{
|
||||
rt_thread_delay(RT_TICK_PER_SECOND / 50);
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_server_handle_mouse_motion(struct rtgui_event_mouse *event)
|
||||
|
@ -152,6 +154,8 @@ void rtgui_server_handle_mouse_motion(struct rtgui_event_mouse *event)
|
|||
if (win)
|
||||
{
|
||||
event->wid = win->wid;
|
||||
event->win_acti_cnt = rtgui_app_get_win_acti_cnt();
|
||||
|
||||
rtgui_send(win->wid->app, &(event->parent), sizeof(*event));
|
||||
}
|
||||
|
||||
|
@ -175,6 +179,7 @@ void rtgui_server_handle_kbd(struct rtgui_event_kbd *event)
|
|||
|
||||
/* send to focus window */
|
||||
event->wid = wnd->wid;
|
||||
event->win_acti_cnt = rtgui_app_get_win_acti_cnt();
|
||||
|
||||
/* send keyboard event to thread */
|
||||
rtgui_send(wnd->app, (struct rtgui_event *)event, sizeof(struct rtgui_event_kbd));
|
||||
|
|
Loading…
Reference in New Issue