diff --git a/include/nana/gui/detail/window_manager.hpp b/include/nana/gui/detail/window_manager.hpp index b04c32dc..0b1f51c9 100644 --- a/include/nana/gui/detail/window_manager.hpp +++ b/include/nana/gui/detail/window_manager.hpp @@ -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&); diff --git a/source/gui/detail/bedrock_posix.cpp b/source/gui/detail/bedrock_posix.cpp index a7e20ee4..052a61aa 100644 --- a/source/gui/detail/bedrock_posix.cpp +++ b/source/gui/detail/bedrock_posix.cpp @@ -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; diff --git a/source/gui/detail/bedrock_windows.cpp b/source/gui/detail/bedrock_windows.cpp index 8f5a319e..bf1b5c28 100644 --- a/source/gui/detail/bedrock_windows.cpp +++ b/source/gui/detail/bedrock_windows.cpp @@ -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; diff --git a/source/gui/detail/window_manager.cpp b/source/gui/detail/window_manager.cpp index 4aa19757..6096d543 100644 --- a/source/gui/detail/window_manager.cpp +++ b/source/gui/detail/window_manager.cpp @@ -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 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;