From a559b2d8cc10d2b99f4589aef215a281f35addb8 Mon Sep 17 00:00:00 2001 From: Pr0curo Date: Wed, 16 Mar 2016 09:04:20 +0100 Subject: [PATCH 1/6] include as std::memcpy is defined in header, it is added (see http://en.cppreference.com/w/cpp/string/byte/memcpy) --- source/system/dataexch.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/system/dataexch.cpp b/source/system/dataexch.cpp index d229dea0..cb8ecb97 100644 --- a/source/system/dataexch.cpp +++ b/source/system/dataexch.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #if defined(NANA_WINDOWS) #include From bb53c4c1ecfb422201e20a22ed4e0228ea264347 Mon Sep 17 00:00:00 2001 From: Pr0curo Date: Wed, 16 Mar 2016 09:16:55 +0100 Subject: [PATCH 2/6] correct workaround for missing thread support the Workaround from MeganZ (I suppose you refere to this one: https://github.com/meganz/mingw-std-threads) hast some flaws: is not available, is not available and EPROTO is already defined (but with 53 instead of 71) --- CMakeLists.txt | 1 + include/nana/std_mutex.hpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b622422..46315d96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,6 +109,7 @@ if(WIN32) if(MINGW) if(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) + add_definitions(-DSTD_THREAD_NOT_SUPPORTED) add_definitions(-DNANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) endif(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) endif(MINGW) diff --git a/include/nana/std_mutex.hpp b/include/nana/std_mutex.hpp index b508548e..38c07aaf 100644 --- a/include/nana/std_mutex.hpp +++ b/include/nana/std_mutex.hpp @@ -8,12 +8,12 @@ #include #include #include -#include -#include +//#include +//#include #include #include // http://lxr.free-electrons.com/source/include/uapi/asm-generic/errno.h#L53 -#define EPROTO 71 /* Protocol error */ +//#define EPROTO 71 /* Protocol error */ #include #include #else From 6540142e29e489b03fc1571167dcce2875e86fe0 Mon Sep 17 00:00:00 2001 From: Pr0curo Date: Wed, 16 Mar 2016 09:24:22 +0100 Subject: [PATCH 3/6] change includes using the right includes to avoid the mess with the missing threading library support of mingw --- source/gui/wvl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/gui/wvl.cpp b/source/gui/wvl.cpp index 6877ef41..8942fb17 100644 --- a/source/gui/wvl.cpp +++ b/source/gui/wvl.cpp @@ -13,8 +13,9 @@ #include #include -#include +#include #include +#include //#define NANA_AUTOMATIC_GUI_TESTING namespace nana From 238e298bc420f3704790e1a41d6d5b262b12082c Mon Sep 17 00:00:00 2001 From: Pr0curo Date: Wed, 16 Mar 2016 09:34:16 +0100 Subject: [PATCH 4/6] add include --- include/nana/std_thread.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/nana/std_thread.hpp b/include/nana/std_thread.hpp index f3cf4bc0..e1df7ef7 100644 --- a/include/nana/std_thread.hpp +++ b/include/nana/std_thread.hpp @@ -5,6 +5,7 @@ #if defined(STD_THREAD_NOT_SUPPORTED) #if defined(NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) + #include #else #include @@ -13,5 +14,11 @@ namespace std typedef boost::thread thread; } #endif // (NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) + +#else + +#include + #endif // (STD_THREAD_NOT_SUPPORTED) + #endif // NANA_STD_THREAD_HPP From 46d06d3ee66764dca610bd39fa358402fbc6c084 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 23 Mar 2016 15:31:13 +0800 Subject: [PATCH 5/6] fix a datetime issue --- source/datetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/datetime.cpp b/source/datetime.cpp index 21cfe962..d633090d 100644 --- a/source/datetime.cpp +++ b/source/datetime.cpp @@ -57,7 +57,7 @@ namespace nana } date::date() - : value_(to_dateval(*std::localtime(nullptr))) + : value_(to_dateval(localtime())) { } From c0e4a16880708ddac01ebbdcc7ae687b225b17cc Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 23 Mar 2016 15:33:30 +0800 Subject: [PATCH 6/6] fix listbox enable_single crash(#121) --- source/gui/widgets/listbox.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 56eff953..ad043f56 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -3435,6 +3435,9 @@ namespace nana if (lister.forward(essence_->scroll.offset_y_dpl, ptr_where.second, item_pos)) { auto * item_ptr = (item_pos.is_item() ? &lister.at(item_pos) : nullptr); + + const index_pair abs_item_pos{ item_pos.cat, lister.absolute(item_pos) }; + if(ptr_where.first == parts::lister) { bool sel = true; @@ -3443,28 +3446,32 @@ namespace nana if (arg.shift) lister.select_display_range(lister.last_selected_abs , item_pos, sel); else if (arg.ctrl) - sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected(); + sel = !item_proxy(essence_, abs_item_pos).selected(); else lister.select_for_all(false); //cancel all selections } else - sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected(); + { + //Clicking on a category is ignored when single selection is enabled. + //Fixed by Greentwip(issue #121) + if (item_ptr) + sel = !item_proxy(essence_, abs_item_pos).selected(); + } if(item_ptr) { item_ptr->flags.selected = sel; - index_pair last_selected(item_pos.cat, lister.absolute(item_pos)); - arg_listbox arg{item_proxy{essence_, last_selected}, sel}; + arg_listbox arg{ item_proxy{ essence_, abs_item_pos }, sel }; lister.wd_ptr()->events().selected.emit(arg); if (item_ptr->flags.selected) { - lister.cancel_others_if_single_enabled(true, last_selected); - essence_->lister.last_selected_abs = last_selected; + lister.cancel_others_if_single_enabled(true, abs_item_pos); + essence_->lister.last_selected_abs = abs_item_pos; } - else if (essence_->lister.last_selected_abs == last_selected) + else if (essence_->lister.last_selected_abs == abs_item_pos) essence_->lister.last_selected_abs.set_both(npos); } else if(!lister.single_selection()) @@ -3475,13 +3482,11 @@ namespace nana if(item_ptr) { item_ptr->flags.checked = ! item_ptr->flags.checked; - - index_pair abs_pos{ item_pos.cat, lister.absolute(item_pos) }; - arg_listbox arg{ item_proxy{ essence_, abs_pos }, item_ptr->flags.checked }; + arg_listbox arg{ item_proxy{ essence_, abs_item_pos }, item_ptr->flags.checked }; lister.wd_ptr()->events().checked.emit(arg); if (item_ptr->flags.checked) - lister.cancel_others_if_single_enabled(false, abs_pos); + lister.cancel_others_if_single_enabled(false, abs_item_pos); } else if (! lister.single_check()) lister.categ_checked_reverse(item_pos.cat);