fix some MinGW compiling errors

This commit is contained in:
Jinhao 2015-05-04 03:42:16 +08:00
parent 6c473f141f
commit e7c9708b4f
2 changed files with 15 additions and 6 deletions

View File

@ -19,7 +19,7 @@
namespace { namespace {
void localtime(struct tm& tm) void localtime(struct tm& tm)
{ {
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS) && !defined(NANA_MINGW)
time_t t; time_t t;
::time(&t); ::time(&t);
if(localtime_s(&tm, &t) != 0) if(localtime_s(&tm, &t) != 0)

View File

@ -16,7 +16,10 @@
#include PLATFORM_SPEC_HPP #include PLATFORM_SPEC_HPP
#include <shellapi.h> #include <shellapi.h>
#include <stdexcept> #include <stdexcept>
#if defined(_MSC_VER)
#include <VersionHelpers.h> #include <VersionHelpers.h>
#endif // _MSVC
namespace nana namespace nana
{ {
@ -185,10 +188,16 @@ namespace detail
NONCLIENTMETRICS metrics = {}; NONCLIENTMETRICS metrics = {};
metrics.cbSize = sizeof metrics; metrics.cbSize = sizeof metrics;
#if(WINVER >= 0x0600) #if(WINVER >= 0x0600)
if(!IsWindowsVistaOrGreater()) #if defined(NANA_MINGW)
{ OSVERSIONINFO osvi = {};
osvi.dwOSVersionInfoSize = sizeof(osvi);
::GetVersionEx(&osvi);
if (osvi.dwMajorVersion < 6)
metrics.cbSize -= sizeof(metrics.iPaddedBorderWidth); metrics.cbSize -= sizeof(metrics.iPaddedBorderWidth);
} #else
if(!IsWindowsVistaOrGreater())
metrics.cbSize -= sizeof(metrics.iPaddedBorderWidth);
#endif
#endif #endif
::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof metrics, &metrics, 0); ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof metrics, &metrics, 0);
def_font_ptr_ = make_native_font(metrics.lfMessageFont.lfFaceName, font_size_to_height(9), 400, false, false, false); def_font_ptr_ = make_native_font(metrics.lfMessageFont.lfFaceName, font_size_to_height(9), 400, false, false, false);