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 {
void localtime(struct tm& tm)
{
#if defined(NANA_WINDOWS)
#if defined(NANA_WINDOWS) && !defined(NANA_MINGW)
time_t t;
::time(&t);
if(localtime_s(&tm, &t) != 0)
@ -274,7 +274,7 @@ namespace nana
{
value_.hour = t.tm_hour;
value_.minute = t.tm_min;
value_.second = t.tm_sec;
value_.second = t.tm_sec;
}
time::time(unsigned hour, unsigned minute, unsigned second)

View File

@ -16,7 +16,10 @@
#include PLATFORM_SPEC_HPP
#include <shellapi.h>
#include <stdexcept>
#if defined(_MSC_VER)
#include <VersionHelpers.h>
#endif // _MSVC
namespace nana
{
@ -90,7 +93,7 @@ namespace detail
if (brush.color != color_)
brush.set(context, brush.style, color_);
}
void drawable_impl_type::pen_spec::set(HDC context, int style, int width, unsigned clr)
{
if (this->color != clr || this->width != width || this->style != style)
@ -185,10 +188,16 @@ namespace detail
NONCLIENTMETRICS metrics = {};
metrics.cbSize = sizeof metrics;
#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);
}
#else
if(!IsWindowsVistaOrGreater())
metrics.cbSize -= sizeof(metrics.iPaddedBorderWidth);
#endif
#endif
::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);