summaryrefslogtreecommitdiff
path: root/components/rtgui/common/dc_client.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-04-18 15:06:12 +0000
committer[email protected] <[email protected]>2012-04-18 15:06:12 +0000
commitdb0646020812efc16ff0beebe35f9049dcc2bfed (patch)
tree5e949e9ba679a07b0198745853e900a016a3834e /components/rtgui/common/dc_client.c
parent06d45f0c42f2aa3678d509403fcf9cd82be106e6 (diff)
merge new RTGUI in to trunk
The full log is at https://github.com/RTGUI/RTGUI/commits/merge_1 and it's difficult to merge the new tree commit by commit. I also converted all the file into unix eol so there are many fake diff. Big changes are noted in rtgui/doc/road_map.txt and rtgui/doc/attention.txt. Keep an eye on them if you want to migrate your old code. Note that the work is still in progress and the bsp is not prepared in trunk so far. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2092 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/common/dc_client.c')
-rw-r--r--components/rtgui/common/dc_client.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/components/rtgui/common/dc_client.c b/components/rtgui/common/dc_client.c
index 244de209a4..22d2887095 100644
--- a/components/rtgui/common/dc_client.c
+++ b/components/rtgui/common/dc_client.c
@@ -21,9 +21,10 @@
#include <rtgui/driver.h>
#include <rtgui/rtgui_system.h>
-#include <rtgui/widgets/view.h>
+#include <rtgui/rtgui_application.h>
+#include <rtgui/rtgui_server.h>
+#include <rtgui/widgets/container.h>
#include <rtgui/widgets/window.h>
-#include <rtgui/widgets/workbench.h>
#include <rtgui/widgets/title.h>
static void rtgui_dc_client_draw_point(struct rtgui_dc* dc, int x, int y);
@@ -48,14 +49,11 @@ struct rtgui_dc* rtgui_dc_begin_drawing(rtgui_widget_t* owner)
{
RT_ASSERT(owner != RT_NULL);
- if ((rtgui_region_is_flat(&owner->clip) == RT_EOK) &&
+ if ((rtgui_region_is_flat(&owner->clip) == RT_EOK) &&
rtgui_rect_is_equal(&(owner->extent), &(owner->clip.extents)) == RT_EOK)
- {
- /* use hardware DC */
return rtgui_dc_hw_create(owner);
- }
-
- return rtgui_dc_client_create(owner);
+ else
+ return rtgui_dc_client_create(owner);
}
void rtgui_dc_end_drawing(struct rtgui_dc* dc)
@@ -63,7 +61,7 @@ void rtgui_dc_end_drawing(struct rtgui_dc* dc)
dc->engine->fini(dc);
}
-const struct rtgui_dc_engine dc_client_engine =
+const struct rtgui_dc_engine dc_client_engine =
{
rtgui_dc_client_draw_point,
rtgui_dc_client_draw_color_point,
@@ -116,7 +114,7 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
if (RTGUI_WIDGET_IS_HIDE(widget))
{
RTGUI_WIDGET_DC_SET_UNVISIBLE(owner);
- break;
+ return RT_NULL;
}
widget = widget->parent;
@@ -130,7 +128,7 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
if (top->drawing == 1)
{
#ifdef RTGUI_USING_MOUSE_CURSOR
-#ifdef __WIN32__
+#ifdef _WIN32
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
rtgui_mouse_hide_cursor();
@@ -141,15 +139,18 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
#endif
}
}
- else if (RTGUI_IS_WORKBENCH(owner->toplevel) ||
- RTGUI_IS_WIN(owner->toplevel))
+ else if (RTGUI_IS_APPLICATION(owner->toplevel))
+ {
+ RT_ASSERT(0);
+ }
+ else if (RTGUI_IS_WIN(owner->toplevel))
{
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
top->drawing ++;
if (top->drawing == 1)
{
-#ifdef __WIN32__
+#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
@@ -161,7 +162,7 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
RTGUI_EVENT_UPDATE_BEGIN_INIT(&(eupdate));
eupdate.rect = RTGUI_WIDGET(top)->extent;
- rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate));
+ rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
#endif
}
}
@@ -186,7 +187,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
top->drawing --;
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
{
-#ifdef __WIN32__
+#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
@@ -206,7 +207,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
#endif
}
}
- else if (RTGUI_IS_WORKBENCH(owner->toplevel) ||
+ else if (RTGUI_IS_APPLICATION(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
{
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
@@ -214,7 +215,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
{
-#ifdef __WIN32__
+#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
@@ -229,7 +230,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
eupdate.rect = owner->extent;
- rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate));
+ rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
#endif
}
}