fix an issue that child display incorrect

This commit is contained in:
Jinhao 2016-03-14 23:20:24 +08:00
parent ea06295975
commit 8f995ee2cf
4 changed files with 20 additions and 12 deletions

View File

@ -1,7 +1,7 @@
/*
* Window Manager Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@ -129,7 +129,7 @@ namespace detail
bool update(core_window_t*, bool redraw, bool force, const rectangle* update_area = nullptr);
void refresh_tree(core_window_t*);
bool do_lazy_refresh(core_window_t*, bool force_copy_to_screen);
bool do_lazy_refresh(core_window_t*, bool force_copy_to_screen, bool refresh_tree = false);
bool get_graphics(core_window_t*, nana::paint::graphics&);
bool get_visual_rectangle(core_window_t*, nana::rectangle&);

View File

@ -389,9 +389,13 @@ namespace detail
_m_emit_core(evt_code, wd, false, arg);
if(ask_update)
wd_manager().do_lazy_refresh(wd, false);
else
//A child of wd may not be drawn if it was out of wd's range before wd resized,
//so refresh all children of wd when a resized occurs.
if(ask_update || (event_code::resized == evt_code))
{
wd_manager().do_lazy_refresh(wd, false, (event_code::resized == evt_code));
}
else if(wd_manager().available(wd))
wd->other.upd_state = core_window_t::update_state::none;
if(thrd) thrd->event_window = prev_wd;

View File

@ -1779,8 +1779,12 @@ namespace detail
_m_emit_core(evt_code, wd, false, arg);
if (ask_update)
wd_manager().do_lazy_refresh(wd, false);
//A child of wd may not be drawn if it was out of wd's range before wd resized,
//so refresh all children of wd when a resized occurs.
if (ask_update || (event_code::resized == evt_code))
{
wd_manager().do_lazy_refresh(wd, false, (event_code::resized == evt_code));
}
else if (wd_manager().available(wd))
wd->other.upd_state = basic_window::update_state::none;
@ -1790,7 +1794,7 @@ namespace detail
bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, thread_context* thrd)
{
if (bedrock_object.wd_manager().available(wd) == false)
if (wd_manager().available(wd) == false)
return false;
core_window_t* prev_event_wd;

View File

@ -1,7 +1,7 @@
/*
* Window Manager Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@ -833,7 +833,7 @@ namespace detail
//do_lazy_refresh
//@brief: defined a behavior of flush the screen
//@return: it returns true if the wnd is available
bool window_manager::do_lazy_refresh(core_window_t* wd, bool force_copy_to_screen)
bool window_manager::do_lazy_refresh(core_window_t* wd, bool force_copy_to_screen, bool refresh_tree)
{
//Thread-Safe Required!
std::lock_guard<decltype(mutex_)> lock(mutex_);
@ -848,7 +848,7 @@ namespace detail
{
if ((wd->other.upd_state == core_window_t::update_state::refresh) || force_copy_to_screen)
{
window_layer::paint(wd, false, false);
window_layer::paint(wd, false, refresh_tree);
this->map(wd, force_copy_to_screen);
}
else if (effects::edge_nimbus::none != wd->effect.edge_nimbus)
@ -857,7 +857,7 @@ namespace detail
}
}
else
window_layer::paint(wd, true, false); //only refreshing if it has an invisible parent
window_layer::paint(wd, true, refresh_tree); //only refreshing if it has an invisible parent
}
wd->other.upd_state = core_window_t::update_state::none;
return true;