fix bug that widgets are mistakenly drawn on nested_form(#252)
This commit is contained in:
parent
166abe52f3
commit
c348ec4009
@ -149,33 +149,34 @@ namespace nana
|
|||||||
// reads the overlaps that are overlapped a rectangular block
|
// reads the overlaps that are overlapped a rectangular block
|
||||||
bool window_layout::read_overlaps(core_window_t* wd, const nana::rectangle& vis_rect, std::vector<wd_rectangle>& blocks)
|
bool window_layout::read_overlaps(core_window_t* wd, const nana::rectangle& vis_rect, std::vector<wd_rectangle>& blocks)
|
||||||
{
|
{
|
||||||
|
auto const is_wd_root = (category::flags::root == wd->other.category);
|
||||||
wd_rectangle block;
|
wd_rectangle block;
|
||||||
while (wd->parent)
|
while (wd->parent)
|
||||||
{
|
{
|
||||||
auto & siblings = wd->parent->children;
|
auto i = std::find(wd->parent->children.cbegin(), wd->parent->children.cend(), wd);
|
||||||
//It should be checked that whether the window is still a chlid of its parent.
|
if (i != wd->parent->children.cend())
|
||||||
if (siblings.size())
|
|
||||||
{
|
{
|
||||||
auto i = &(siblings[0]);
|
for (++i; i != wd->parent->children.cend(); ++i)
|
||||||
auto *end = i + siblings.size();
|
|
||||||
i = std::find(i, end, wd);
|
|
||||||
if (i != end)
|
|
||||||
{
|
{
|
||||||
//find the widget that next to wd.
|
core_window_t* cover = *i;
|
||||||
for (++i; i < end; ++i)
|
|
||||||
|
if (!cover->visible)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (is_wd_root ?
|
||||||
|
(category::flags::root == cover->other.category)
|
||||||
|
:
|
||||||
|
((category::flags::root != cover->other.category) && (nullptr == cover->effect.bground)))
|
||||||
{
|
{
|
||||||
core_window_t* cover = *i;
|
if (overlap(vis_rect, rectangle{ cover->pos_root, cover->dimension }, block.r))
|
||||||
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))
|
block.window = cover;
|
||||||
{
|
blocks.push_back(block);
|
||||||
block.window = cover;
|
|
||||||
blocks.push_back(block);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wd = wd->parent;
|
wd = wd->parent;
|
||||||
}
|
}
|
||||||
return (!blocks.empty());
|
return (!blocks.empty());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user