From f868c8540a61901891a8d779604e1fecbc921b3d Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Fri, 5 Feb 2010 00:05:30 +0000 Subject: [PATCH] fix no win title issue. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@375 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- rtgui/common/rtgui_theme.c | 1 + rtgui/include/rtgui/rtgui_config.h | 12 +++++---- rtgui/server/topwin.c | 39 ++++++++++++++++++------------ 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/rtgui/common/rtgui_theme.c b/rtgui/common/rtgui_theme.c index e2c0dd95ce..0609ecdd27 100644 --- a/rtgui/common/rtgui_theme.c +++ b/rtgui/common/rtgui_theme.c @@ -53,6 +53,7 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win) /* begin drawing */ dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(win->title)); + if (dc == RT_NULL) return; /* get rect */ rtgui_widget_get_rect(RTGUI_WIDGET(win->title), &rect); diff --git a/rtgui/include/rtgui/rtgui_config.h b/rtgui/include/rtgui/rtgui_config.h index 3a2c8ac760..ea0b42e018 100644 --- a/rtgui/include/rtgui/rtgui_config.h +++ b/rtgui/include/rtgui/rtgui_config.h @@ -25,20 +25,22 @@ #define RTGUI_USING_FONT16 #define RTGUI_USING_FONTHZ +// #define RTGUI_USING_SMALL_SIZE + #ifdef _WIN32 #define RTGUI_USING_STDIO_FILERW #define RTGUI_IMAGE_PNG #define RTGUI_IMAGE_JPEG #define RTGUI_USING_FONT12 +#define RTGUI_USING_HZ_BMP +#define RTGUI_MEM_TRACE #else #define RTGUI_USING_DFS_FILERW -//#define RTGUI_USING_HZ_FILE -#define RTGUI_USING_HZ_BMP -#define RTGUI_USING_FONT12 +#define RTGUI_USING_HZ_FILE +// #define RTGUI_USING_HZ_BMP +// #define RTGUI_USING_FONT12 #endif -// #define RTGUI_USING_SMALL_SIZE - #define RTGUI_SVR_THREAD_PRIORITY 15 #define RTGUI_SVR_THREAD_TIMESLICE 5 #ifdef RTGUI_USING_SMALL_SIZE diff --git a/rtgui/server/topwin.c b/rtgui/server/topwin.c index 6eccc483cc..c8f2b903dc 100644 --- a/rtgui/server/topwin.c +++ b/rtgui/server/topwin.c @@ -304,11 +304,14 @@ void rtgui_topwin_raise(struct rtgui_win* wid, rt_thread_t sender) rtgui_thread_send(wnd->tid, &(eclip.parent), sizeof(struct rtgui_event_clip_info)); /* reset clip info in title */ - rtgui_toplevel_handle_clip(RTGUI_TOPLEVEL(wnd->title), &eclip); - rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(wnd->title)); - rtgui_region_subtract_rect(&(RTGUI_WIDGET(wnd->title)->clip), - &(RTGUI_WIDGET(wnd->title)->clip), - &(wnd->extent)); + if (wnd->title != RT_NULL) + { + rtgui_toplevel_handle_clip(RTGUI_TOPLEVEL(wnd->title), &eclip); + rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(wnd->title)); + rtgui_region_subtract_rect(&(RTGUI_WIDGET(wnd->title)->clip), + &(RTGUI_WIDGET(wnd->title)->clip), + &(wnd->extent)); + } } rtgui_topwin_activate_win(topwin); @@ -356,11 +359,14 @@ void rtgui_topwin_raise(struct rtgui_win* wid, rt_thread_t sender) rtgui_thread_send(topwin->tid, &(eclip->parent), sizeof(struct rtgui_event_clip_info)); /* reset clip info in title */ - rtgui_toplevel_handle_clip(RTGUI_TOPLEVEL(topwin->title), eclip); - rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(topwin->title)); - rtgui_region_subtract_rect(&(RTGUI_WIDGET(topwin->title)->clip), - &(RTGUI_WIDGET(topwin->title)->clip), - &(topwin->extent)); + if (topwin->title != RT_NULL) + { + rtgui_toplevel_handle_clip(RTGUI_TOPLEVEL(topwin->title), eclip); + rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(topwin->title)); + rtgui_region_subtract_rect(&(RTGUI_WIDGET(topwin->title)->clip), + &(RTGUI_WIDGET(topwin->title)->clip), + &(topwin->extent)); + } rect = RTGUI_EVENT_GET_RECT(eclip, 0); *rect = (topwin->title != RT_NULL)? RTGUI_WIDGET(topwin->title)->extent : topwin->extent; @@ -381,11 +387,14 @@ void rtgui_topwin_raise(struct rtgui_win* wid, rt_thread_t sender) sizeof(struct rtgui_event_clip_info) + count * sizeof(struct rtgui_rect)); /* reset clip info in title */ - rtgui_toplevel_handle_clip(RTGUI_TOPLEVEL(wnd->title), eclip); - rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(wnd->title)); - rtgui_region_subtract_rect(&(RTGUI_WIDGET(wnd->title)->clip), - &(RTGUI_WIDGET(wnd->title)->clip), - &(wnd->extent)); + if (wnd->title != RT_NULL) + { + rtgui_toplevel_handle_clip(RTGUI_TOPLEVEL(wnd->title), eclip); + rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(wnd->title)); + rtgui_region_subtract_rect(&(RTGUI_WIDGET(wnd->title)->clip), + &(RTGUI_WIDGET(wnd->title)->clip), + &(wnd->extent)); + } rect = RTGUI_EVENT_GET_RECT(eclip, count++); *rect = (wnd->title != RT_NULL)? RTGUI_WIDGET(wnd->title)->extent : wnd->extent;