fix non-popup root window(nested_form) issues
This commit is contained in:
parent
25743b14a9
commit
1446849454
@ -140,7 +140,7 @@ namespace nana
|
|||||||
for (++i; i < end; ++i)
|
for (++i; i < end; ++i)
|
||||||
{
|
{
|
||||||
core_window_t* cover = *i;
|
core_window_t* cover = *i;
|
||||||
if (cover->visible && (nullptr == cover->effect.bground))
|
if ((category::flags::root != cover->other.category) && cover->visible && (nullptr == cover->effect.bground))
|
||||||
{
|
{
|
||||||
if (overlap(vis_rect, rectangle{ cover->pos_root, cover->dimension }, block.r))
|
if (overlap(vis_rect, rectangle{ cover->pos_root, cover->dimension }, block.r))
|
||||||
{
|
{
|
||||||
@ -271,9 +271,15 @@ namespace nana
|
|||||||
for (auto child : wd->children)
|
for (auto child : wd->children)
|
||||||
{
|
{
|
||||||
//it will not past children if no drawer and visible is false.
|
//it will not past children if no drawer and visible is false.
|
||||||
if ((false == child->visible) || ((child->other.category != category::lite_widget_tag::value) && child->drawer.graphics.empty()))
|
if ((false == child->visible) || ((category::flags::lite_widget != child->other.category) && child->drawer.graphics.empty()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (category::flags::root == child->other.category)
|
||||||
|
{
|
||||||
|
paint(child, is_child_refreshed, is_child_refreshed);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (nullptr == child->effect.bground)
|
if (nullptr == child->effect.bground)
|
||||||
{
|
{
|
||||||
if (overlap(nana::rectangle{ child->pos_root, child->dimension }, parent_rect, rect))
|
if (overlap(nana::rectangle{ child->pos_root, child->dimension }, parent_rect, rect))
|
||||||
|
|||||||
@ -291,6 +291,14 @@ namespace detail
|
|||||||
if (result.native_handle)
|
if (result.native_handle)
|
||||||
{
|
{
|
||||||
core_window_t* wd = new core_window_t(owner, widget_notifier_interface::get_notifier(wdg), (category::root_tag**)nullptr);
|
core_window_t* wd = new core_window_t(owner, widget_notifier_interface::get_notifier(wdg), (category::root_tag**)nullptr);
|
||||||
|
if (nested)
|
||||||
|
{
|
||||||
|
wd->owner = nullptr;
|
||||||
|
wd->parent = owner;
|
||||||
|
wd->index = static_cast<unsigned>(owner->children.size());
|
||||||
|
owner->children.push_back(wd);
|
||||||
|
}
|
||||||
|
|
||||||
wd->flags.take_active = !app.no_activate;
|
wd->flags.take_active = !app.no_activate;
|
||||||
wd->title = native_interface::window_caption(result.native_handle);
|
wd->title = native_interface::window_caption(result.native_handle);
|
||||||
|
|
||||||
@ -1301,7 +1309,9 @@ namespace detail
|
|||||||
void window_manager::_m_disengage(core_window_t* wd, core_window_t* for_new)
|
void window_manager::_m_disengage(core_window_t* wd, core_window_t* for_new)
|
||||||
{
|
{
|
||||||
auto * const wdpa = wd->parent;
|
auto * const wdpa = wd->parent;
|
||||||
bool established = (for_new && wdpa != for_new);
|
|
||||||
|
|
||||||
|
bool established = (for_new && (wdpa != for_new));
|
||||||
decltype(for_new->root_widget->other.attribute.root) pa_root_attr = nullptr;
|
decltype(for_new->root_widget->other.attribute.root) pa_root_attr = nullptr;
|
||||||
|
|
||||||
if (established)
|
if (established)
|
||||||
@ -1446,10 +1456,17 @@ namespace detail
|
|||||||
wd->pos_root -= delta_pos;
|
wd->pos_root -= delta_pos;
|
||||||
for (auto child : wd->children)
|
for (auto child : wd->children)
|
||||||
{
|
{
|
||||||
child->root = wd->root;
|
if (category::flags::root == child->other.category)
|
||||||
child->root_graph = wd->root_graph;
|
{
|
||||||
child->root_widget = wd->root_widget;
|
native_interface::set_parent(child->root, wd->root);
|
||||||
set_pos_root(child, delta_pos);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
child->root = wd->root;
|
||||||
|
child->root_graph = wd->root_graph;
|
||||||
|
child->root_widget = wd->root_widget;
|
||||||
|
set_pos_root(child, delta_pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1481,8 +1498,30 @@ namespace detail
|
|||||||
brock.emit(event_code::destroy, wd, arg, true, brock.get_thread_context());
|
brock.emit(event_code::destroy, wd, arg, true, brock.get_thread_context());
|
||||||
|
|
||||||
//Delete the children widgets.
|
//Delete the children widgets.
|
||||||
for (auto i = wd->children.rbegin(), end = wd->children.rend(); i != end; ++i)
|
for (auto i = wd->children.rbegin(), end = wd->children.rend(); i != end;)
|
||||||
_m_destroy(*i);
|
{
|
||||||
|
auto child = *i;
|
||||||
|
|
||||||
|
if (category::flags::root == child->other.category)
|
||||||
|
{
|
||||||
|
//closing a child root window erases itself from wd->children,
|
||||||
|
//to make sure the iterator is valid, it must be reloaded.
|
||||||
|
|
||||||
|
auto offset = std::distance(wd->children.rbegin(), i);
|
||||||
|
|
||||||
|
//!!!
|
||||||
|
//a potential issue is that if the calling thread is not same with child's thread,
|
||||||
|
//the child root window may not be erased from wd->children now.
|
||||||
|
native_interface::close_window(child->root);
|
||||||
|
|
||||||
|
i = wd->children.rbegin();
|
||||||
|
std::advance(i, offset);
|
||||||
|
end = wd->children.rend();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
_m_destroy(child);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
wd->children.clear();
|
wd->children.clear();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -542,8 +542,8 @@ namespace API
|
|||||||
{
|
{
|
||||||
auto iwd = reinterpret_cast<basic_window*>(wd);
|
auto iwd = reinterpret_cast<basic_window*>(wd);
|
||||||
internal_scope_guard lock;
|
internal_scope_guard lock;
|
||||||
if(restrict::wd_manager().available(iwd))
|
if (restrict::wd_manager().available(iwd))
|
||||||
return reinterpret_cast<window>(iwd->other.category == category::flags::root ? iwd->owner : iwd->parent);
|
return reinterpret_cast<window>(iwd->parent);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user