static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc) { rtgui_widget_t* owner; if (dc == RT_NULL || dc->type != RTGUI_DC_CLIENT) return RT_FALSE; /* get owner */ owner = RTGUI_CONTAINER_OF(dc, struct rtgui_widget, dc_type); if (RTGUI_IS_WINTITLE(owner->toplevel)) { /* update title extent */ rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel); top->drawing --; if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner)) { #ifdef __WIN32__ #ifdef RTGUI_USING_MOUSE_CURSOR rt_mutex_release(&cursor_mutex); /* show cursor */ rtgui_mouse_show_cursor(); rt_kprintf("show cursor\n"); #endif /* update screen */ rtgui_graphic_driver_screen_update(hw_driver, &(owner->extent)); #else #ifdef RTGUI_USING_MOUSE_CURSOR /* show cursor */ rtgui_mouse_show_cursor(); #endif /* update screen */ rtgui_graphic_driver_screen_update(hw_driver, &(owner->extent)); #endif } } else if (RTGUI_IS_WORKBENCH(owner->toplevel) || RTGUI_IS_WIN(owner->toplevel)) { rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel); top->drawing --; if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner)) { #ifdef __WIN32__ #ifdef RTGUI_USING_MOUSE_CURSOR rt_mutex_release(&cursor_mutex); /* show cursor */ rtgui_mouse_show_cursor(); rt_kprintf("show cursor\n"); #endif /* update screen */ rtgui_graphic_driver_screen_update(hw_driver, &(owner->extent)); #else /* send to server to end drawing */ struct rtgui_event_update_end eupdate; RTGUI_EVENT_UPDATE_END_INIT(&(eupdate)); eupdate.rect = owner->extent; rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate)); #endif } } return RT_TRUE; }
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc) { rtgui_widget_t* owner; struct rtgui_dc_hw* self; if (dc == RT_NULL || dc->type != RTGUI_DC_HW) return RT_FALSE; self = (struct rtgui_dc_hw*)dc; /* get owner */ owner = self->owner; if (RTGUI_IS_WINTITLE(owner->toplevel)) { /* update title extent */ rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel); top->drawing --; if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner)) { #ifdef _WIN32 #ifdef RTGUI_USING_MOUSE_CURSOR rt_mutex_release(&cursor_mutex); /* show cursor */ rtgui_mouse_show_cursor(); rt_kprintf("show cursor\n"); #endif /* update screen */ rtgui_graphic_driver_screen_update(self->hw_driver, &(owner->extent)); #else #ifdef RTGUI_USING_MOUSE_CURSOR /* show cursor */ rtgui_mouse_show_cursor(); #endif /* update screen */ rtgui_graphic_driver_screen_update(self->hw_driver, &(owner->extent)); #endif } } else if (RTGUI_IS_APPLICATION(owner->toplevel) || RTGUI_IS_WIN(owner->toplevel)) { rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel); top->drawing --; if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner)) { #ifdef _WIN32 #ifdef RTGUI_USING_MOUSE_CURSOR rt_mutex_release(&cursor_mutex); /* show cursor */ rtgui_mouse_show_cursor(); rt_kprintf("show cursor\n"); #endif /* update screen */ rtgui_graphic_driver_screen_update(self->hw_driver, &(owner->extent)); #else /* send to server to end drawing */ struct rtgui_event_update_end eupdate; RTGUI_EVENT_UPDATE_END_INIT(&(eupdate)); eupdate.rect = owner->extent; rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate)); #endif } } /* release hardware dc */ rtgui_free(self); return RT_TRUE; }