summaryrefslogtreecommitdiff
path: root/components/gui/src
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-01-02 13:52:55 +0800
committerGitHub <[email protected]>2018-01-02 13:52:55 +0800
commit7678659b2f85a125f02d58ba33a7ef35ec0a9e4b (patch)
treeba4b4c7f1374b96649ab75b0eaca647f8ca9d11b /components/gui/src
parenta2b0ec84eeb09a69958f438edb4ea8faf869a826 (diff)
parentc4e8c922d38ad213c92ae130dbc5f0890f98dd79 (diff)
Merge pull request #1155 from yangfasheng/master
gui 引擎优化提交
Diffstat (limited to 'components/gui/src')
-rw-r--r--components/gui/src/dc.c22
-rw-r--r--components/gui/src/dc_hw.c10
-rw-r--r--components/gui/src/font_bmp.c2
-rw-r--r--components/gui/src/font_freetype.c74
-rw-r--r--components/gui/src/rtgui_app.c102
-rw-r--r--components/gui/src/topwin.c23
-rw-r--r--components/gui/src/topwin.h3
-rw-r--r--components/gui/src/window.c6
8 files changed, 161 insertions, 81 deletions
diff --git a/components/gui/src/dc.c b/components/gui/src/dc.c
index 004195a43f..849f05bb28 100644
--- a/components/gui/src/dc.c
+++ b/components/gui/src/dc.c
@@ -324,9 +324,9 @@ void rtgui_dc_draw_text(struct rtgui_dc *dc, const char *text, struct rtgui_rect
}
len = strlen((const char *)text);
- if (len == 0)
- return;
-
+ if (len == 0)
+ return;
+
rtgui_font_draw(font, dc, text, len, rect);
}
RTM_EXPORT(rtgui_dc_draw_text);
@@ -1689,6 +1689,13 @@ void rtgui_dc_get_rect(struct rtgui_dc *dc, rtgui_rect_t *rect)
dc_hw = (struct rtgui_dc_hw *) dc;
owner = dc_hw->owner;
rtgui_widget_get_rect(owner, rect);
+
+ if (owner->extent.x1 + rect->x2 > dc_hw->hw_driver->width)
+ rect->x2 = dc_hw->hw_driver->width - owner->extent.x1;
+
+ if (owner->extent.y1 + rect->y2 > dc_hw->hw_driver->height)
+ rect->y2 = dc_hw->hw_driver->height - owner->extent.y1;
+
break;
}
case RTGUI_DC_BUFFER:
@@ -1806,7 +1813,7 @@ extern void rtgui_mouse_hide_cursor(void);
struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner)
{
struct rtgui_dc *dc;
- struct rtgui_widget *widget;
+ struct rtgui_widget *widget, *parent;
struct rtgui_win *win;
RT_ASSERT(owner != RT_NULL);
@@ -1815,11 +1822,18 @@ struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner)
if (win == RT_NULL)
return RT_NULL;
+ parent = (struct rtgui_widget *)win;
+
if (!(win->flag & RTGUI_WIN_FLAG_ACTIVATE) &&
(win->outer_clip.extents.x1 == win->outer_clip.extents.x2 ||
win->outer_clip.extents.y1 == win->outer_clip.extents.y2))
return RT_NULL;
+ if (!(win->flag & RTGUI_WIN_FLAG_ACTIVATE) &&
+ (parent->clip.extents.x1 == parent->clip.extents.x2 ||
+ parent->clip.extents.y1 == parent->clip.extents.y2))
+ return RT_NULL;
+
/* increase drawing count */
if (win->drawing == 0)
{
diff --git a/components/gui/src/dc_hw.c b/components/gui/src/dc_hw.c
index 2af8ae94cf..dfed6f8e9f 100644
--- a/components/gui/src/dc_hw.c
+++ b/components/gui/src/dc_hw.c
@@ -216,32 +216,22 @@ static void rtgui_dc_hw_fill_rect(struct rtgui_dc *self, struct rtgui_rect *rect
return;
if (x1 < dc->owner->extent.x1)
x1 = dc->owner->extent.x1;
- if (x1 < 0)
- x1 = 0;
-
x2 = rect->x2 + dc->owner->extent.x1;
if (x2 < dc->owner->extent.x1)
return;
if (x2 > dc->owner->extent.x2)
x2 = dc->owner->extent.x2;
- if (x2 > dc->hw_driver->width)
- x2 = dc->hw_driver->width;
y1 = rect->y1 + dc->owner->extent.y1;
if (y1 > dc->owner->extent.y2)
return;
if (y1 < dc->owner->extent.y1)
y1 = dc->owner->extent.y1;
- if (y1 < 0)
- y1 = 0;
-
y2 = rect->y2 + dc->owner->extent.y1;
if (y2 < dc->owner->extent.y1)
return;
if (y2 > dc->owner->extent.y2)
y2 = dc->owner->extent.y2;
- if (y2 > dc->hw_driver->height)
- y2 = dc->hw_driver->height;
/* fill rect */
for (; y1 < y2; y1++)
diff --git a/components/gui/src/font_bmp.c b/components/gui/src/font_bmp.c
index 1aba5c34b4..52e12c81a5 100644
--- a/components/gui/src/font_bmp.c
+++ b/components/gui/src/font_bmp.c
@@ -103,7 +103,7 @@ static void rtgui_bitmap_font_draw_text(struct rtgui_font *font, struct rtgui_dc
RT_ASSERT(bmp_font != RT_NULL);
- rtgui_font_get_metrics(rtgui_dc_get_gc(dc)->font, text, &text_rect);
+ rtgui_font_get_metrics(font, text, &text_rect);
rtgui_rect_move_to_align(rect, &text_rect, RTGUI_DC_TEXTALIGN(dc));
/* parameter check */
diff --git a/components/gui/src/font_freetype.c b/components/gui/src/font_freetype.c
index c4f5993791..0ec954945e 100644
--- a/components/gui/src/font_freetype.c
+++ b/components/gui/src/font_freetype.c
@@ -275,12 +275,12 @@ static void _rtgui_rect_move_to_align(const rtgui_rect_t *rect, rtgui_rect_t *to
to->x1 += dw;
to->x2 += dw;
}
- /* align to center horizontal */
- else if (align & RTGUI_ALIGN_CENTER_HORIZONTAL)
- {
- to->x1 += dw >> 1;
- to->x2 += dw >> 1;
- }
+ /* align to center horizontal */
+ else if (align & RTGUI_ALIGN_CENTER_HORIZONTAL)
+ {
+ to->x1 += dw >> 1;
+ to->x2 += dw >> 1;
+ }
/* align to bottom */
if (align & RTGUI_ALIGN_BOTTOM)
@@ -393,7 +393,7 @@ static void _get_metrics(struct rtgui_ttf_font *ttf_font, const rt_uint16_t *tex
static void _draw_bitmap(struct rtgui_dc *dc,
FTC_SBit bitmap,
rt_int16_t ox, rt_int16_t btm_y,
- rt_uint8_t a, rt_uint8_t r, rt_uint8_t g, rt_uint8_t b)
+ rtgui_color_t fgc, rt_uint16_t right, rt_uint16_t bottom)
{
rt_int16_t x_start, y_start;
struct rtgui_blit_info info = { 0 };
@@ -403,10 +403,12 @@ static void _draw_bitmap(struct rtgui_dc *dc,
x_start = ox + bitmap->left;
y_start = btm_y - bitmap->top;
- info.a = a;
- info.r = r;
- info.g = g;
- info.b = b;
+ PINFO(" draw bitmap (x, y) -> (%d, %d)\n", x_start, y_start);
+
+ info.a = RTGUI_RGB_A(fgc);
+ info.r = RTGUI_RGB_R(fgc);
+ info.g = RTGUI_RGB_G(fgc);
+ info.b = RTGUI_RGB_B(fgc);
if (dc->type == RTGUI_DC_HW)
{
@@ -444,18 +446,22 @@ static void _draw_bitmap(struct rtgui_dc *dc,
}
else if (dc->type == RTGUI_DC_BUFFER)
{
+ int max_right, max_bottom;
+
dest_buf = (struct rtgui_dc_buffer*)dc;
+ max_right = right > dest_buf->width ? dest_buf->width : right;
+ max_bottom = bottom > dest_buf->height ? dest_buf->height : bottom;
if (x_start + bitmap->width < 0 || y_start + bitmap->height < 0
- || x_start > dest_buf->width || y_start > dest_buf->height)
+ || x_start > max_right || y_start > max_bottom)
return;
/* blit source */
info.src = (rt_uint8_t *)bitmap->buffer;
info.src = info.src + (y_start > 0 ? 0 : -y_start) * bitmap->width + (x_start > 0 ? 0 : -x_start);
info.src_fmt = RTGRAPHIC_PIXEL_FORMAT_ALPHA;
- info.src_w = bitmap->width - (x_start > 0 ? 0 : -x_start) - (x_start + bitmap->width < dest_buf->width ? 0 : x_start + bitmap->width - dest_buf->width);
- info.src_h = bitmap->height - (y_start > 0 ? 0 : -y_start) - (y_start + bitmap->height < dest_buf->height ? 0 : y_start + bitmap->height - dest_buf->height);
+ info.src_w = bitmap->width - (x_start > 0 ? 0 : -x_start) - (x_start + bitmap->width < max_right ? 0 : x_start + bitmap->width - max_right);
+ info.src_h = bitmap->height - (y_start > 0 ? 0 : -y_start) - (y_start + bitmap->height < max_bottom ? 0 : y_start + bitmap->height - max_bottom);
info.src_pitch = bitmap->width;
info.src_skip = info.src_pitch - info.src_w;
@@ -473,7 +479,13 @@ static void _draw_bitmap(struct rtgui_dc *dc,
{
struct rtgui_rect text_rect;
struct rtgui_point dc_point = { 0, 0 };
- struct rtgui_dc *text_dc = rtgui_dc_buffer_create_pixformat(RTGRAPHIC_PIXEL_FORMAT_ARGB888, bitmap->width, bitmap->height);
+ struct rtgui_dc *text_dc;
+
+ if (x_start + bitmap->width < 0 || y_start + bitmap->height < 0
+ || x_start > right || y_start > bottom)
+ return;
+
+ text_dc = rtgui_dc_buffer_create_pixformat(RTGRAPHIC_PIXEL_FORMAT_ARGB888, bitmap->width, bitmap->height);
if (text_dc)
{
dest_buf = (struct rtgui_dc_buffer*)text_dc;
@@ -503,7 +515,7 @@ static void _draw_bitmap(struct rtgui_dc *dc,
text_rect.y1 = y_start;
text_rect.y2 = text_rect.y1 + bitmap->height;
- rtgui_dc_buffer_set_alpha(text_dc, a);
+ rtgui_dc_buffer_set_alpha(text_dc, RTGUI_RGB_A(fgc));
rtgui_dc_blit(text_dc, &dc_point, dc, &text_rect);
rtgui_dc_destory(text_dc);
@@ -515,7 +527,7 @@ static void _draw_text(struct rtgui_dc *dc,
struct rtgui_ttf_font *ttf_font,
rt_uint16_t *text_short,
rt_int16_t begin_x, rt_int16_t btm_y,
- rt_uint8_t a, rt_uint8_t r, rt_uint8_t g, rt_uint8_t b)
+ rtgui_color_t fgc, rt_uint16_t right, rt_uint16_t bottom)
{
int glyphIndex;
FTC_SBit ftcSBit = RT_NULL;
@@ -531,7 +543,7 @@ static void _draw_text(struct rtgui_dc *dc,
/* render font */
begin_x -= (ftcSBit->left - (abs(ftcSBit->left) + 2) / 2);
- _draw_bitmap(dc, ftcSBit, begin_x, btm_y, a, r, g, b);
+ _draw_bitmap(dc, ftcSBit, begin_x, btm_y, fgc, right, bottom);
begin_x += ftcSBit->width + ftcSBit->left;
@@ -594,10 +606,6 @@ static void ftc_draw_text(struct rtgui_font *font,
#endif
fgc = RTGUI_DC_FC(dc);
- a = RTGUI_RGB_A(fgc);
- r = RTGUI_RGB_R(fgc);
- g = RTGUI_RGB_G(fgc);
- b = RTGUI_RGB_B(fgc);
/* text align */
_get_metrics(ttf_font, text_short, &text_rect);
@@ -633,7 +641,7 @@ static void ftc_draw_text(struct rtgui_font *font,
goto _out;
}
- _draw_text(dc, ttf_font, text_short, begin_x, btm_y, a, r, g, b);
+ _draw_text(dc, ttf_font, text_short, begin_x, btm_y, fgc, rect->x2, rect->y2);
_out:
/* release unicode buffer */
@@ -698,9 +706,9 @@ static void ftc_get_metrics(struct rtgui_font *font, const char *text, struct rt
RT_ASSERT(ttf_font != RT_NULL);
len = strlen(text);
- if (len == 0)
- return;
-
+ if (len == 0)
+ return;
+
memset(rect, 0, sizeof(struct rtgui_rect));
/* allocate unicode buffer */
@@ -717,7 +725,7 @@ static void ftc_get_metrics(struct rtgui_font *font, const char *text, struct rt
#else
rt_memset(text_short, 0x00, (utf8_to_unicode_len(text, len) + 1) * 2);
#endif
-
+
/* convert gbk to unicode */
#ifndef UTF8_TO_UNICODE
gbk_to_unicode(text_short, text, len);
@@ -775,7 +783,7 @@ static struct rtgui_ttf *rtgui_ttf_load(const char *filename)
return RT_NULL;
}
}
-
+
/* face_id init */
ttf->face_id.pathname = rt_strdup(filename);
ttf->face_id.face_index = 0;
@@ -847,11 +855,11 @@ rtgui_font_t *rtgui_freetype_font_create(const char *filename, rt_size_t size)
font = rtgui_font_refer(filename, size);
if (font)
{
- if (font->height == size)
- return font;
- else
- rtgui_font_derefer(font);
- }
+ if (font->height == size)
+ return font;
+ else
+ rtgui_font_derefer(font);
+ }
}
font = (struct rtgui_font *)rtgui_malloc(sizeof(struct rtgui_font) + sizeof(struct rtgui_ttf_font));
diff --git a/components/gui/src/rtgui_app.c b/components/gui/src/rtgui_app.c
index 9878ff4ea7..c7210c12c4 100644
--- a/components/gui/src/rtgui_app.c
+++ b/components/gui/src/rtgui_app.c
@@ -29,7 +29,7 @@
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_app.h>
#include <rtgui/widgets/window.h>
-#include "topwin.h"
+#include <topwin.h>
static void _rtgui_app_constructor(struct rtgui_app *app)
{
@@ -43,6 +43,7 @@ static void _rtgui_app_constructor(struct rtgui_app *app)
app->state_flag = RTGUI_APP_FLAG_EXITED;
app->ref_count = 0;
app->window_cnt = 0;
+ app->win_acti_cnt = 0;
app->exit_code = 0;
app->tid = RT_NULL;
app->mq = RT_NULL;
@@ -203,11 +204,11 @@ rt_inline rt_bool_t _rtgui_application_dest_handle(
if (wevent->wid == RT_NULL)
return RT_FALSE;
-
- if (wevent->wid->magic != 0xA5A55A5A)
- {
- return RT_FALSE;
- }
+
+ if (wevent->wid->magic != RTGUI_WIN_MAGIC)
+ {
+ return RT_FALSE;
+ }
/* this window has been closed. */
if (wevent->wid != RT_NULL && wevent->wid->flag & RTGUI_WIN_FLAG_CLOSED)
@@ -249,19 +250,55 @@ rt_bool_t rtgui_app_event_handler(struct rtgui_object *object, rtgui_event_t *ev
switch (event->type)
{
- case RTGUI_EVENT_PAINT:
- case RTGUI_EVENT_VPAINT_REQ:
+ case RTGUI_EVENT_KBD:
+ {
+ struct rtgui_event_kbd *kbd = (struct rtgui_event_kbd*)event;
+
+ if (kbd->win_acti_cnt != app->win_acti_cnt)
+ break;
+
+ _rtgui_application_dest_handle(app, event);
+ }
+ break;
+
case RTGUI_EVENT_MOUSE_BUTTON:
case RTGUI_EVENT_MOUSE_MOTION:
- case RTGUI_EVENT_CLIP_INFO:
+ {
+ struct rtgui_event_mouse *wevent = (struct rtgui_event_mouse *)event;
+
+ if (wevent->win_acti_cnt != app->win_acti_cnt)
+ break;
+
+ _rtgui_application_dest_handle(app, event);
+ }
+ break;
+
+ case RTGUI_EVENT_GESTURE:
+ {
+ struct rtgui_event_gesture *wevent = (struct rtgui_event_gesture *)event;
+
+ if (wevent->win_acti_cnt != app->win_acti_cnt)
+ break;
+
+ _rtgui_application_dest_handle(app, event);
+ }
+ break;
+
case RTGUI_EVENT_WIN_ACTIVATE:
+ {
+ app->win_acti_cnt++;
+ _rtgui_application_dest_handle(app, event);
+ }
+ break;
+
+ case RTGUI_EVENT_PAINT:
+ case RTGUI_EVENT_VPAINT_REQ:
+ case RTGUI_EVENT_CLIP_INFO:
case RTGUI_EVENT_WIN_DEACTIVATE:
case RTGUI_EVENT_WIN_CLOSE:
case RTGUI_EVENT_WIN_MOVE:
case RTGUI_EVENT_WIN_SHOW:
case RTGUI_EVENT_WIN_HIDE:
- case RTGUI_EVENT_KBD:
- case RTGUI_EVENT_GESTURE:
_rtgui_application_dest_handle(app, event);
break;
@@ -284,14 +321,14 @@ rt_bool_t rtgui_app_event_handler(struct rtgui_object *object, rtgui_event_t *ev
case RTGUI_EVENT_TIMER:
{
- rt_base_t level;
+ rt_base_t level;
struct rtgui_timer *timer;
struct rtgui_event_timer *etimer = (struct rtgui_event_timer *) event;
timer = etimer->timer;
- level = rt_hw_interrupt_disable();
+ level = rt_hw_interrupt_disable();
timer->pending_cnt--;
- rt_hw_interrupt_enable(level);
+ rt_hw_interrupt_enable(level);
RT_ASSERT(timer->pending_cnt >= 0);
if (timer->state == RTGUI_TIMER_ST_DESTROY_PENDING)
{
@@ -320,21 +357,21 @@ rt_bool_t rtgui_app_event_handler(struct rtgui_object *object, rtgui_event_t *ev
if (ecmd->wid != RT_NULL)
return _rtgui_application_dest_handle(app, event);
- else
- {
- struct rtgui_topwin *wnd;
+ else
+ {
+ struct rtgui_topwin *wnd;
- wnd = rtgui_topwin_get_focus();
- if (wnd != RT_NULL)
- {
- RT_ASSERT(wnd->flag & WINTITLE_ACTIVATE)
+ wnd = rtgui_topwin_get_focus();
+ if (wnd != RT_NULL)
+ {
+ RT_ASSERT(wnd->flag & WINTITLE_ACTIVATE)
- /* send to focus window */
- ecmd->wid = wnd->wid;
+ /* send to focus window */
+ ecmd->wid = wnd->wid;
- return _rtgui_application_dest_handle(app, event);
- }
- }
+ return _rtgui_application_dest_handle(app, event);
+ }
+ }
}
default:
return rtgui_object_event_handler(object, event);
@@ -507,3 +544,16 @@ struct rtgui_win *rtgui_app_get_main_win(struct rtgui_app *app)
}
RTM_EXPORT(rtgui_app_get_main_win);
+unsigned int rtgui_app_get_win_acti_cnt(void)
+{
+ struct rtgui_app *app = rtgui_topwin_app_get_focus();
+
+ if (app)
+ {
+ return app->win_acti_cnt;
+ }
+
+ return 0;
+}
+RTM_EXPORT(rtgui_app_get_win_acti_cnt);
+
diff --git a/components/gui/src/topwin.c b/components/gui/src/topwin.c
index fe379be60b..91719e0c99 100644
--- a/components/gui/src/topwin.c
+++ b/components/gui/src/topwin.c
@@ -764,7 +764,7 @@ rt_err_t rtgui_topwin_move(struct rtgui_event_win_move *event)
old_rect = topwin->extent;
/* move window rect */
- rtgui_rect_move(&(topwin->extent), dx, dy);
+ rtgui_rect_move(&(topwin->extent), dx, dy);
/* move the monitor rect list */
rtgui_list_foreach(node, &(topwin->monitor_list))
@@ -772,7 +772,7 @@ rt_err_t rtgui_topwin_move(struct rtgui_event_win_move *event)
struct rtgui_mouse_monitor *monitor = rtgui_list_entry(node,
struct rtgui_mouse_monitor,
list);
- rtgui_rect_move(&(monitor->rect), dx, dy);
+ rtgui_rect_move(&(monitor->rect), dx, dy);
}
/* update windows clip info */
@@ -853,6 +853,19 @@ struct rtgui_topwin *rtgui_topwin_get_focus(void)
return _rtgui_topwin_get_focus_from_list(&_rtgui_topwin_list);
}
+struct rtgui_app *rtgui_topwin_app_get_focus(void)
+{
+ struct rtgui_app *topwin_app = RT_NULL;
+ struct rtgui_topwin *topwin = rtgui_topwin_get_focus();
+
+ if (topwin)
+ {
+ topwin_app = topwin->app;
+ }
+
+ return topwin_app;
+}
+
static struct rtgui_topwin *_rtgui_topwin_get_wnd_from_tree(struct rt_list_node *list,
int x, int y,
rt_bool_t exclude_modaled)
@@ -978,7 +991,8 @@ static void _rtgui_topwin_redraw_tree(struct rt_list_node *list,
if (rtgui_rect_is_intersect(rect, &(topwin->extent)) == RT_EOK)
{
epaint->wid = topwin->wid;
- rtgui_send(topwin->app, &(epaint->parent), sizeof(*epaint));
+ // < XY do !!! >
+ //rtgui_send(topwin->app, &(epaint->parent), sizeof(*epaint));
}
_rtgui_topwin_redraw_tree(&topwin->child_list, rect, epaint);
@@ -1026,7 +1040,8 @@ rt_err_t rtgui_topwin_modal_enter(struct rtgui_event_win_modal_enter *event)
parent_top->flag |= WINTITLE_MODALED;
parent_top->wid->flag |= RTGUI_WIN_FLAG_UNDER_MODAL;
parent_top = parent_top->parent;
- } while (parent_top);
+ }
+ while (parent_top);
topwin->flag &= ~WINTITLE_MODALED;
topwin->wid->flag &= ~RTGUI_WIN_FLAG_UNDER_MODAL;
diff --git a/components/gui/src/topwin.h b/components/gui/src/topwin.h
index 35376f889b..1aa3a73141 100644
--- a/components/gui/src/topwin.h
+++ b/components/gui/src/topwin.h
@@ -64,6 +64,9 @@ void rtgui_topwin_remove_monitor_rect(struct rtgui_win *wid, rtgui_rect_t *rect)
/* get the topwin that is currently focused */
struct rtgui_topwin *rtgui_topwin_get_focus(void);
+/* get the topwin which app I belong */
+struct rtgui_app *rtgui_topwin_app_get_focus(void);
+
struct rtgui_topwin *rtgui_topwin_get_topmost_window_shown_all(void);
#endif
diff --git a/components/gui/src/window.c b/components/gui/src/window.c
index 2fe8ae8777..894203e337 100644
--- a/components/gui/src/window.c
+++ b/components/gui/src/window.c
@@ -41,7 +41,7 @@ static void _rtgui_win_constructor(rtgui_win_t *win)
RTGUI_WIDGET(win)->toplevel = win;
/* init win property */
- win->update = 0;
+ win->update = 0;
win->drawing = 0;
RTGUI_WIDGET(win)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
@@ -440,7 +440,7 @@ rt_base_t rtgui_win_show(struct rtgui_win *win, rt_bool_t is_modal)
{
RTGUI_WIDGET_UNHIDE(win);
- win->magic = 0xA5A55A5A;
+ win->magic = RTGUI_WIN_MAGIC;
if (is_modal)
win->flag |= RTGUI_WIN_FLAG_MODAL;
@@ -548,7 +548,7 @@ void rtgui_win_move(struct rtgui_win *win, int x, int y)
dy = y - wgt->extent.y1;
rtgui_widget_move_to_logic(wgt, dx, dy);
}
- rtgui_rect_move(&win->outer_extent, dx, dy);
+ rtgui_rect_move(&win->outer_extent, dx, dy);
if (win->flag & RTGUI_WIN_FLAG_CONNECTED)
{