Merge branch 'hotfix-1.1.2' into develop
This commit is contained in:
commit
5c6c0ddcd1
@ -31,7 +31,7 @@ namespace nana
|
|||||||
: nana::noncopyable, nana::nonmovable
|
: nana::noncopyable, nana::nonmovable
|
||||||
{
|
{
|
||||||
friend class detail::widget_notifier_interface;
|
friend class detail::widget_notifier_interface;
|
||||||
class notifier;
|
class inner_widget_notifier;
|
||||||
typedef void(*dummy_bool_type)(widget* (*)(const widget&));
|
typedef void(*dummy_bool_type)(widget* (*)(const widget&));
|
||||||
public:
|
public:
|
||||||
virtual ~widget() = default;
|
virtual ~widget() = default;
|
||||||
|
@ -189,8 +189,6 @@ namespace nana
|
|||||||
auto retain = wd->together.events_ptr;
|
auto retain = wd->together.events_ptr;
|
||||||
auto evts_ptr = retain.get();
|
auto evts_ptr = retain.get();
|
||||||
|
|
||||||
//enable refreshing flag, this is a RAII class for exception-safe
|
|
||||||
flag_guard fguard(this, wd);
|
|
||||||
|
|
||||||
switch (evt_code)
|
switch (evt_code)
|
||||||
{
|
{
|
||||||
@ -199,8 +197,11 @@ namespace nana
|
|||||||
auto arg = dynamic_cast<const arg_click*>(&event_arg);
|
auto arg = dynamic_cast<const arg_click*>(&event_arg);
|
||||||
if (nullptr == arg)
|
if (nullptr == arg)
|
||||||
return;
|
return;
|
||||||
|
{
|
||||||
wd->drawer.click(*arg);
|
//enable refreshing flag, this is a RAII class for exception-safe
|
||||||
|
flag_guard fguard(this, wd);
|
||||||
|
wd->drawer.click(*arg);
|
||||||
|
}
|
||||||
if (!draw_only)
|
if (!draw_only)
|
||||||
evts_ptr->click.emit(*arg);
|
evts_ptr->click.emit(*arg);
|
||||||
}
|
}
|
||||||
@ -249,7 +250,11 @@ namespace nana
|
|||||||
throw std::runtime_error("Invalid mouse event code");
|
throw std::runtime_error("Invalid mouse event code");
|
||||||
}
|
}
|
||||||
|
|
||||||
(wd->drawer.*drawer_event_fn)(*arg);
|
{
|
||||||
|
//enable refreshing flag, this is a RAII class for exception-safe
|
||||||
|
flag_guard fguard(this, wd);
|
||||||
|
(wd->drawer.*drawer_event_fn)(*arg);
|
||||||
|
}
|
||||||
|
|
||||||
if (!draw_only)
|
if (!draw_only)
|
||||||
evt_addr->emit(*arg);
|
evt_addr->emit(*arg);
|
||||||
@ -260,7 +265,12 @@ namespace nana
|
|||||||
auto arg = dynamic_cast<const arg_wheel*>(&event_arg);
|
auto arg = dynamic_cast<const arg_wheel*>(&event_arg);
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
wd->drawer.mouse_wheel(*arg);
|
{
|
||||||
|
//enable refreshing flag, this is a RAII class for exception-safe
|
||||||
|
flag_guard fguard(this, wd);
|
||||||
|
wd->drawer.mouse_wheel(*arg);
|
||||||
|
}
|
||||||
|
|
||||||
if (!draw_only)
|
if (!draw_only)
|
||||||
evts_ptr->mouse_wheel.emit(*arg);
|
evts_ptr->mouse_wheel.emit(*arg);
|
||||||
}
|
}
|
||||||
@ -299,7 +309,12 @@ namespace nana
|
|||||||
default:
|
default:
|
||||||
throw std::runtime_error("Invalid keyboard event code");
|
throw std::runtime_error("Invalid keyboard event code");
|
||||||
}
|
}
|
||||||
(wd->drawer.*drawer_event_fn)(*arg);
|
{
|
||||||
|
//enable refreshing flag, this is a RAII class for exception-safe
|
||||||
|
flag_guard fguard(this, wd);
|
||||||
|
(wd->drawer.*drawer_event_fn)(*arg);
|
||||||
|
}
|
||||||
|
|
||||||
if (!draw_only)
|
if (!draw_only)
|
||||||
evt_addr->emit(*arg);
|
evt_addr->emit(*arg);
|
||||||
break;
|
break;
|
||||||
@ -317,7 +332,11 @@ namespace nana
|
|||||||
auto arg = dynamic_cast<const arg_focus*>(&event_arg);
|
auto arg = dynamic_cast<const arg_focus*>(&event_arg);
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
wd->drawer.focus(*arg);
|
{
|
||||||
|
//enable refreshing flag, this is a RAII class for exception-safe
|
||||||
|
flag_guard fguard(this, wd);
|
||||||
|
wd->drawer.focus(*arg);
|
||||||
|
}
|
||||||
if (!draw_only)
|
if (!draw_only)
|
||||||
evts_ptr->focus.emit(*arg);
|
evts_ptr->focus.emit(*arg);
|
||||||
}
|
}
|
||||||
@ -328,7 +347,11 @@ namespace nana
|
|||||||
auto arg = dynamic_cast<const arg_move*>(&event_arg);
|
auto arg = dynamic_cast<const arg_move*>(&event_arg);
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
wd->drawer.move(*arg);
|
{
|
||||||
|
//enable refreshing flag, this is a RAII class for exception-safe
|
||||||
|
flag_guard fguard(this, wd);
|
||||||
|
wd->drawer.move(*arg);
|
||||||
|
}
|
||||||
if (!draw_only)
|
if (!draw_only)
|
||||||
evts_ptr->move.emit(*arg);
|
evts_ptr->move.emit(*arg);
|
||||||
}
|
}
|
||||||
@ -339,7 +362,11 @@ namespace nana
|
|||||||
auto arg = dynamic_cast<const arg_resizing*>(&event_arg);
|
auto arg = dynamic_cast<const arg_resizing*>(&event_arg);
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
wd->drawer.resizing(*arg);
|
{
|
||||||
|
//enable refreshing flag, this is a RAII class for exception-safe
|
||||||
|
flag_guard fguard(this, wd);
|
||||||
|
wd->drawer.resizing(*arg);
|
||||||
|
}
|
||||||
if (!draw_only)
|
if (!draw_only)
|
||||||
evts_ptr->resizing.emit(*arg);
|
evts_ptr->resizing.emit(*arg);
|
||||||
}
|
}
|
||||||
@ -350,7 +377,11 @@ namespace nana
|
|||||||
auto arg = dynamic_cast<const arg_resized*>(&event_arg);
|
auto arg = dynamic_cast<const arg_resized*>(&event_arg);
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
wd->drawer.resized(*arg);
|
{
|
||||||
|
//enable refreshing flag, this is a RAII class for exception-safe
|
||||||
|
flag_guard fguard(this, wd);
|
||||||
|
wd->drawer.resized(*arg);
|
||||||
|
}
|
||||||
if (!draw_only)
|
if (!draw_only)
|
||||||
evts_ptr->resized.emit(*arg);
|
evts_ptr->resized.emit(*arg);
|
||||||
}
|
}
|
||||||
|
@ -326,6 +326,9 @@ namespace detail
|
|||||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||||
if (impl_->wd_register.available(wd) == false) return;
|
if (impl_->wd_register.available(wd) == false) return;
|
||||||
|
|
||||||
|
if (wd->flags.destroying)
|
||||||
|
return;
|
||||||
|
|
||||||
if(wd->other.category == category::root_tag::value)
|
if(wd->other.category == category::root_tag::value)
|
||||||
{
|
{
|
||||||
auto &brock = bedrock::instance();
|
auto &brock = bedrock::instance();
|
||||||
@ -340,13 +343,15 @@ namespace detail
|
|||||||
if(wd->flags.modal || (wd->owner == nullptr) || wd->owner->flags.take_active)
|
if(wd->flags.modal || (wd->owner == nullptr) || wd->owner->flags.take_active)
|
||||||
native_interface::activate_owner(wd->root);
|
native_interface::activate_owner(wd->root);
|
||||||
|
|
||||||
//Close should detach the drawer and send destroy signal to widget object.
|
if (!wd->flags.destroying)
|
||||||
//Otherwise, when a widget object is been deleting in other thread by delete operator, the object will be destroyed
|
{
|
||||||
//before the window_manager destroyes the window, and then, window_manager detaches the
|
//Close should detach the drawer and send destroy signal to widget object.
|
||||||
//non-existing drawer_trigger which is destroyed by destruction of widget. Crash!
|
//Otherwise, when a widget object is been deleting in other thread by delete operator, the object will be destroyed
|
||||||
wd->drawer.detached();
|
//before the window_manager destroyes the window, and then, window_manager detaches the
|
||||||
|
//non-existing drawer_trigger which is destroyed by destruction of widget. Crash!
|
||||||
wd->widget_notifier->destroy();
|
wd->drawer.detached();
|
||||||
|
wd->widget_notifier->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
native_interface::close_window(wd->root);
|
native_interface::close_window(wd->root);
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1440,6 @@ namespace nana
|
|||||||
private:
|
private:
|
||||||
void _m_calc_metrics(graph_reference graph, std::forward_list<item>& items)
|
void _m_calc_metrics(graph_reference graph, std::forward_list<item>& items)
|
||||||
{
|
{
|
||||||
const auto height_px = graph.height();
|
|
||||||
std::vector<unsigned> pxs;
|
std::vector<unsigned> pxs;
|
||||||
|
|
||||||
unsigned pixels = 0;
|
unsigned pixels = 0;
|
||||||
|
@ -22,10 +22,10 @@ namespace nana
|
|||||||
|
|
||||||
//class widget
|
//class widget
|
||||||
//@brief:The definition of class widget
|
//@brief:The definition of class widget
|
||||||
class widget::notifier: public detail::widget_notifier_interface
|
class widget::inner_widget_notifier : public detail::widget_notifier_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
notifier(widget& wdg)
|
inner_widget_notifier(widget& wdg)
|
||||||
: wdg_(wdg)
|
: wdg_(wdg)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ namespace nana
|
|||||||
|
|
||||||
std::unique_ptr<::nana::detail::widget_notifier_interface> widget::_m_wdg_notifier()
|
std::unique_ptr<::nana::detail::widget_notifier_interface> widget::_m_wdg_notifier()
|
||||||
{
|
{
|
||||||
return std::unique_ptr<::nana::detail::widget_notifier_interface>(new notifier(*this));
|
return std::unique_ptr<::nana::detail::widget_notifier_interface>(new inner_widget_notifier(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::_m_complete_creation()
|
void widget::_m_complete_creation()
|
||||||
@ -348,7 +348,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
std::unique_ptr<widget_notifier_interface> widget_notifier_interface::get_notifier(widget* wdg)
|
std::unique_ptr<widget_notifier_interface> widget_notifier_interface::get_notifier(widget* wdg)
|
||||||
{
|
{
|
||||||
return std::unique_ptr<widget_notifier_interface>(new widget::notifier(*wdg));
|
return std::unique_ptr<widget_notifier_interface>(new widget::inner_widget_notifier(*wdg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//end namespace nana
|
}//end namespace nana
|
||||||
|
@ -55,6 +55,21 @@ namespace nana
|
|||||||
const int png_width = ::png_get_image_width(png_ptr, info_ptr);
|
const int png_width = ::png_get_image_width(png_ptr, info_ptr);
|
||||||
const int png_height = ::png_get_image_height(png_ptr, info_ptr);
|
const int png_height = ::png_get_image_height(png_ptr, info_ptr);
|
||||||
png_byte color_type = ::png_get_color_type(png_ptr, info_ptr);
|
png_byte color_type = ::png_get_color_type(png_ptr, info_ptr);
|
||||||
|
const auto bit_depth = ::png_get_bit_depth(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
//do some extra work for palette/gray color type
|
||||||
|
if (PNG_COLOR_TYPE_PALETTE == color_type)
|
||||||
|
::png_set_palette_to_rgb(png_ptr);
|
||||||
|
else if ((PNG_COLOR_TYPE_GRAY == color_type) && (bit_depth < 8))
|
||||||
|
::png_set_gray_to_rgb(png_ptr);
|
||||||
|
|
||||||
|
bool is_alpha_enabled = (::png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) != 0);
|
||||||
|
if (is_alpha_enabled)
|
||||||
|
::png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
|
||||||
|
//make sure 8-bit per channel
|
||||||
|
if (16 == bit_depth)
|
||||||
|
::png_set_strip_16(png_ptr);
|
||||||
|
|
||||||
::png_set_interlace_handling(png_ptr);
|
::png_set_interlace_handling(png_ptr);
|
||||||
::png_read_update_info(png_ptr, info_ptr);
|
::png_read_update_info(png_ptr, info_ptr);
|
||||||
@ -65,7 +80,7 @@ namespace nana
|
|||||||
|
|
||||||
pixbuf_.open(png_width, png_height);
|
pixbuf_.open(png_width, png_height);
|
||||||
|
|
||||||
const bool is_alpha_enabled = ((PNG_COLOR_MASK_ALPHA & color_type) != 0);
|
is_alpha_enabled |= ((PNG_COLOR_MASK_ALPHA & color_type) != 0);
|
||||||
pixbuf_.alpha_channel(is_alpha_enabled);
|
pixbuf_.alpha_channel(is_alpha_enabled);
|
||||||
|
|
||||||
if(is_alpha_enabled && (png_rowbytes == png_width * sizeof(pixel_argb_t)))
|
if(is_alpha_enabled && (png_rowbytes == png_width * sizeof(pixel_argb_t)))
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
*
|
||||||
* @file: nana/paint/detail/native_paint_interface.cpp
|
* @file: nana/paint/detail/native_paint_interface.cpp
|
||||||
|
* @contributors: dareg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nana/config.hpp>
|
#include <nana/config.hpp>
|
||||||
@ -187,7 +188,9 @@ namespace detail
|
|||||||
reinterpret_cast<XftChar8*>(const_cast<char*>(utf8str.c_str())), utf8str.size());
|
reinterpret_cast<XftChar8*>(const_cast<char*>(utf8str.c_str())), utf8str.size());
|
||||||
*/
|
*/
|
||||||
auto fs = reinterpret_cast<XftFont*>(dw->font->handle);
|
auto fs = reinterpret_cast<XftFont*>(dw->font->handle);
|
||||||
std::unique_ptr<FT_UInt> glyphs_ptr(new FT_UInt[len]);
|
|
||||||
|
//Fixed missing array declaration by dareg
|
||||||
|
std::unique_ptr<FT_UInt[]> glyphs_ptr(new FT_UInt[len]);
|
||||||
auto glyphs = glyphs_ptr.get();
|
auto glyphs = glyphs_ptr.get();
|
||||||
const auto endstr = str + len;
|
const auto endstr = str + len;
|
||||||
for(auto chr = str; chr != endstr; ++chr)
|
for(auto chr = str; chr != endstr; ++chr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user