add batch in add_child

This commit is contained in:
hippoz 2022-07-26 04:47:03 +03:00
parent 360952c25d
commit 3c5c5b6b51
Signed by: hippoz
GPG key ID: 7C52899193467641

View file

@ -90,6 +90,10 @@ bool Widget::add_child(std::shared_ptr<Widget> child) {
if (child->parent()) {
return false;
}
if (window())
window()->start_batch();
m_children.push_back(child);
child->set_parent(this);
@ -98,6 +102,9 @@ bool Widget::add_child(std::shared_ptr<Widget> child) {
// after we call set_window() on it.
child->set_window(m_window);
if (window())
window()->end_batch();
return true;
}