Browse Source

fix no win title issue.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@375 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 15 years ago
parent
commit
f868c8540a
3 changed files with 32 additions and 20 deletions
  1. 1 0
      rtgui/common/rtgui_theme.c
  2. 7 5
      rtgui/include/rtgui/rtgui_config.h
  3. 24 15
      rtgui/server/topwin.c

+ 1 - 0
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);

+ 7 - 5
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

+ 24 - 15
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;