Codechange: Use vector/unique_ptr inside widget containers.

This replaces a C-style double-linked-list which required all widgets
to have next/prev pointers, and removes the need for manual pointer management.
This commit is contained in:
Peter Nelson
2023-12-30 07:36:21 +00:00
committed by Peter Nelson
parent 628092f133
commit 9a3934ae23
5 changed files with 98 additions and 135 deletions

View File

@@ -1852,8 +1852,9 @@ public:
void SetupSmallestSize(Window *w) override
{
NWidgetBase *display = this->head;
NWidgetBase *bar = display->next;
assert(this->children.size() == 2);
NWidgetBase *display = this->children.front().get();
NWidgetBase *bar = this->children.back().get();
display->SetupSmallestSize(w);
bar->SetupSmallestSize(w);
@@ -1875,8 +1876,9 @@ public:
this->current_x = given_width;
this->current_y = given_height;
NWidgetBase *display = this->head;
NWidgetBase *bar = display->next;
assert(this->children.size() == 2);
NWidgetBase *display = this->children.front().get();
NWidgetBase *bar = this->children.back().get();
if (sizing == ST_SMALLEST) {
this->smallest_x = given_width;