summaryrefslogtreecommitdiff
path: root/components/rtgui/widgets
diff options
context:
space:
mode:
author[email protected] <[email protected]>2010-05-30 22:44:21 +0000
committer[email protected] <[email protected]>2010-05-30 22:44:21 +0000
commita1ee019309d171f9dc641c7ef09d545a49edc1a1 (patch)
tree34f73bfd97dc5ae77372275f28d653a81297a1b2 /components/rtgui/widgets
parentea6e5155ef903c6353d8f317dd73b3838658c971 (diff)
move the basic routine of dc to inline; add hdc memory image type; move event buffer from stack to gui thread structure.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@755 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/widgets')
-rw-r--r--components/rtgui/widgets/window.c14
-rw-r--r--components/rtgui/widgets/workbench.c15
2 files changed, 19 insertions, 10 deletions
diff --git a/components/rtgui/widgets/window.c b/components/rtgui/widgets/window.c
index 7401611cc7..0997d769ba 100644
--- a/components/rtgui/widgets/window.c
+++ b/components/rtgui/widgets/window.c
@@ -522,16 +522,20 @@ rt_bool_t rtgui_win_event_handler(struct rtgui_widget* widget, struct rtgui_even
/* windows event loop */
void rtgui_win_event_loop(rtgui_win_t* wnd)
{
- /* the buffer uses to receive event */
- char event_buf[256];
+ rtgui_thread_t* tid;
+ struct rtgui_event* event;
- struct rtgui_event* event = (struct rtgui_event*)&event_buf[0];
+ tid = rtgui_thread_self();
+ RT_ASSERT(tid != RT_NULL);
+
+ /* point to event buffer */
+ event = (struct rtgui_event*)tid->event_buffer;
if (wnd->style & RTGUI_WIN_STYLE_UNDER_MODAL)
{
while (wnd->style & RTGUI_WIN_STYLE_UNDER_MODAL)
{
- if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
+ if (rtgui_thread_recv(event, RTGUI_EVENT_BUFFER_SIZE) == RT_EOK)
{
/* perform event handler */
RTGUI_WIDGET(wnd)->event_handler(RTGUI_WIDGET(wnd), event);
@@ -542,7 +546,7 @@ void rtgui_win_event_loop(rtgui_win_t* wnd)
{
while (!(wnd->style & RTGUI_WIN_STYLE_CLOSED))
{
- if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
+ if (rtgui_thread_recv(event, RTGUI_EVENT_BUFFER_SIZE) == RT_EOK)
{
/* perform event handler */
RTGUI_WIDGET(wnd)->event_handler(RTGUI_WIDGET(wnd), event);
diff --git a/components/rtgui/widgets/workbench.c b/components/rtgui/widgets/workbench.c
index 2408f1254e..28224d1eb9 100644
--- a/components/rtgui/widgets/workbench.c
+++ b/components/rtgui/widgets/workbench.c
@@ -162,16 +162,21 @@ void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag)
rt_bool_t rtgui_workbench_event_loop(rtgui_workbench_t* workbench)
{
- /* the buffer uses to receive event */
- char event_buf[256];
- struct rtgui_event* event = (struct rtgui_event*)&event_buf[0];
+ rtgui_thread_t* tid;
+ struct rtgui_event* event;
+
+ tid = rtgui_thread_self();
+ RT_ASSERT(tid != RT_NULL);
+
+ /* point to event buffer */
+ event = (struct rtgui_event*)tid->event_buffer;
if (workbench->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
{
/* event loop for modal mode shown view */
while (workbench->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
{
- if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
+ if (rtgui_thread_recv(event, RTGUI_EVENT_BUFFER_SIZE) == RT_EOK)
{
RTGUI_WIDGET(workbench)->event_handler(RTGUI_WIDGET(workbench), event);
}
@@ -184,7 +189,7 @@ rt_bool_t rtgui_workbench_event_loop(rtgui_workbench_t* workbench)
while (!(workbench->flag & RTGUI_WORKBENCH_FLAG_CLOSED))
{
- if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
+ if (rtgui_thread_recv(event, RTGUI_EVENT_BUFFER_SIZE) == RT_EOK)
{
RTGUI_WIDGET(workbench)->event_handler(RTGUI_WIDGET(workbench), event);
}