fix GCC errors when -std=c++17 is specified

This commit is contained in:
Jinhao 2018-08-09 07:50:56 +08:00
parent 1ff1c55592
commit e91d3446eb
3 changed files with 33 additions and 31 deletions

View File

@ -172,7 +172,7 @@ namespace nana
} }
else if constexpr(std::is_invocable_v<Function>) else if constexpr(std::is_invocable_v<Function>)
{ {
return _m_emplace(new docker{ this, [fn](arg_reference){ return _m_emplace(new docker{ this, [fn](arg_reference) mutable{
fn(); fn();
}, false }, false); }, false }, false);
} }
@ -200,7 +200,7 @@ namespace nana
} }
else if constexpr(std::is_invocable_v<Function>) else if constexpr(std::is_invocable_v<Function>)
{ {
return _m_emplace(new docker{ this, [fn](arg_reference) { return _m_emplace(new docker{ this, [fn](arg_reference) mutable{
fn(); fn();
}, true }, in_front); }, true }, in_front);
} }

View File

@ -1384,9 +1384,10 @@ namespace nana{
} }
else if(window_relationship::owner == rsp) else if(window_relationship::owner == rsp)
return owner; return owner;
else if(window_relationship::parent == rsp)
return x11_parent_window(wd); return x11_parent_window(wd);
#endif #endif
return nullptr;
} }
native_window_type native_interface::parent_window(native_window_type child, native_window_type new_parent, bool returns_previous) native_window_type native_interface::parent_window(native_window_type child, native_window_type new_parent, bool returns_previous)

View File

@ -498,16 +498,16 @@ namespace paint
{ {
if (nullptr == impl_->handle || nullptr == impl_->handle->context) return {}; if (nullptr == impl_->handle || nullptr == impl_->handle->context) return {};
if (text.empty()) return std::unique_ptr<unsigned[]>{new unsigned[1]}; auto pxbuf = std::unique_ptr<unsigned[]>{ new unsigned[text.size() ? text.size() : 1] };
if (!text.empty())
{
unsigned tab_pixels = impl_->handle->string.tab_length * impl_->handle->string.whitespace_pixels; unsigned tab_pixels = impl_->handle->string.tab_length * impl_->handle->string.whitespace_pixels;
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
int * dx = new int[text.size()]; int * dx = new int[text.size()];
SIZE extents; SIZE extents;
::GetTextExtentExPoint(impl_->handle->context, text.data(), static_cast<int>(text.size()), 0, 0, dx, &extents); ::GetTextExtentExPoint(impl_->handle->context, text.data(), static_cast<int>(text.size()), 0, 0, dx, &extents);
auto pxbuf = std::unique_ptr<unsigned[]>{ new unsigned[text.size()] };
pxbuf[0] = (text[0] == '\t' ? tab_pixels : dx[0]); pxbuf[0] = (text[0] == '\t' ? tab_pixels : dx[0]);
for (std::size_t i = 1; i < text.size(); ++i) for (std::size_t i = 1; i < text.size(); ++i)
@ -521,7 +521,7 @@ namespace paint
auto xft = reinterpret_cast<XftFont*>(impl_->handle->font->native_handle()); auto xft = reinterpret_cast<XftFont*>(impl_->handle->font->native_handle());
XGlyphInfo extents; XGlyphInfo extents;
for (std::size_t i = 0; i < len; ++i) for (std::size_t i = 0; i < text.size(); ++i)
{ {
if (text[i] != '\t') if (text[i] != '\t')
{ {
@ -533,6 +533,7 @@ namespace paint
pxbuf[i] = tab_pixels; pxbuf[i] = tab_pixels;
} }
#endif #endif
}
return pxbuf; return pxbuf;
} }