提交 6dac26e5 编写于 作者: B bernard.xiong

remove more fields on window create.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@386 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 da603729
...@@ -154,11 +154,19 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event) ...@@ -154,11 +154,19 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
struct rtgui_event_win_create *create = (struct rtgui_event_win_create*)event; struct rtgui_event_win_create *create = (struct rtgui_event_win_create*)event;
rt_kprintf(" win: %s at (x1:%d, y1:%d, x2:%d, y2:%d)", rt_kprintf(" win: %s at (x1:%d, y1:%d, x2:%d, y2:%d)",
#ifdef RTGUI_USING_SMALL_SIZE
create->wid->title,
RTGUI_WIDGET(create->wid)->extent.x1,
RTGUI_WIDGET(create->wid)->extent.y1,
RTGUI_WIDGET(create->wid)->extent.x2,
RTGUI_WIDGET(create->wid)->extent.y2);
#else
create->title, create->title,
create->extent.x1, create->extent.x1,
create->extent.y1, create->extent.y1,
create->extent.x2, create->extent.x2,
create->extent.y2); create->extent.y2);
#endif
} }
break; break;
...@@ -340,6 +348,7 @@ struct rtgui_widget* rtgui_thread_get_widget() ...@@ -340,6 +348,7 @@ struct rtgui_widget* rtgui_thread_get_widget()
rt_err_t rtgui_thread_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size) rt_err_t rtgui_thread_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size)
{ {
rt_err_t result;
struct rtgui_thread* thread; struct rtgui_thread* thread;
rtgui_event_dump(tid, event); rtgui_event_dump(tid, event);
...@@ -350,11 +359,16 @@ rt_err_t rtgui_thread_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t even ...@@ -350,11 +359,16 @@ rt_err_t rtgui_thread_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t even
thread = (struct rtgui_thread*) (tid->user_data); thread = (struct rtgui_thread*) (tid->user_data);
if (thread == RT_NULL) return -RT_ERROR; if (thread == RT_NULL) return -RT_ERROR;
return rt_mq_send(thread->mq, event, event_size); result = rt_mq_send(thread->mq, event, event_size);
if (result != RT_EOK)
rt_kprintf("send event failed\n");
return result;
} }
rt_err_t rtgui_thread_send_urgent(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size) rt_err_t rtgui_thread_send_urgent(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size)
{ {
rt_err_t result;
struct rtgui_thread* thread; struct rtgui_thread* thread;
rtgui_event_dump(tid, event); rtgui_event_dump(tid, event);
...@@ -364,7 +378,11 @@ rt_err_t rtgui_thread_send_urgent(rt_thread_t tid, rtgui_event_t* event, rt_size ...@@ -364,7 +378,11 @@ rt_err_t rtgui_thread_send_urgent(rt_thread_t tid, rtgui_event_t* event, rt_size
thread = (struct rtgui_thread*) (tid->user_data); thread = (struct rtgui_thread*) (tid->user_data);
if (thread == RT_NULL) return -RT_ERROR; if (thread == RT_NULL) return -RT_ERROR;
return rt_mq_urgent(thread->mq, event, event_size); result = rt_mq_urgent(thread->mq, event, event_size);
if (result != RT_EOK)
rt_kprintf("send ergent event failed\n");
return result;
} }
rt_err_t rtgui_thread_send_sync(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size) rt_err_t rtgui_thread_send_sync(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size)
...@@ -387,7 +405,11 @@ rt_err_t rtgui_thread_send_sync(rt_thread_t tid, rtgui_event_t* event, rt_size_t ...@@ -387,7 +405,11 @@ rt_err_t rtgui_thread_send_sync(rt_thread_t tid, rtgui_event_t* event, rt_size_t
event->ack = &ack_mb; event->ack = &ack_mb;
r = rt_mq_send(thread->mq, event, event_size); r = rt_mq_send(thread->mq, event, event_size);
if (r != RT_EOK) goto __return; if (r != RT_EOK)
{
rt_kprintf("send sync event failed\n");
goto __return;
}
r = rt_mb_recv(&ack_mb, (rt_uint32_t*)&ack_status, RT_WAITING_FOREVER); r = rt_mb_recv(&ack_mb, (rt_uint32_t*)&ack_status, RT_WAITING_FOREVER);
if ( r!= RT_EOK) goto __return; if ( r!= RT_EOK) goto __return;
......
...@@ -77,7 +77,9 @@ enum { ...@@ -77,7 +77,9 @@ enum {
struct rtgui_event struct rtgui_event
{ {
/* the event type */ /* the event type */
rt_uint32_t type; rt_uint16_t type;
/* user field of event */
rt_uint16_t user;
/* the event sender */ /* the event sender */
rt_thread_t sender; rt_thread_t sender;
...@@ -91,6 +93,7 @@ typedef struct rtgui_event rtgui_event_t; ...@@ -91,6 +93,7 @@ typedef struct rtgui_event rtgui_event_t;
#define RTGUI_EVENT_INIT(e, t) do \ #define RTGUI_EVENT_INIT(e, t) do \
{ \ { \
(e)->type = (t); \ (e)->type = (t); \
(e)->user = 0; \
(e)->sender = rt_thread_self(); \ (e)->sender = rt_thread_self(); \
(e)->ack = RT_NULL; \ (e)->ack = RT_NULL; \
} while (0) } while (0)
...@@ -172,16 +175,15 @@ struct rtgui_event_win_create ...@@ -172,16 +175,15 @@ struct rtgui_event_win_create
{ {
struct rtgui_event parent; struct rtgui_event parent;
/* the window flag */ #ifndef RTGUI_USING_SMALL_SIZE
rt_uint32_t flag;
/* the window title */ /* the window title */
rt_uint8_t title[RTGUI_NAME_MAX]; rt_uint8_t title[RTGUI_NAME_MAX];
/* the window extent */
struct rtgui_rect extent;
#endif
/* the window id */ /* the window id */
rtgui_win_t* wid; rtgui_win_t* wid;
/* the window extent */
struct rtgui_rect extent;
}; };
struct rtgui_event_win_move struct rtgui_event_win_move
...@@ -332,9 +334,9 @@ struct rtgui_event_kbd ...@@ -332,9 +334,9 @@ struct rtgui_event_kbd
rtgui_win_t* wid; /* destination window */ rtgui_win_t* wid; /* destination window */
RTGUI_KBD_TYPE type; /* key down or up */ rt_uint16_t type; /* key down or up */
RTGUI_KBD_KEY key; /* current key */ rt_uint16_t key; /* current key */
RTGUI_KBD_MOD mod; /* current key modifiers */ rt_uint16_t mod; /* current key modifiers */
rt_uint16_t unicode; /* translated character */ rt_uint16_t unicode; /* translated character */
}; };
#define RTGUI_KBD_IS_SET_CTRL(e) ((e)->mod & (RTGUI_KMOD_LCTRL | RTGUI_KMOD_RCTRL))) #define RTGUI_KBD_IS_SET_CTRL(e) ((e)->mod & (RTGUI_KMOD_LCTRL | RTGUI_KMOD_RCTRL)))
...@@ -357,9 +359,6 @@ struct rtgui_event_command ...@@ -357,9 +359,6 @@ struct rtgui_event_command
/* command id */ /* command id */
rt_int32_t command_id; rt_int32_t command_id;
/* command integer */
rt_int32_t command_int;
/* command string */ /* command string */
char command_string[RTGUI_NAME_MAX]; char command_string[RTGUI_NAME_MAX];
}; };
......
...@@ -483,7 +483,7 @@ static void rtgui_server_entry(void* parameter) ...@@ -483,7 +483,7 @@ static void rtgui_server_entry(void* parameter)
#ifdef RTGUI_USING_SMALL_SIZE #ifdef RTGUI_USING_SMALL_SIZE
/* create rtgui server msgq */ /* create rtgui server msgq */
rtgui_server_mq = rt_mq_create("rtgui", rtgui_server_mq = rt_mq_create("rtgui",
64, 8, RT_IPC_FLAG_FIFO); 32, 8, RT_IPC_FLAG_FIFO);
#else #else
/* create rtgui server msgq */ /* create rtgui server msgq */
rtgui_server_mq = rt_mq_create("rtgui", rtgui_server_mq = rt_mq_create("rtgui",
......
...@@ -70,14 +70,18 @@ rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event) ...@@ -70,14 +70,18 @@ rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event)
if (topwin == RT_NULL) return -RT_ERROR; if (topwin == RT_NULL) return -RT_ERROR;
topwin->wid = event->wid; topwin->wid = event->wid;
#ifdef RTGUI_USING_SMALL_SIZE
topwin->extent = RTGUI_WIDGET(event->wid)->extent;
#else
topwin->extent = event->extent; topwin->extent = event->extent;
#endif
topwin->tid = event->parent.sender; topwin->tid = event->parent.sender;
topwin->flag = 0; topwin->flag = 0;
if (event->flag & RTGUI_WIN_STYLE_NO_TITLE) topwin->flag |= WINTITLE_NO; if (event->parent.user & RTGUI_WIN_STYLE_NO_TITLE) topwin->flag |= WINTITLE_NO;
if (event->flag & RTGUI_WIN_STYLE_CLOSEBOX) topwin->flag |= WINTITLE_CLOSEBOX; if (event->parent.user & RTGUI_WIN_STYLE_CLOSEBOX) topwin->flag |= WINTITLE_CLOSEBOX;
if (!(event->flag & RTGUI_WIN_STYLE_NO_BORDER)) topwin->flag |= WINTITLE_BORDER; if (!(event->parent.user & RTGUI_WIN_STYLE_NO_BORDER)) topwin->flag |= WINTITLE_BORDER;
if (event->flag & RTGUI_WIN_STYLE_NO_FOCUS) topwin->flag |= WINTITLE_NOFOCUS; if (event->parent.user & RTGUI_WIN_STYLE_NO_FOCUS) topwin->flag |= WINTITLE_NOFOCUS;
if(!(topwin->flag & WINTITLE_NO) || (topwin->flag & WINTITLE_BORDER)) if(!(topwin->flag & WINTITLE_NO) || (topwin->flag & WINTITLE_BORDER))
{ {
...@@ -93,7 +97,11 @@ rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event) ...@@ -93,7 +97,11 @@ rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event)
/* add title rect */ /* add title rect */
if (!(topwin->flag & WINTITLE_NO)) rect.y1 -= WINTITLE_HEIGHT; if (!(topwin->flag & WINTITLE_NO)) rect.y1 -= WINTITLE_HEIGHT;
#ifdef RTGUI_USING_SMALL_SIZE
topwin->title = rtgui_wintitle_create(event->wid->title);
#else
topwin->title = rtgui_wintitle_create(event->title); topwin->title = rtgui_wintitle_create(event->title);
#endif
rtgui_widget_set_rect(RTGUI_WIDGET(topwin->title), &rect); rtgui_widget_set_rect(RTGUI_WIDGET(topwin->title), &rect);
/* update clip info */ /* update clip info */
...@@ -289,9 +297,7 @@ void rtgui_topwin_raise(struct rtgui_win* wid, rt_thread_t sender) ...@@ -289,9 +297,7 @@ void rtgui_topwin_raise(struct rtgui_win* wid, rt_thread_t sender)
/* send clip info event */ /* send clip info event */
count = 0; count = 0;
for (node = _rtgui_topwin_show_list.next; for (node = _rtgui_topwin_show_list.next; node != RT_NULL; node = node->next)
node != &(topwin->list);
node = node->next)
{ {
struct rtgui_topwin* wnd = rtgui_list_entry(node, struct rtgui_topwin, list); struct rtgui_topwin* wnd = rtgui_list_entry(node, struct rtgui_topwin, list);
...@@ -1020,12 +1026,13 @@ void rtgui_topwin_get_clipinfo(struct rtgui_rect* rect_list, rt_int32_t count) ...@@ -1020,12 +1026,13 @@ void rtgui_topwin_get_clipinfo(struct rtgui_rect* rect_list, rt_int32_t count)
topwin = rtgui_list_entry(node, struct rtgui_topwin, list); topwin = rtgui_list_entry(node, struct rtgui_topwin, list);
if (topwin->title != RT_NULL) if (topwin->title != RT_NULL)
rtgui_widget_get_rect(RTGUI_WIDGET(topwin->title), rect); *rect = RTGUI_WIDGET(topwin->title)->extent;
else *rect = topwin->extent; else
*rect = topwin->extent;
rect ++; rect ++;
count --; count --;
if (count < 0) break; if (count <= 0) break;
} }
rt_sem_release(&_rtgui_topwin_lock); rt_sem_release(&_rtgui_topwin_lock);
} }
......
...@@ -37,12 +37,13 @@ static void _rtgui_toplevel_constructor(rtgui_toplevel_t *toplevel) ...@@ -37,12 +37,13 @@ static void _rtgui_toplevel_constructor(rtgui_toplevel_t *toplevel)
static void _rtgui_toplevel_destructor(rtgui_toplevel_t* toplevel) static void _rtgui_toplevel_destructor(rtgui_toplevel_t* toplevel)
{ {
/* release external clip info */ /* release external clip info */
rtgui_free(toplevel->external_clip_rect);
toplevel->drawing = 0; toplevel->drawing = 0;
if (toplevel->external_clip_size > 0)
{
rtgui_free(toplevel->external_clip_rect); rtgui_free(toplevel->external_clip_rect);
toplevel->external_clip_rect = RT_NULL; toplevel->external_clip_rect = RT_NULL;
toplevel->external_clip_size = 0; toplevel->external_clip_size = 0;
}
} }
rtgui_type_t *rtgui_toplevel_type_get(void) rtgui_type_t *rtgui_toplevel_type_get(void)
...@@ -115,6 +116,10 @@ rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* ev ...@@ -115,6 +116,10 @@ rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* ev
return RT_FALSE; return RT_FALSE;
} }
#include <rtgui/widgets/window.h>
#include <rtgui/widgets/workbench.h>
#include <rtgui/widgets/title.h>
void rtgui_toplevel_handle_clip(struct rtgui_toplevel* top, void rtgui_toplevel_handle_clip(struct rtgui_toplevel* top,
struct rtgui_event_clip_info* info) struct rtgui_event_clip_info* info)
{ {
......
...@@ -78,9 +78,11 @@ static rt_bool_t _rtgui_win_create_in_server(rtgui_win_t* win) ...@@ -78,9 +78,11 @@ static rt_bool_t _rtgui_win_create_in_server(rtgui_win_t* win)
/* send win create event to server */ /* send win create event to server */
ecreate.wid = win; ecreate.wid = win;
ecreate.parent.user = win->style;
#ifndef RTGUI_USING_SMALL_SIZE
ecreate.extent = RTGUI_WIDGET(win)->extent; ecreate.extent = RTGUI_WIDGET(win)->extent;
ecreate.flag = win->style;
rt_strncpy((char*)ecreate.title, (char*)win->title, RTGUI_NAME_MAX); rt_strncpy((char*)ecreate.title, (char*)win->title, RTGUI_NAME_MAX);
#endif
if (rtgui_thread_send_sync(server, RTGUI_EVENT(&ecreate), if (rtgui_thread_send_sync(server, RTGUI_EVENT(&ecreate),
sizeof(struct rtgui_event_win_create)) != RT_EOK) sizeof(struct rtgui_event_win_create)) != RT_EOK)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册