From 6ee9d30445a0191364100357ddf07c75d7fd4b42 Mon Sep 17 00:00:00 2001 From: Ariel Vina-Rodriguez Date: Fri, 16 Dec 2016 14:05:06 +0100 Subject: [PATCH 1/4] Rename LICENSE_1_0.txt to LICENSE --- LICENSE_1_0.txt => LICENSE | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename LICENSE_1_0.txt => LICENSE (100%) diff --git a/LICENSE_1_0.txt b/LICENSE similarity index 100% rename from LICENSE_1_0.txt rename to LICENSE From 281e92eb590e7363c6928a8f2f44463dde9e88f0 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Tue, 27 Dec 2016 03:52:39 +0800 Subject: [PATCH 2/4] add clear() to treebox --- include/nana/gui/widgets/treebox.hpp | 3 +++ source/gui/widgets/treebox.cpp | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/nana/gui/widgets/treebox.hpp b/include/nana/gui/widgets/treebox.hpp index ae5e03b1..9901e1bf 100644 --- a/include/nana/gui/widgets/treebox.hpp +++ b/include/nana/gui/widgets/treebox.hpp @@ -421,6 +421,9 @@ namespace nana bool checkable() const; ///< Determinte whether the checkboxs are enabled. + /// Clears the contents + void clear(); + /// \brief Creates an icon scheme with the specified name. /// /// The icon scheme includes 3 images for node states. diff --git a/source/gui/widgets/treebox.cpp b/source/gui/widgets/treebox.cpp index c75aea52..76f6dc20 100644 --- a/source/gui/widgets/treebox.cpp +++ b/source/gui/widgets/treebox.cpp @@ -866,8 +866,7 @@ namespace nana item_proxy& item_proxy::check(bool ck) { trigger_->check(node_, ck ? checkstate::checked : checkstate::unchecked); - if(trigger_->draw()) - API::update_window(trigger_->impl()->data.widget_ptr->handle()); + trigger_->draw(); return *this; } @@ -1664,7 +1663,8 @@ namespace nana if (!impl_->attr.auto_draw) return false; - impl_->draw(false); + if(impl_->draw(false)) + API::update_window(impl_->data.widget_ptr->handle()); return true; } @@ -2198,6 +2198,13 @@ namespace nana return get_drawer_trigger().checkable(); } + void treebox::clear() + { + auto impl = get_drawer_trigger().impl(); + impl->attr.tree_cont.clear(); + get_drawer_trigger().draw(); + } + treebox::node_image_type& treebox::icon(const std::string& id) const { return get_drawer_trigger().icon(id); From cb2c8d6d7d7c7aa7bce2513e751a758b94fae166 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Thu, 5 Jan 2017 04:38:29 +0800 Subject: [PATCH 3/4] fix issue in graphics::paste that would show the window when graphics::paste to the invisible window --- source/paint/graphics.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/paint/graphics.cpp b/source/paint/graphics.cpp index 2114d69a..201d18a8 100644 --- a/source/paint/graphics.cpp +++ b/source/paint/graphics.cpp @@ -777,12 +777,22 @@ namespace paint ::ReleaseDC(reinterpret_cast(dst), dc); } #elif defined(NANA_X11) - Display * display = nana::detail::platform_spec::instance().open_display(); + auto & spec = nana::detail::platform_spec::instance(); + + Display * display = spec.open_display(); + + nana::detail::platform_scope_guard lock; + ::XCopyArea(display, impl_->handle->pixmap, reinterpret_cast(dst), impl_->handle->context, sx, sy, width, height, dx, dy); - ::XMapWindow(display, reinterpret_cast(dst)); + XWindowAttributes attr; + spec.set_error_handler(); + ::XGetWindowAttributes(display, reinterpret_cast(dst), &attr); + if(BadWindow != spec.rev_error_handler() && attr.map_state != IsUnmapped) + ::XMapWindow(display, reinterpret_cast(dst)); + ::XFlush(display); #endif } From ac40ee41cef1ae31b3752f007ef51a90693c35c1 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 7 Jan 2017 20:11:59 +0800 Subject: [PATCH 4/4] fix crash when use shared model(#178) --- source/gui/widgets/listbox.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 334cc5b0..ccc5e994 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -5169,25 +5169,25 @@ namespace nana internal_scope_guard lock; + auto const pos = cat_->items.size(); if (cat_->model_ptr) { es_lister::throw_if_immutable_model(cat_->model_ptr.get()); auto container = cat_->model_ptr->container(); - auto item_index = container->size(); cat_->items.emplace_back(); container->emplace_back(); - - container->assign(item_index, cells); + container->assign(pos, cells); } else { - cat_->sorted.push_back(cat_->items.size()); cells.resize(columns()); cat_->items.emplace_back(std::move(cells)); } + cat_->sorted.push_back(pos); + assign_colors_for_last(ess_, cat_); }