diff --git a/include/nana/config.hpp b/include/nana/config.hpp index 806a0fd1..8f519e9b 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -20,40 +20,9 @@ #define NANA_WINDOWS 1 - // compilers in Windows... - - // MSVC++ versions - #if defined(_MSC_VER) - #define _SCL_SECURE_NO_WARNNGS - #define _CRT_SECURE_NO_DEPRECATE - #pragma warning(disable : 4996) - - #if (_MSC_VER == 1900) - // google: break any code that tries to use codecvt or codecvt. - // google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support. - // google: Those definitions are for codecvt::id, codecvt::id and codecvt::id respectively. - // However, the codecvt::id and codecvt::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all. - // google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources. - #define STD_CODECVT_NOT_SUPPORTED - #endif // _MSC_VER == 1900 - #endif // _MSVC - // MINGW ... #if defined(__MINGW32__) || defined(__MINGW64__) || defined(MINGW) #define NANA_MINGW - //#define STD_THREAD_NOT_SUPPORTED // don't works? why? where __GNUC__, etc. are set? by CLion ?? - //Use this flag if MinGW version is older than 4.8.1 - #if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2))) - // don't works? why? where __GNUC__, etc. are set? by CLion ?? - // ?? - #define UNDEFINED_to_string - - // https://github.com/meganz/mingw-std-threads - #define STD_THREAD_NOT_SUPPORTED - #define USE_github_com_meganz_mingw_std_threads - - #endif - #endif // MINGW // end Windows @@ -85,24 +54,52 @@ // compilers ... -// temp -//#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED // don't works? -//#define STD_CODECVT_NOT_SUPPORTED +// MSVC++ versions +#if defined(_MSC_VER) + #define _SCL_SECURE_NO_WARNNGS + #define _CRT_SECURE_NO_DEPRECATE + #pragma warning(disable : 4996) - // GCC ... - #if defined(__GNU__) - #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ <= 1) - // don't works? + #if (_MSC_VER == 1900) + // google: break any code that tries to use codecvt or codecvt. + // google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support. + // google: Those definitions are for codecvt::id, codecvt::id and codecvt::id respectively. + // However, the codecvt::id and codecvt::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all. + // google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources. + #define STD_CODECVT_NOT_SUPPORTED + #endif // _MSC_VER == 1900 +#endif // _MSVC - //GCC 4.7.0 does not implement the and codecvt_utfx classes ?? - #define STD_CODECVT_NOT_SUPPORTED +//GCC +#if defined(__GNUC__) + #if defined(__GLIBCPP__) || defined(__GLIBCXX__) + // is a known issue on libstdc++, it works on libc++ + #define STD_CODECVT_NOT_SUPPORTED + #endif - //Some functions which are specified in 21.5 Numeric conversions in Strings library have not yet implemented + #if (__GNUC__ == 4) + #if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1)) + #define STD_THREAD_NOT_SUPPORTED - //Implement workarounds for GCC/MinGW which version is below 4.8.2 + //boost.thread is preferred + //but if USE_github_com_meganz_mingw_std_threads is enabled, + //boost.thread will be replaced with meganz's mingw-std-threads. + // https://github.com/meganz/mingw-std-threads + //#define USE_github_com_meganz_mingw_std_threads + #endif + + #if defined(NANA_MINGW) + //It's a known issue under MinGW #define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED #endif - #endif // GCC + + #if ((__GNUC_MINOR__ < 8) || defined(NANA_MINGW)) + #define STD_TO_STRING_NOT_SUPPORTED + #endif + #endif +#endif + + // End compilers ... diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp index e1f15d7d..30d87935 100644 --- a/include/nana/deploy.hpp +++ b/include/nana/deploy.hpp @@ -56,8 +56,23 @@ namespace std //Workaround for no implemenation of std::stoull in MinGW. unsigned long long stoull(const std::string&, std::size_t* pos = nullptr, int base = 10); unsigned long long stoull(const std::wstring&, std::size_t* pos = nullptr, int base = 10); +} +#endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED - //Workaround for no implemenation of std::to_wstring in MinGW. +#ifdef STD_TO_STRING_NOT_SUPPORTED +namespace std +{ + //Workaround for no implemenation of std::to_string/std::to_wstring in MinGW. + std::string to_string(long double); + std::string to_string(double); + std::string to_string(unsigned); + std::string to_string(int); + std::string to_string(long); + std::string to_string(unsigned long); + std::string to_string(long long); + std::string to_string(unsigned long long); + std::string to_string(float); + std::wstring to_wstring(long double); std::wstring to_wstring(double); std::wstring to_wstring(unsigned); diff --git a/source/deploy.cpp b/source/deploy.cpp index 817721ec..ce92982a 100644 --- a/source/deploy.cpp +++ b/source/deploy.cpp @@ -294,6 +294,74 @@ namespace std *pos = (std::size_t)(end - ptr); return result; } +}//end namespace std +#endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED + +#ifdef STD_TO_STRING_NOT_SUPPORTED +namespace std +{ + std::string to_string(double v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(long double v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(unsigned v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(int v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(long v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(unsigned long v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(long long v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(unsigned long long v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(float v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } std::wstring to_wstring(double v) { diff --git a/source/gui/detail/linux_X11/bedrock.cpp b/source/gui/detail/linux_X11/bedrock.cpp index 991cf8ef..5a69ab34 100644 --- a/source/gui/detail/linux_X11/bedrock.cpp +++ b/source/gui/detail/linux_X11/bedrock.cpp @@ -468,8 +468,8 @@ namespace detail arg.right_button = ((Button2Mask & mask_state) != 0) || (::nana::mouse::right_button == arg.button); arg.mid_button = ((Button3Mask & mask_state) != 0) || (::nana::mouse::middle_button == arg.button); arg.alt = ((Mod1Mask & mask_state) != 0); - arg.shift = ги(ShiftMask & mask_state) != 0); - arg.ctrl = ги(ControlMask & mask_state) != 0); + arg.shift = ((ShiftMask & mask_state) != 0); + arg.ctrl = ((ControlMask & mask_state) != 0); } @@ -833,7 +833,7 @@ namespace detail msgwnd->flags.action = mouse_action::over; click_arg.window_handle = reinterpret_cast(msgwnd); - emit_drawer(&drawer::click, msgwnd, arg, &context); + emit_drawer(&drawer::click, msgwnd, click_arg, &context); } } diff --git a/source/gui/place.cpp b/source/gui/place.cpp index da742af5..88ea8dd7 100644 --- a/source/gui/place.cpp +++ b/source/gui/place.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -95,13 +96,7 @@ namespace nana std::string pos_str() const { -#ifdef UNDEFINED_to_string - std::stringstream ss; - ss<