From 57fe04119f693306ed83bdcd408229584bebc6ba Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 5 Jul 2017 00:22:52 +0800 Subject: [PATCH 1/5] fix bug that some cpp files weren't included in vc2017 sln --- build/vc2017/nana.vcxproj | 19 ++- build/vc2017/nana.vcxproj.filters | 211 ++++++++++++++++++------------ 2 files changed, 145 insertions(+), 85 deletions(-) diff --git a/build/vc2017/nana.vcxproj b/build/vc2017/nana.vcxproj index b1e450b8..818d6cf8 100644 --- a/build/vc2017/nana.vcxproj +++ b/build/vc2017/nana.vcxproj @@ -23,7 +23,7 @@ {42D0520F-EFA5-4831-84FE-2B9085301C5D} Win32Proj nana - 10.0.15063.0 + 8.1 @@ -163,6 +163,8 @@ + + @@ -173,6 +175,20 @@ + + + + + + + + + + + + + + @@ -199,6 +215,7 @@ + diff --git a/build/vc2017/nana.vcxproj.filters b/build/vc2017/nana.vcxproj.filters index 13f8c102..ef973d0c 100644 --- a/build/vc2017/nana.vcxproj.filters +++ b/build/vc2017/nana.vcxproj.filters @@ -1,244 +1,287 @@  - + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - + {81850bad-7436-405a-beb5-357c5e34f039} - + {44582b36-4575-4663-ac02-e80417f95d05} - + {b7e3cdb7-99ac-473d-86c8-53dddce70480} - + {02fa693c-edc1-4e04-bf1d-ec3c2a89182a} - + {cffe7506-b96c-42aa-a747-41b5115d9580} - + {b6b2c032-c6a4-4884-8c14-eca4aa69ef0c} - + {58f2e0f8-4d63-40db-807d-d7adf71c4ebe} - + {f288a25d-3ce8-4c2e-a86f-9aeda44bc557} - + {90b2da01-605d-489b-b6c5-2af8d3c2d8a6} - + {430feed0-e1d9-45cb-8d59-e1a48a04d19f} - + {dcf62634-a658-453b-a58d-f1a96a12a8b8} - + {c1cdf46a-519f-422a-947f-39e173045414} - 源文件 + Sources - 源文件 + Sources - 源文件 + Sources - 源文件 + Sources - 源文件 + Sources - 源文件 + Sources - 源文件 + Sources - 源文件 + Sources - 源文件\audio\detail + Sources\audio\detail - 源文件\audio\detail + Sources\audio\detail - 源文件\audio\detail + Sources\audio\detail - 源文件\audio + Sources\audio - 源文件\detail + Sources\detail - 源文件\filesystem + Sources\filesystem - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\detail + Sources\gui\detail - 源文件\gui\widgets\skeletons + Sources\gui\widgets\skeletons - 源文件\gui\widgets\skeletons + Sources\gui\widgets\skeletons - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\gui\widgets + Sources\gui\widgets - 源文件\paint\detail + Sources\paint\detail - 源文件\paint\detail + Sources\paint\detail - 源文件\paint + Sources\paint - 源文件\paint + Sources\paint - 源文件\paint + Sources\paint - 源文件\paint + Sources\paint - 源文件\paint + Sources\paint - 源文件\system + Sources\system - 源文件\system + Sources\system - 源文件\system + Sources\system - 源文件\system + Sources\system - 源文件\threads + Sources\threads - 源文件\detail + Sources\detail + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui + + + Sources\gui \ No newline at end of file From bd5e9fdc4ab9d0f2c5ed594cbffa63ae06b9c4c9 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 7 Jul 2017 08:34:34 +0800 Subject: [PATCH 2/5] fix issues on different MinGW distro --- include/nana/c++defines.hpp | 32 ++--- include/nana/filesystem/filesystem.hpp | 68 +++++----- source/detail/platform_abstraction.cpp | 38 +++--- source/detail/platform_spec_windows.cpp | 164 ------------------------ source/gui/screen.cpp | 4 +- source/gui/timer.cpp | 2 +- 6 files changed, 75 insertions(+), 233 deletions(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index a849dfaa..89ff0b04 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -36,7 +36,7 @@ * - STD_TO_STRING_NOT_SUPPORTED (MinGW with GCC < 4.8) * - STD_FILESYSTEM_NOT_SUPPORTED (GCC < 5.3) .... * - CXX_NO_INLINE_NAMESPACE (Visual C++ < 2015) - * - _enable_std_make_unique (GCC < 4.9) + * - _enable_std_make_unique (__cpluscplus < 201402) * - _enable_std_put_time (GCC < 5) * - _enable_std_clamp (Visual C++ < 2017) */ @@ -118,13 +118,6 @@ #if defined(__GLIBCPP__) || defined(__GLIBCXX__) // is a known issue on libstdc++, it works on libc++ #define STD_CODECVT_NOT_SUPPORTED - - #if !defined(__cpp_lib_make_unique) || (__cpp_lib_make_unique != 201304) - #ifndef _enable_std_make_unique - #define _enable_std_make_unique - #endif - #endif - #endif #elif defined(__GNUC__) //GCC @@ -149,20 +142,19 @@ # define _enable_std_put_time # endif - #if ((__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3 ) ) ) - # undef STD_FILESYSTEM_NOT_SUPPORTED - /// \todo define the namespace ???? - #endif +# if ((__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3 ) ) ) +# undef STD_FILESYSTEM_NOT_SUPPORTED +# endif #if (__GNUC__ == 4) #if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1)) #define STD_THREAD_NOT_SUPPORTED #endif - +#if 0 #if (__GNUC_MINOR__ < 9) #define _enable_std_make_unique #endif - +#endif #if defined(NANA_MINGW) #ifndef __MINGW64_VERSION_MAJOR //It's a knonwn issue under MinGW(except MinGW-W64) @@ -191,8 +183,18 @@ # endif #endif -//Detects the feature std::clamp +#include +//Detects std::make_unique +#if (!defined(_MSC_VER)) && (__cplusplus < 201402L) +# if !defined(__cpp_lib_make_unique) || (__cpp_lib_make_unique != 201304) +# ifndef _enable_std_make_unique +# define _enable_std_make_unique +# endif +# endif +#endif + +//Detects the feature std::clamp //Visual C++ 2017 with /std:c++latest provides the std::clamp #if !defined(_MSVC_LANG) || (_MSVC_LANG < 201403L) diff --git a/include/nana/filesystem/filesystem.hpp b/include/nana/filesystem/filesystem.hpp index 836b7778..59020d68 100644 --- a/include/nana/filesystem/filesystem.hpp +++ b/include/nana/filesystem/filesystem.hpp @@ -22,9 +22,9 @@ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4099.html --- in html format // http://article.gmane.org/gmane.comp.lib.boost.devel/256220 --- The filesystem TS unanimously approved by ISO. // http://theboostcpplibraries.com/boost.filesystem --- Boost docs -// http://www.boost.org/doc/libs/1_58_0/libs/filesystem/doc/index.htm --- +// http://www.boost.org/doc/libs/1_58_0/libs/filesystem/doc/index.htm --- // http://www.boost.org/doc/libs/1_34_0/libs/filesystem/doc/index.htm -// http://www.boost.org/doc/libs/1_58_0/boost/filesystem.hpp +// http://www.boost.org/doc/libs/1_58_0/boost/filesystem.hpp // https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x --- Table 1.4. g++ C++ Technical Specifications Implementation Status #ifndef NANA_FILESYSTEM_HPP @@ -46,10 +46,10 @@ #if (defined(NANA_FILESYSTEM_FORCE) || ( (defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(BOOST_FILESYSTEM_AVAILABLE)) && !(defined(BOOST_FILESYSTEM_FORCE) || defined(STD_FILESYSTEM_FORCE)) ) ) -#undef NANA_USING_NANA_FILESYSTEM +#undef NANA_USING_NANA_FILESYSTEM #define NANA_USING_NANA_FILESYSTEM 1 -#elif (defined(BOOST_FILESYSTEM_AVAILABLE) && ( defined(BOOST_FILESYSTEM_FORCE) || ( defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(STD_FILESYSTEM_FORCE) ) )) +#elif (defined(BOOST_FILESYSTEM_AVAILABLE) && ( defined(BOOST_FILESYSTEM_FORCE) || ( defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(STD_FILESYSTEM_FORCE) ) )) #undef NANA_USING_BOOST_FILESYSTEM #define NANA_USING_BOOST_FILESYSTEM 1 @@ -65,14 +65,14 @@ namespace std { } // std #else - -#undef NANA_USING_STD_FILESYSTEM -#define NANA_USING_STD_FILESYSTEM 1 -# include +# undef NANA_USING_STD_FILESYSTEM +# define NANA_USING_STD_FILESYSTEM 1 +# include #endif + #ifndef __cpp_lib_experimental_filesystem -# define __cpp_lib_experimental_filesystem 1 +# define __cpp_lib_experimental_filesystem 201406 #endif #if NANA_USING_NANA_FILESYSTEM @@ -96,7 +96,7 @@ namespace nana { namespace experimental { namespace filesystem #endif enum class file_type - { + { none = 0, ///< has not been determined or an error occurred while trying to determine not_found = -1, ///< Pseudo-type: file was not found. Is not considered an error regular = 1, @@ -108,11 +108,11 @@ namespace nana { namespace experimental { namespace filesystem socket =7, unknown= 8 ///< The file does exist, but is of an operating system dependent type not covered by any of the other }; - - enum class perms + + enum class perms { none = 0, ///< There are no permissions set for the file. - all = 0x1FF, ///< owner_all | group_all | others_all + all = 0x1FF, ///< owner_all | group_all | others_all mask = 0xFFF, ///< all | set_uid | set_gid | sticky_bit. unknown = 0xFFFF ///< not known, such as when a file_status object is created without specifying the permissions }; @@ -147,13 +147,13 @@ namespace nana { namespace experimental { namespace filesystem file_type value_; perms perms_; }; - + /// concerned only with lexical and syntactic aspects and does not necessarily exist in - /// external storage, and the pathname is not necessarily valid for the current operating system - /// or for a particular file system - /// A sequence of elements that identify the location of a file within a filesystem. + /// external storage, and the pathname is not necessarily valid for the current operating system + /// or for a particular file system + /// A sequence of elements that identify the location of a file within a filesystem. /// The elements are the: - /// rootname (opt), root-directory (opt), and an optional sequence of filenames. + /// rootname (opt), root-directory (opt), and an optional sequence of filenames. /// The maximum number of elements in the sequence is operating system dependent. class path { @@ -177,7 +177,7 @@ namespace nana { namespace experimental { namespace filesystem // modifiers //void clear() noexcept; - path& make_preferred(); + path& make_preferred(); path& remove_filename(); //path& replace_filename(const path& replacement); //path& replace_extension(const path& replacement = path()); @@ -188,13 +188,13 @@ namespace nana { namespace experimental { namespace filesystem //path root_directory() const; //path root_path() const; //path relative_path() const; - path parent_path() const; - path filename() const; + path parent_path() const; + path filename() const; //path stem() const; - path extension() const; + path extension() const; // query - bool empty() const noexcept; + bool empty() const noexcept; //bool has_root_name() const; //bool has_root_directory() const; //bool has_root_path() const; @@ -228,7 +228,7 @@ namespace nana { namespace experimental { namespace filesystem //appends path& operator/=(const path& other); - + template path& operator/=(const Source& source) { @@ -265,8 +265,8 @@ namespace nana { namespace experimental { namespace filesystem filesystem_error(const std::string& msg, const path& path1, std::error_code err); filesystem_error(const std::string& msg, const path& path1, const path& path2, std::error_code err); - const path& path1() const noexcept; - const path& path2() const noexcept; + const path& path1() const noexcept; + const path& path2() const noexcept; // const char* what() const noexcept; private: path path1_; @@ -307,8 +307,8 @@ namespace nana { namespace experimental { namespace filesystem directory_iterator& operator++(); directory_iterator operator++(int); ///< extention - bool equal(const directory_iterator& x) const; - + bool equal(const directory_iterator& x) const; + private: template static bool _m_ignore(const Char * p) @@ -330,12 +330,12 @@ namespace nana { namespace experimental { namespace filesystem }; /// enable directory_iterator range-based for statements inline directory_iterator begin( directory_iterator iter) noexcept - { + { return iter; } inline directory_iterator end( const directory_iterator&) noexcept - { + { return {}; } @@ -388,7 +388,7 @@ namespace nana { namespace experimental { namespace filesystem if (is_directory(fs)) return (directory_iterator() == directory_iterator(p)); - + return (file_size(p) == 0); } // bool is_empty(const path& p, error_code& ec) noexcept; @@ -400,7 +400,7 @@ namespace nana { namespace experimental { namespace filesystem //bool create_directory(const path& p, error_code& ec) noexcept; bool create_directory(const path& p, const path& attributes); //bool create_directory(const path& p, const path& attributes, error_code& ec) noexcept; - + /// The time of last data modification of p, determined as if by the value of the POSIX /// stat structure member st_mtime obtained as if by POSIX stat(). @@ -412,7 +412,7 @@ namespace nana { namespace experimental { namespace filesystem path current_path(); //path current_path(error_code& ec); void current_path(const path& p); ///< chdir - //void current_path(const path& p, error_code& ec) noexcept; + //void current_path(const path& p, error_code& ec) noexcept; bool remove(const path& p); bool remove(const path& p, std::error_code& ec); // noexcept; @@ -422,7 +422,7 @@ namespace nana { namespace experimental { namespace filesystem template std::basic_string parent_path(const std::basic_string& path) - { + { auto index = path.size(); if (index) diff --git a/source/detail/platform_abstraction.cpp b/source/detail/platform_abstraction.cpp index 40d12d46..6490045c 100644 --- a/source/detail/platform_abstraction.cpp +++ b/source/detail/platform_abstraction.cpp @@ -3,6 +3,11 @@ #include "../paint/truetype.hpp" #ifdef NANA_WINDOWS + +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif + # include /////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -50,6 +55,19 @@ IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; } +#ifndef _WIN32_WINNT_WINXP +# define _WIN32_WINNT_WINXP 0x0501 +#endif // _WIN32_WINNT_WINXP + +#ifndef _WIN32_WINNT_VISTA +# define _WIN32_WINNT_VISTA 0x0600 +#endif // _WIN32_WINNT_VISTA + +#ifndef _WIN32_WINNT_WIN7 +# define _WIN32_WINNT_WIN7 0x0601 +#endif // _WIN32_WINNT_WIN7 + + VERSIONHELPERAPI IsWindowsXPOrGreater() { @@ -115,24 +133,10 @@ IsWindows8OrGreater() return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0); } -#ifndef _WIN32_WINNT_WINBLUE // (0x0602) +#ifndef _WIN32_WINNT_WINBLUE // (0x0602) #define _WIN32_WINNT_WINBLUE (0x0602) #endif // _WIN32_WINNT_WINBLUE (0x0602) -VERSIONHELPERAPI -IsWindows8Point1OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0); -} - -VERSIONHELPERAPI -IsWindowsServer() -{ - OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, { 0 }, 0, 0, 0, VER_NT_WORKSTATION }; - DWORDLONG const dwlConditionMask = VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL); - - return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask); -} #endif // NTDDI_VERSION @@ -398,11 +402,11 @@ namespace nana { if(0 == --(i->second)) fc.erase(i); - + if(0 == fc.size()) ::FcConfigAppFontClear(nullptr); } } #endif } -} \ No newline at end of file +} diff --git a/source/detail/platform_spec_windows.cpp b/source/detail/platform_spec_windows.cpp index eb58c603..4bc09546 100644 --- a/source/detail/platform_spec_windows.cpp +++ b/source/detail/platform_spec_windows.cpp @@ -24,170 +24,6 @@ #include -/////////////////////////////////////////////////////////////////////////////////////////////////////// - -/****************************************************************** -* * -* VersionHelpers.h -- This module defines helper functions to * -* promote version check with proper * -* comparisons. * -* * -* Copyright (c) Microsoft Corp. All rights reserved. * -* * -******************************************************************/ - -#include // for _In_, etc. - -#if !defined(__midl) && !defined(SORTPP_PASS) - -#if (NTDDI_VERSION >= NTDDI_WINXP) - -#ifdef __cplusplus - -#define VERSIONHELPERAPI inline bool - -#else // __cplusplus - -#define VERSIONHELPERAPI FORCEINLINE BOOL - -#endif // __cplusplus - -VERSIONHELPERAPI -IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) -{ - OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0,{ 0 }, 0, 0 }; - DWORDLONG const dwlConditionMask = VerSetConditionMask( - VerSetConditionMask( - VerSetConditionMask( - 0, VER_MAJORVERSION, VER_GREATER_EQUAL), - VER_MINORVERSION, VER_GREATER_EQUAL), - VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); - - osvi.dwMajorVersion = wMajorVersion; - osvi.dwMinorVersion = wMinorVersion; - osvi.wServicePackMajor = wServicePackMajor; - - return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; -} - -VERSIONHELPERAPI -IsWindowsXPOrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0); -} - -VERSIONHELPERAPI -IsWindowsXPSP1OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1); -} - -VERSIONHELPERAPI -IsWindowsXPSP2OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2); -} - -VERSIONHELPERAPI -IsWindowsXPSP3OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3); -} - -VERSIONHELPERAPI -IsWindowsVistaOrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0); -} - -VERSIONHELPERAPI -IsWindowsVistaSP1OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1); -} - -VERSIONHELPERAPI -IsWindowsVistaSP2OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2); -} - -VERSIONHELPERAPI -IsWindows7OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0); -} - -VERSIONHELPERAPI -IsWindows7SP1OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1); -} - -#ifndef _WIN32_WINNT_WIN8 // (0x0602) - #define _WIN32_WINNT_WIN8 (0x0602) -#endif // _WIN32_WINNT_WIN8(0x0602) - -VERSIONHELPERAPI -IsWindows8OrGreater() -{ - - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0); -} - -#ifndef _WIN32_WINNT_WINBLUE // (0x0602) - #define _WIN32_WINNT_WINBLUE (0x0602) -#endif // _WIN32_WINNT_WINBLUE (0x0602) - -VERSIONHELPERAPI -IsWindows8Point1OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0); -} - -VERSIONHELPERAPI -IsWindowsServer() -{ - OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0,{ 0 }, 0, 0, 0, VER_NT_WORKSTATION }; - DWORDLONG const dwlConditionMask = VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL); - - return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask); -} - -#endif // NTDDI_VERSION - -#endif // defined(__midl) - - - -//////////////////////////////////////////////////////////////////////////////////////////////////// - - - -//#if defined(_MSC_VER) -////#include -//bool IsWindowsVistaOrGreater() { return false; } -//bool //VERSIONHELPERAPI -//IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) -//{ -// OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0,{ 0 }, 0, 0 }; -// DWORDLONG const dwlConditionMask = VerSetConditionMask( -// VerSetConditionMask( -// VerSetConditionMask( -// 0, VER_MAJORVERSION, VER_GREATER_EQUAL), -// VER_MINORVERSION, VER_GREATER_EQUAL), -// VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); -// -// osvi.dwMajorVersion = wMajorVersion; -// osvi.dwMinorVersion = wMinorVersion; -// osvi.wServicePackMajor = wServicePackMajor; -// -// return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; -//} -// -// -// -//#endif // _MSVC namespace nana { diff --git a/source/gui/screen.cpp b/source/gui/screen.cpp index da390bda..d66629d3 100644 --- a/source/gui/screen.cpp +++ b/source/gui/screen.cpp @@ -100,14 +100,14 @@ namespace nana tmp.swap(displays); } - static BOOL __stdcall enum_proc(HMONITOR handle, HDC context, LPRECT r, LPARAM self_ptr) + static BOOL __stdcall enum_proc(HMONITOR handle, HDC /*context*/, LPRECT /*r*/, LPARAM self_ptr) { auto disp_cont = reinterpret_cast*>(self_ptr); MONITORINFOEX mi; mi.cbSize = sizeof(MONITORINFOEX); if (::GetMonitorInfo(handle, &mi)) disp_cont->emplace_back(disp_cont->size(), mi); - + return TRUE; } #else diff --git a/source/gui/timer.cpp b/source/gui/timer.cpp index e961f6e9..e5ea14e3 100644 --- a/source/gui/timer.cpp +++ b/source/gui/timer.cpp @@ -142,7 +142,7 @@ namespace nana }; //end class timer_core #if defined(NANA_WINDOWS) - void __stdcall timer_driver::_m_timer_proc(HWND hwnd, UINT uMsg, UINT_PTR id, DWORD dwTime) + void __stdcall timer_driver::_m_timer_proc(HWND /*hwnd*/, UINT /*uMsg*/, UINT_PTR id, DWORD /*dwTime*/) #else void timer_driver::_m_timer_proc(std::size_t id) #endif From 50db6f81f0f58beef8c1c15939589b713bd63691 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 7 Jul 2017 22:50:41 +0800 Subject: [PATCH 3/5] fix bug that C++14 detection uses a wrong number --- include/nana/c++defines.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index 89ff0b04..3d73b0ca 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -186,7 +186,7 @@ #include //Detects std::make_unique -#if (!defined(_MSC_VER)) && (__cplusplus < 201402L) +#if (!defined(_MSC_VER)) && (__cplusplus >= 201300) # if !defined(__cpp_lib_make_unique) || (__cpp_lib_make_unique != 201304) # ifndef _enable_std_make_unique # define _enable_std_make_unique From d4fb5a226fd2ba3bc887111ba3bc4f9bd5e3979a Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 8 Jul 2017 04:22:26 +0800 Subject: [PATCH 4/5] fix issues that nuwen/TDM MinGW distro --- include/nana/c++defines.hpp | 37 +++++++++++++------------------------ source/stdc++.cpp | 8 +++++--- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index 3d73b0ca..4c7a244e 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -150,11 +150,7 @@ #if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1)) #define STD_THREAD_NOT_SUPPORTED #endif -#if 0 - #if (__GNUC_MINOR__ < 9) - #define _enable_std_make_unique - #endif -#endif + #if defined(NANA_MINGW) #ifndef __MINGW64_VERSION_MAJOR //It's a knonwn issue under MinGW(except MinGW-W64) @@ -183,30 +179,23 @@ # endif #endif -#include -//Detects std::make_unique -#if (!defined(_MSC_VER)) && (__cplusplus >= 201300) -# if !defined(__cpp_lib_make_unique) || (__cpp_lib_make_unique != 201304) -# ifndef _enable_std_make_unique -# define _enable_std_make_unique -# endif -# endif +//Detects the feature std::make_unique +//std::make_unique has been provided by Visual C++ 2013 and later +#undef _enable_std_make_unique +#if (defined(__clang__) && (__cplusplus < 201305L || (__cplusplus == 201305L && (__clang_major__ * 100 + __clang_minor__ < 304 )))) \ + || ((!defined(__clang__)) && defined(__GNUC__) && __cplusplus < 201300L) +# define _enable_std_make_unique #endif + //Detects the feature std::clamp //Visual C++ 2017 with /std:c++latest provides the std::clamp -#if !defined(_MSVC_LANG) || (_MSVC_LANG < 201403L) - -// std::clamp's feature test macro is defined inside -// But nana still avoids introducing on MSVC. -# ifndef _MSC_VER -# include -# endif - -# if ((!defined(__cpp_lib_clamp)) || (__cpp_lib_clamp < 201603)) && (!defined(_enable_std_clamp)) -# define _enable_std_clamp -# endif +#undef _enable_std_clamp +#if (defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || _MSVC_LANG < 201403L)) \ + || (defined(__clang__) && (__cplusplus < 201406L)) \ + || (defined(__GNUC__) && (!defined(__clang__)) && (__cplusplus < 201703)) +# define _enable_std_clamp #endif diff --git a/source/stdc++.cpp b/source/stdc++.cpp index 3796cba8..593ec334 100644 --- a/source/stdc++.cpp +++ b/source/stdc++.cpp @@ -15,6 +15,8 @@ //Implement workarounds for GCC/MinGW which version is below 4.8.2 #if defined(STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED) #include +#include +#include namespace std { int stoi(const std::string& str, std::size_t * pos, int base) @@ -449,14 +451,14 @@ namespace std //{ // unsigned sz = 200; // std::wstring str(sz, L'\0'); - // sz = std::wcsftime(&str[0], str.size() - 1, fmt, tmb); + // sz = std::wcsftime(&str[0], str.size() - 1, fmt, tmb); // str.resize(sz); // return str; //} // http://en.cppreference.com/w/cpp/chrono/c/wcsftime // Defined in header // std::size_t wcsftime(wchar_t* str, std::size_t count, const wchar_t* format, const std::tm* time); - // Converts the date and time information from a given calendar time time to a null - terminated + // Converts the date and time information from a given calendar time time to a null - terminated // wide character string str according to format string format.Up to count bytes are written. // Parameters // str - pointer to the first element of the wchar_t array for output @@ -464,4 +466,4 @@ namespace std // format - pointer to a null - terminated wide character string specifying the format of conversion. } -#endif // _enable_std_put_time \ No newline at end of file +#endif // _enable_std_put_time From 255f5851c6597a6e9a5cfcc7f43cb652c66d53a6 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 8 Jul 2017 11:22:18 +0800 Subject: [PATCH 5/5] tabstop weird experience if it processes tabstop --- source/gui/widgets/spinbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/gui/widgets/spinbox.cpp b/source/gui/widgets/spinbox.cpp index 2cb89870..2fad022f 100644 --- a/source/gui/widgets/spinbox.cpp +++ b/source/gui/widgets/spinbox.cpp @@ -282,8 +282,10 @@ namespace nana reset_text(); + //Spinbox doesn't process the tabstop unlike other text editors. + //Otherwise it would bring a weird user experience. + //Issued by jk. API::tabstop(wd); - API::eat_tabstop(wd, true); API::effects_edge_nimbus(wd, effects::edge_nimbus::active); API::effects_edge_nimbus(wd, effects::edge_nimbus::over); reset_text_area();