Skip to content

Commit 3ba4636

Browse files
fix: add parent for menu_item_custom_widget's subwidget
1 parent 0565ba9 commit 3ba4636

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/shell/contextmenu/menu_widget.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ void mb_shell::menu_item_custom_widget::update(ui::update_context &ctx) {
883883
if (custom_widget) {
884884
auto ctx2 = ctx.with_offset(*x, *y);
885885
custom_widget->update(ctx2);
886+
custom_widget->parent = this;
886887
}
887888
}
888889
void mb_shell::menu_item_custom_widget::render(ui::nanovg_context ctx) {

src/shell/script/binding_types_breeze_ui.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "ui.h"
55
#include "widget.h"
66
#include <memory>
7+
#include <print>
78

89
namespace mb_shell::js {
910
std::vector<std::shared_ptr<breeze_ui::js_widget>>
@@ -423,8 +424,8 @@ breeze_ui::js_flex_layout_widget::get_background_color() const {
423424
if ($widget) {
424425
auto flex_widget = std::dynamic_pointer_cast<widget_js_base>($widget);
425426
if (flex_widget) {
426-
auto color = *flex_widget->background_color;
427-
return std::make_tuple(color[0], color[1], color[2], color[3]);
427+
auto color = *flex_widget->background_color;
428+
return std::make_tuple(color[0], color[1], color[2], color[3]);
428429
}
429430
}
430431
return std::nullopt;
@@ -443,7 +444,7 @@ breeze_ui::js_flex_layout_widget::get_background_paint() const {
443444
if ($widget) {
444445
auto flex_widget = std::dynamic_pointer_cast<widget_js_base>($widget);
445446
if (flex_widget) {
446-
return std::make_shared<breeze_paint>(*flex_widget->background_paint);
447+
return std::make_shared<breeze_paint>(*flex_widget->background_paint);
447448
}
448449
}
449450
return nullptr;
@@ -520,8 +521,7 @@ breeze_ui::js_flex_layout_widget::get_border_paint() const {
520521
if ($widget) {
521522
auto flex_widget = std::dynamic_pointer_cast<widget_js_base>($widget);
522523
if (flex_widget && flex_widget->border_paint) {
523-
return std::make_shared<breeze_paint>(
524-
*flex_widget->border_paint);
524+
return std::make_shared<breeze_paint>(*flex_widget->border_paint);
525525
}
526526
}
527527
return nullptr;

0 commit comments

Comments
 (0)