summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-03-06 04:16:31 +0000
committer[email protected] <[email protected]>2011-03-06 04:16:31 +0000
commit62c1662366eeb7f7f0b5c3bc8d2d9549bca40ca2 (patch)
tree403b54f0332eefa16d1508ad9060ebd12350afb5 /components
parent71421510fc9e2ff09ac5b7f88de50d9c307bd235 (diff)
fix destroy an application issue when there is no another application in the panel.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1312 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components')
-rw-r--r--components/rtgui/server/server.c14
-rw-r--r--components/rtgui/widgets/container.c49
2 files changed, 14 insertions, 49 deletions
diff --git a/components/rtgui/server/server.c b/components/rtgui/server/server.c
index 65f5d6b321..26a4bcf6e0 100644
--- a/components/rtgui/server/server.c
+++ b/components/rtgui/server/server.c
@@ -79,12 +79,14 @@ void rtgui_server_destroy_application(struct rtgui_event_panel_detach* event)
{
/* get next thread and active it */
rt_thread_t tid = rtgui_panel_get_active_thread(panel);
-
- /* let this thread repaint */
- struct rtgui_event_paint epaint;
- RTGUI_EVENT_PAINT_INIT(&epaint);
- epaint.wid = RT_NULL;
- rtgui_thread_send(tid, (struct rtgui_event*)&epaint, sizeof(epaint));
+ if (tid != RT_NULL)
+ {
+ /* let this thread repaint */
+ struct rtgui_event_paint epaint;
+ RTGUI_EVENT_PAINT_INIT(&epaint);
+ epaint.wid = RT_NULL;
+ rtgui_thread_send(tid, (struct rtgui_event*)&epaint, sizeof(epaint));
+ }
}
}
else
diff --git a/components/rtgui/widgets/container.c b/components/rtgui/widgets/container.c
index 0a3dce6827..9eacddf86e 100644
--- a/components/rtgui/widgets/container.c
+++ b/components/rtgui/widgets/container.c
@@ -110,6 +110,8 @@ rt_bool_t rtgui_container_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
switch (event->type)
{
case RTGUI_EVENT_PAINT:
+ case RTGUI_EVENT_COMMAND:
+ case RTGUI_EVENT_RESIZE:
rtgui_container_dispatch_event(container, event);
break;
@@ -125,52 +127,13 @@ rt_bool_t rtgui_container_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
case RTGUI_EVENT_MOUSE_BUTTON:
/* handle in child widget */
- if (rtgui_container_dispatch_mouse_event(container,
- (struct rtgui_event_mouse*)event) == RT_FALSE)
- {
- }
- else return RT_TRUE;
+ return rtgui_container_dispatch_mouse_event(container,
+ (struct rtgui_event_mouse*)event);
break;
case RTGUI_EVENT_MOUSE_MOTION:
- if (rtgui_container_dispatch_mouse_event(container,
- (struct rtgui_event_mouse*)event) == RT_FALSE)
- {
-#ifndef RTGUI_USING_SMALL_SIZE
-#if 0
- /* handle event in current widget */
- if (widget->on_mousemotion != RT_NULL)
- {
- return widget->on_mousemotion(widget, event);
- }
-#endif
-#endif
- }
- else return RT_TRUE;
- break;
-
- case RTGUI_EVENT_COMMAND:
- if (rtgui_container_dispatch_event(container, event) == RT_FALSE)
- {
-#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_command != RT_NULL)
- {
- return widget->on_command(widget, event);
- }
-#endif
- }
- else return RT_TRUE;
- break;
-
- case RTGUI_EVENT_RESIZE:
- if (rtgui_container_dispatch_event(container, event) == RT_FALSE)
- {
-#ifndef RTGUI_USING_SMALL_SIZE
- if (widget->on_size != RT_NULL)
- return widget->on_size(widget, event);
-#endif
- }
- else return RT_TRUE;
+ return rtgui_container_dispatch_mouse_event(container,
+ (struct rtgui_event_mouse*)event);
break;
default: